Improve CI#5
Conversation
Matrix buildsGreat work so far! By targeting specific versions of Node, we've configured a build matrix which allow us to test across multiple operating systems, platforms, and language versions. See Configuring a matrix build in GitHub Help if you'd like to learn more. I'll respond when you commit the changes in the comment below. |
| strategy: | ||
| matrix: | ||
| node-version: [10.x, 12.x, 14.x, 15.x] | ||
| node-version: [12.x, 14.x] |
There was a problem hiding this comment.
Step 8: Target a Windows environment
Since we'd like to support deploying our app to Windows environments, let's add Windows to the matrix build configuration.
⌨️ Activity: Edit your workflow file to build for Windows environments
You can follow the suggestion, or manually make the changes in the numbered instructions.
| node-version: [12.x, 14.x] | |
| os: [ubuntu-latest, windows-2016] | |
| node-version: [12.x, 14.x] |
- Edit the workflow config at
.github/workflows/nodejs.yml - Add an
osfield to thestrategy.matrixsection of your workflow - Add
ubuntu-latestandwindows-2016to the target operating systems - Commit your workflow changes to this branch.
I'll respond in this pull request when you've committed.
New JobGreat, 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 ✖️ 2 Node.js versions = 4 builds. Our custom workflow now accounts for:
Step 9: Use multiple jobsLet'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. Activity: Edit your workflow file to separate build and test jobs
If you'd like to copy and paste the full workflow file instead, click here to see it in its entirety.name: Node CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: npm install and build webpack
run: |
npm install
npm run build
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: trueWhen you commit to this branch, the workflow should run again. I'll respond when it is finished running. Actions workflow not running? Click hereWhen a GitHub Actions workflow is running, you should see some checks in progress, like the screenshot below. If the checks don't appear or if the checks are stuck in progress, there's a few things you can do to try and trigger them:
|



No description provided.