-
-
Notifications
You must be signed in to change notification settings - Fork 564
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Shahar "Dawn" Or <[email protected]>
- Loading branch information
1 parent
5d4c25f
commit eb4ec10
Showing
2 changed files
with
41 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,42 @@ | ||
name: 'ci' | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
branches: [master] | ||
pull_request: {} | ||
push: {} | ||
|
||
jobs: | ||
# The ci-matrix job ends up as multiple jobs and therefore as multiple checks. | ||
# Each check's name ends up with the node version appended. | ||
# If we were to use those checks as required checks, we would have to occasionally bump them. | ||
# This job allows us to have a single check that we don't have to bump. | ||
ci: | ||
runs-on: 'ubuntu-latest' | ||
needs: ci-matrix | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: 'actions/checkout@v3' | ||
|
||
- name: 'Use Node.js' | ||
uses: 'actions/setup-node@v3' | ||
- run: exit 0 | ||
ci-matrix: | ||
needs: get-supported-node-versions | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: ${{ fromJson(needs.get-supported-node-versions.outputs.versions) }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
node-version: 'lts/*' | ||
|
||
- name: 'Cache Node dependencies' | ||
uses: 'actions/[email protected]' | ||
fetch-depth: 0 # for commit linting | ||
- uses: actions/setup-node@v3 | ||
with: | ||
path: '~/.npm' | ||
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-node- | ||
- name: 'Install dependencies' | ||
run: 'npm install' | ||
|
||
node-version: ${{ matrix.node-version }} | ||
- run: npm --global install npm@latest | ||
- run: npm ci | ||
- uses: wagoid/commitlint-github-action@v5 | ||
|
||
- name: 'Run tests' | ||
run: 'npm test' | ||
- run: npm test | ||
get-supported-node-versions: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- id: get | ||
run: | | ||
set -euxo pipefail | ||
active_versions=$(bash get-node-supported-versions.sh) | ||
echo "active=$active_versions" >> "$GITHUB_OUTPUT" | ||
outputs: | ||
versions: ${{ steps.get.outputs.active }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
set -euxo pipefail | ||
url=https://raw.githubusercontent.com/nodejs/Release/master/schedule.json | ||
release_schedule=$(curl -s $url) | ||
today=$(date "+%Y-%m-%d") | ||
active_versions=$(echo $release_schedule | jq -s "[ .[] | to_entries[] | select(.value.start <= \"$today\" and .value.end >= \"$today\") | .key[1:] ]") | ||
echo $active_versions |