Implement openapi-generator v2 #605
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
--- | |
name: CI | |
on: | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
api-ts: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: | |
# Skip lts/-2 while it refers to Node.js 14, since this version | |
# does not come with Node.js's built-in test runner. | |
# - lts/-2 | |
# Skip lts/-1 while it refers to Node.js 16, since this version | |
# ships with a segfault when collecting code coverage with | |
# Node.js's built-in test runner. | |
# - lts/-1 | |
- lts/* | |
name: Node.js ${{ matrix.node-version }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Configure Node.js | |
uses: actions/setup-node@v3 | |
with: | |
cache: npm | |
node-version: ${{ matrix.node-version }} | |
- name: Install dependencies | |
run: | | |
npm ci | |
# `@swc/core` has a postinstall hook that in GHA pulls in the wasm version of swc. This pulls in the native | |
# binary version instead, which is faster and more reliable. Also, the wasm version seems to fail with a | |
# strange serde error in CI. ("Error: invalid type: unit value, expected struct Options") | |
# See: https://github.com/swc-project/swc/blob/main/postinstall.js#L197-L200 | |
core_version="$(jq --raw-output '.packages."node_modules/@swc/core".optionalDependencies."@swc/core-linux-x64-gnu"' < ./package-lock.json)" | |
npm install -no-save --loglevel=error --prefer-offline --no-audit --progress=false "@swc/core-linux-x64-gnu@${core_version}" | |
- name: Restore Turbo Cache | |
uses: actions/cache@v3 | |
with: | |
path: node_modules/.cache | |
key: | |
turbo-${{ matrix.node-version }}-${{ github.ref_name }}-${{ github.job | |
}}-${{ github.sha }} | |
# According to GitHub documentation, only keys generated by the PR branch and the target branch are considered. This is | |
# to prevent a malicious PR from manipulating the cache to inject malicious code into unrelated branches. | |
# See: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key | |
restore-keys: | | |
turbo-${{ matrix.node-version }}-${{ github.ref_name }}-${{ github.job }}- | |
turbo-${{ matrix.node-version }}-${{ github.ref_name }}- | |
turbo-${{ matrix.node-version }}- | |
- name: Compile TypeScript | |
run: npm run build | |
- name: Test | |
run: npm test | |
# Only run CI for GitHub Pages on Node.js 16 because docusaurus doesn't support | |
# earlier Node.js versions. | |
website: | |
runs-on: ubuntu-latest | |
name: GitHub Pages | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Configure Node.js | |
uses: actions/setup-node@v3 | |
with: | |
cache: npm | |
node-version: lts/* | |
- name: Cache node_modules | |
uses: actions/cache@v3 | |
id: cache-node-modules | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} | |
- name: Install dependencies | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
run: npm ci | |
working-directory: website | |
- name: Build Docusaurus static site files | |
run: npm run build | |
working-directory: website |