Open flyingit opened 2 years ago
Great, if you look at the logs now, you'll notice that multiple builds will exist: 4 build to be exact! That's because for each of the 2 operating systems we're running tests against 2 versions so: 2 OS :heavy_multiplication_x: 2 Node.js versions = 4 builds.
Our custom workflow now accounts for:
Let's now try to create a dedicated test job and satisfy the second item in our custom workflow checklist.
This will allow us to separate the build and test functions of our workflow into more than one job that will run when our workflow is triggered.
Create a new job called "test" as follows (we'll use ellipses ...
to only show the parts of the workflow we're interested in, but you should not copy the ellipses directly):
name: Node CI
on: [push]
jobs:
build:
...
test:
...
build
job, include the following portions of your existing workflow:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: npm install and build webpack
run: |
npm install
npm run build
test
job, include the following portions of your existing workflow:
test:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, windows-2016]
node-version: [12.x, 14.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install, and test
run: |
npm install
npm test
env:
CI: true
When you commit to this branch, the workflow should run again. I'll respond when it is finished running.
Great! We've now got two nicely separated build
and test
jobs. Our custom workflow now accounts for:
If you'd like to learn more about jobs, see:
jobs
No action required in this step - just waiting. I'll respond when the workflow runs your jobs.
Changes have been done to the matrix to os