Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Railway 6 min read How-to mediumAdept

Implement a GitHub Actions Testing Suite

Walkthrough of building a CI test suite with GitHub Actions for a TypeScript Fastify API deployed on Railway. A /weekday route is added and covered with Vitest integration tests. A workflow runs on PRs and pushes to main, building the app, starting it in the background, then running the tests. Branch rulesets make the passing check required before merge, and Railway's 'wait for CI' setting stops failing commits from auto-deploying. Closing notes point to concurrency, matrix builds and caching as ways to scale the pipeline.

Assumes: Git and pull requestsNode.js and npmYAML basics

Related posts

  • AI coding has made CI a bottleneck, so we reworked ours to keep up

    Linear mediumAdept

    Linear cut pull request CI wait time from over 6 minutes to about 5 and halved runner time per test, even as its test suites nearly quadrupled. The biggest wins came from faster third-party runners (34% faster jobs), switching to tsgo (73% faster typecheck), and rewriting type-aware lint rules as pure AST checks so ESLint and later Oxlint could skip TypeScript. Further gains came from trimming critical-path gating jobs with shallow, sparse and blobless checkouts, a retrying checkout action with low-speed git timeouts, filtered pnpm installs instead of caching node_modules, schema snapshots instead of replaying migrations, and batching short checks, which saved about 87,000 runner-minutes a month. Splitting large Vitest files and moving to eight shards cut the slowest shard from 5.25 to 4.33 minutes.

  • Using Github Actions with Railway

    Railway mediumAdept

    Railway deployments can be driven from GitHub Actions instead of the built-in branch-push trigger by creating a project token, storing it as a repository secret (RAILWAY_TOKEN), and running `railway up --service=<id>` inside the official Railway CLI container. A sample workflow triggers on pushes to main, checks out the code and uploads it to Railway. The token must stay secret, but the service ID can be passed openly. The same token approach also works for tasks like running database migrations before deploy or managing pull requests.

  • Manually Optimize Deployments on Railway

    Railway mediumAdept

    Deploying a FastAPI app on Railway three ways shows large speed differences: the default Nixpacks builder took 1m27s, a slim-based custom Dockerfile took 15 seconds, and pulling a pre-built image from Docker Hub took 6 seconds. Dockerfile size tips include slim/alpine base images, multi-stage builds, fewer layers and .dockerignore. The setup is then automated with two GitHub Actions workflows: one builds and pushes the image to Docker Hub on push to main, and a second triggers a Railway CLI redeploy when the first completes.

  • Enabling branch deployments through IssueOps with GitHub Actions

    GitHub Engineering mediumAdept

    GitHub's branch-deploy Action brings the branch deploy model to any repository through IssueOps: comment commands like `.deploy` or `.deploy noop` on a pull request trigger a GitHub Actions workflow that deploys the branch before it is merged. Because changes are deployed and validated before merging, `main` stays stable and rollback means simply redeploying `main`. A sample workflow shows how the action's `continue`, `noop` and `ref` outputs gate deployment steps. The action also respects branch protection, supports deploy locks and configurable environments, and GitHub and npm use it internally, mainly for Terraform infrastructure repos where ChatOps isn't available.

  • One-Second Deploys? We Didn’t Believe It Either

    Railway easyNovice

    Railway Functions, now generally available, deploy single-file TypeScript code onto Railway's container compute in about a second, without a package.json, Git repo, IaC or container build. The pipeline parses source into an AST to infer dependencies and generates package.json on the fly, with versions pinnable directly in import specifiers. Dependencies are installed with `bun install`, which installs fastify in 500ms compared with over 6s for npm, pnpm and yarn without a lockfile. Bun then runs the TypeScript directly with no transpile or bundle step. Functions share Services' features such as volumes and variables.

The quest for software engineering knowledge.

Look:
Layout: