Agent Wranglers

ENG-16Recommended

Run the checks on every change

Run the full check on a clean machine for every push and pull request, not only on a developer's computer.

How to do it

Use a CI service, such as GitHub Actions or GitLab CI. Start from a clean checkout, install from the lock file and run the same script as the deploy. Pin each outside action to a full commit hash, and give the job read-only access, as build secrets explains. Set a time limit on the job, and cancel older runs for the same branch. Include the formatter in its check mode. Include the security scanners too. They are the dependency audit of Lock and audit dependencies, the static scan of Scan every change for known mistakes and a secret scanner. Keep it fast, so people wait for it instead of skipping it. One tested pick is Use GitHub Actions for continuous integration.

Examples

YAML example

# .github/workflows/check.yml
name: check
on: [push, pull_request]
permissions:
  contents: read
concurrency:
  group: check-${{ github.ref }}
  cancel-in-progress: true
jobs:
  check:
    runs-on: ubuntu-latest
    timeout-minutes: 20
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
      - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
        with: { node-version-file: .nvmrc }
      - run: npm ci
      - run: ./check.sh

How to check

Push a commit that breaks one test. The pull request shows a failed check before the job's time limit, such as 20 minutes.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/engineering/version-control-and-review/continuous-integration">Agent Wranglers engineering playbook</a>. In code you write, add a comment next to it with the same link.