feat(analytics): use Scarf.js to provide anonymized installation analytics #6843
Workflow file for this run
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
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: Node.js CI | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16.x, 18.x, 20.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Cache Node Modules | |
id: cache-node-modules | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: node-modules-${{ hashFiles('package-lock.json') }} | |
- name: Update npm | |
if: startsWith(matrix.node-version, '14') | |
run: npm install -g npm@9 | |
- name: Install dependencies | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: Lint commit message | |
if: github.ref != 'refs/heads/master' && github.actor != 'dependabot[bot]' | |
run: git log -1 --pretty=format:"%s" | npx commitlint | |
- name: Lint code | |
run: npm run lint | |
- name: Run all tests | |
run: npm test | |
env: | |
CI: true | |
- name: Build swagger-js | |
run: npm run build | |
- name: Upload commonjs build artifacts | |
if: startsWith(matrix.node-version, '20') | |
uses: actions/upload-artifact@v4 | |
with: | |
name: commonjs | |
path: ./lib/ | |
commonjs-artifacts-test: | |
name: commonjs-artifacts-test | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Cache Node Modules | |
id: cache-node-modules | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: node-modules-${{ hashFiles('package-lock.json') }} | |
- name: Install dependencies | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: Download commonjs build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: commonjs | |
- name: Use Node 12.20.0 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 12.20.0 | |
- name: Run commonjs build artifacts on Node.js 12.20.0 | |
run: node -p "require('./commonjs')" | |
- name: Use Node 14.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 14.x | |
- name: Run commonjs build artifacts on Node.js 14.x | |
run: node -p "require('./commonjs')" | |
- name: Use Node 16.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 16.x | |
- name: Run commonjs build artifacts on Node.js 16.x | |
run: node -p "require('./commonjs')" | |
- name: Use Node 18.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
- name: Run commonjs build artifacts on Node.js 18.x | |
run: node -p "require('./commonjs')" | |
- name: Use Node 20.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- name: Run commonjs build artifacts on Node.js 20.x | |
run: node -p "require('./commonjs')" | |