-
Notifications
You must be signed in to change notification settings - Fork 483
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: test npm build&install against LTS node versions (#1967)
- Loading branch information
Showing
5 changed files
with
566 additions
and
416 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 |
---|---|---|
@@ -0,0 +1,92 @@ | ||
name: Test NodeJS | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
gh-node-version: | ||
required: true | ||
type: string | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.gh-node-version }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
reset-badge: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Reset ${{ inputs.gh-node-version }} badge" | ||
uses: RubbaBoy/BYOB@24f464284c1fd32028524b59607d417a2e36fee7 | ||
with: | ||
ICON: https://raw.githubusercontent.com/devicons/devicon/master/icons/nodejs/nodejs-original.svg | ||
NAME: "node-${{ inputs.gh-node-version }}" | ||
LABEL: "${{ inputs.gh-node-version }}" | ||
STATUS: "Building..." | ||
COLOR: grey | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
test-node: | ||
needs: [reset-badge] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
runs-on: ${{ matrix.os }} | ||
outputs: | ||
node-version: ${{ steps.node_version.outputs.version }} | ||
steps: | ||
|
||
- uses: actions/checkout@v2 | ||
|
||
- name: Use Node.js ${{ inputs.gh-node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ inputs.gh-node-version }} | ||
|
||
- name: Get exact nodejs version | ||
id: node_version | ||
run: | | ||
echo "::set-output name=version::$(node --version)" | ||
- name: Cache bigger downloads | ||
uses: actions/cache@v2 | ||
id: cache | ||
with: | ||
path: ${{ github.workspace }}/.cache | ||
key: ${{ runner.os }}-${{ inputs.gh-node-version }}-${{ hashFiles('package.json', 'package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ inputs.gh-node-version }}-${{ hashFiles('package.json', 'package-lock.json') }} | ||
${{ runner.os }}-${{ inputs.gh-node-version }} | ||
- name: Install dependencies | ||
run: npm ci --prefer-offline --no-audit --progress=false --cache ${{ github.workspace }}/.cache/npm | ||
|
||
- name: Confirm build works with Node.js ${{ inputs.gh-node-version }} on ${{ matrix.os }} | ||
run: npm run build | ||
|
||
create-badges: | ||
needs: [test-node] | ||
runs-on: ubuntu-latest | ||
if: always() | ||
steps: | ||
- name: Create success badge | ||
if: ${{ needs.test-node.result == 'success' }} | ||
uses: RubbaBoy/BYOB@24f464284c1fd32028524b59607d417a2e36fee7 | ||
with: | ||
ICON: https://raw.githubusercontent.com/devicons/devicon/master/icons/nodejs/nodejs-original.svg | ||
NAME: "node-${{ inputs.gh-node-version }}" | ||
LABEL: "${{ needs.test-node.outputs.node-version }}" | ||
STATUS: ${{needs.test-node.result}} | ||
COLOR: green | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create failure badge | ||
if: ${{ needs.test-node.result != 'success' }} | ||
uses: RubbaBoy/BYOB@24f464284c1fd32028524b59607d417a2e36fee7 | ||
with: | ||
ICON: https://raw.githubusercontent.com/devicons/devicon/master/icons/nodejs/nodejs-original.svg | ||
NAME: "node-${{ inputs.gh-node-version }}" | ||
LABEL: "${{ needs.test-node.outputs.node-version }}" | ||
STATUS: ${{needs.test-node.result}} | ||
COLOR: red | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,33 @@ | ||
name: Test build on different node versions on all platforms | ||
|
||
on: | ||
schedule: | ||
- cron: '0 12 * * 0' | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
|
||
test-node-12: | ||
uses: ./.github/workflows/node-test.yml | ||
secrets: inherit | ||
with: | ||
gh-node-version: '12.x' | ||
|
||
test-node-14: | ||
uses: ./.github/workflows/node-test.yml | ||
secrets: inherit | ||
with: | ||
gh-node-version: '14.x' | ||
|
||
test-node-16: | ||
uses: ./.github/workflows/node-test.yml | ||
secrets: inherit | ||
with: | ||
gh-node-version: '16.x' | ||
|
||
test-node-lts: | ||
uses: ./.github/workflows/node-test.yml | ||
secrets: inherit | ||
with: | ||
gh-node-version: 'lts/*' |
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
Oops, something went wrong.