Parallelize jobs in GitHub Actions (#1173)

This commit is contained in:
Abdón Rodríguez Davila 2020-12-11 17:54:05 +01:00 committed by GitHub
parent 5b84eabf1a
commit 8311efb69e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 34 additions and 16 deletions

View File

@ -1,14 +1,26 @@
name: lint, test, and build
name: CI
# run when action is manually triggered
# or when a pull request is made
on: [workflow_dispatch, pull_request]
jobs:
# job id/key
lint-test-and-build:
# job name
name: Lint, Test, and Build
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: "14.x"
- run: npm ci
- run: npm run lint
test:
name: Test
runs-on: ubuntu-latest
strategy:
@ -17,19 +29,25 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
check-latest: true
- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci
- run: npm run lint
- run: npm test
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run generate