GitHub Actions → GitLab CI
React monorepo: GitHub Actions → GitLab CI
A typical React monorepo with lint + test + build, converted to GitLab CI with stages and parallel matrix.
name: ci
on: [push, pull_request]
jobs:
lint:
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 run lint
test:
runs-on: ubuntu-latest
needs: [lint]
strategy:
matrix:
shard: [1, 2, 3, 4]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: 20, cache: npm }
- run: npm ci
- run: npm test -- --shard=${{ matrix.shard }}/4stages:
- stage-0
- stage-1
lint:
stage: stage-0
image: node:20
cache:
key: $CI_COMMIT_REF_SLUG
paths: [.npm/]
script:
- npm ci
- npm run lint
test:
stage: stage-1
image: node:20
needs: [lint]
parallel:
matrix:
- shard: ["1", "2", "3", "4"]
script:
- npm ci
- npm test -- --shard=$shard/4- •Stages auto-derived from `needs:`.
- •Cache hoisted from a per-step actions/cache to a job-level cache: block.
- •matrix.shard rewritten to GitLab-compatible parallel:matrix entry.