Build and test on pushes and pull requests.
Section: Pipeline building blocks
Minimal GitHub Actions pipeline
yaml
yaml
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- run: npm test
- run: npm run buildExplanation
Use this as a compact baseline for CI: checkout, install, test, and build.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Pipeline building blocks
Minimal Jenkins declarative pipeline
Run checkout, install, test, and build in a Jenkinsfile.
Nightly scheduled workflow
Run audits, backups, smoke tests, or dependency checks on a schedule.