ci: enable pipeline publishing #152
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
name: CI | |
on: | |
push: | |
branches: [v9] | |
pull_request: | |
branches: [v9] | |
workflow_call: | |
jobs: | |
test: | |
name: Test | |
runs-on: ${{ matrix.os }} | |
needs: code-lint | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-24.04 | |
- macos-13 | |
- windows-2022 | |
node-version: | |
- 8 | |
- 9 | |
- 10 | |
- 11 | |
- 12 | |
- 13 | |
- 14 | |
- 15 | |
- 16 | |
- 17 | |
- 18 | |
- 19 | |
- 20 | |
- 21 | |
- 22 | |
- 23 | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 | |
with: | |
disable-sudo: true | |
egress-policy: block | |
allowed-endpoints: > | |
api.github.com:443 | |
coveralls.io:443 | |
github.com:443 | |
nodejs.org:443 | |
objects.githubusercontent.com:443 | |
registry.npmjs.org:443 | |
- name: Checkout Repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install Dependencies | |
if: matrix.node-version != 9 | |
run: npm ci --ignore-scripts | |
- name: Install Dependencies (Node.js v9) | |
if: matrix.node-version == 9 | |
run: npm install | |
- name: Run Tests | |
if: ${{ ! startsWith(matrix.os, 'windows-') }} | |
run: npm test --ignore-scripts | |
- name: Run Tests (Windows) | |
if: startsWith(matrix.os, 'windows-') | |
shell: cmd | |
run: npm run --ignore-scripts test-windows | |
- name: Publish Coverage | |
if: github.event != 'workflow_dispatch' | |
uses: coverallsapp/github-action@cfd0633edbd2411b532b808ba7a8b5e04f76d2c8 # v2.3.4 | |
with: | |
flag-name: run-${{ matrix.os }}-node@${{ matrix.node-version }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
parallel: true | |
post-test: | |
needs: test | |
if: github.event != 'workflow_dispatch' | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Coveralls Finished | |
uses: coverallsapp/github-action@cfd0633edbd2411b532b808ba7a8b5e04f76d2c8 # v2.3.4 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
parallel-finished: true | |
code-lint: | |
name: Code Lint | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 | |
with: | |
disable-sudo: true | |
egress-policy: block | |
allowed-endpoints: > | |
api.github.com:443 | |
github.com:443 | |
objects.githubusercontent.com:443 | |
registry.npmjs.org:443 | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Use Node.js 16 | |
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 | |
with: | |
node-version: 22 # LTS | |
- name: Install Dependencies | |
run: npm ci --ignore-scripts | |
- name: Lockfile Lint | |
run: | | |
npm exec \ | |
--no-install \ | |
--package=lockfile-lint \ | |
-- \ | |
lockfile-lint \ | |
--allowed-hosts=npm \ | |
--path=./package-lock.json \ | |
--validate-https \ | |
--validate-package-names |