Every Push Should Be Tested
You merge a PR. Tests pass locally. Production breaks. Because nobody ran the tests against the actual environment.
CI/CD exists to catch this. GitHub Actions makes it free.
GitHub Actions: CI/CD Built Into GitHub
GitHub Actions runs workflows directly in your GitHub repository. No external service. No webhook setup. No separate dashboard.
Free Tier
- 2,000 minutes/month (Linux) for private repos
- Unlimited minutes for public repos
- 500MB storage for artifacts
- Concurrent jobs: up to 20
Your First Workflow
# .github/workflows/ci.yml
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- run: npm ci
- run: npm test
Push this file. Every PR now runs tests automatically.
Deploy on Merge
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci && npm run build
- uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
Merge to main → build → deploy to Cloudflare Workers. Automatically.
Useful Patterns
Matrix Testing (Test on Multiple Versions)
jobs:
test:
strategy:
matrix:
node-version: [18, 20, 22]
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm test
Cron Jobs
on:
schedule:
- cron: '0 9 * * 1' # Every Monday at 9 AM
Reusable Workflows
jobs:
call-tests:
uses: ./.github/workflows/tests.yml
with:
environment: staging
20,000+ Marketplace Actions
- actions/cache: Cache dependencies for faster builds
- docker/build-push-action: Build and push Docker images
- peaceiris/actions-gh-pages: Deploy to GitHub Pages
- actions/upload-artifact: Share files between jobs
GitHub Actions vs Alternatives
| Feature | GitHub Actions | GitLab CI | CircleCI |
|---|---|---|---|
| Price (OSS) | Free unlimited | 400 min/mo | Free tier |
| Config | YAML | YAML | YAML |
| Integration | Native GitHub | Native GitLab | Any git |
| Marketplace | 20K+ actions | Templates | Orbs |
| Self-hosted runners | Yes | Yes | Yes |
Get Started
Create .github/workflows/ci.yml in your repo. Push. Done.
Automate your data collection with CI/CD. 88+ scrapers on Apify. Custom: spinov001@gmail.com
Top comments (0)