build(ns-workflows-1): use nodenext for TypeScript modules (#4470) #10611
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: ApiDOM Monorepo Build | |
on: | |
push: | |
branches: [ main, 1.x ] | |
pull_request: | |
branches: [ main, 1.x ] | |
env: | |
CPU_CORES: 2 | |
jobs: | |
lint-commit-messages: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # necessary for linting commit messages | |
ref: ${{ github.event.pull_request.head.sha }} # necessary to check out pull request HEAD commit instead of merge commit | |
- name: Use Node.js 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
cache-dependency-path: 'package-lock.json' | |
- name: Install dependencies | |
run: npm ci --engine-strict=false | |
- name: Lint commit message | |
if: github.ref != 'refs/heads/main' && github.actor != 'dependabot[bot]' | |
run: | | |
npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
cache-dependency-path: 'package-lock.json' | |
- name: Install dependencies | |
run: npm ci --engine-strict=false | |
- name: Generate typescript declarations | |
run: npm run typescript:declaration | |
working-directory: ./packages/apidom-error | |
- name: Lint code | |
run: npm run lint | |
check-typescript-types: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
cache-dependency-path: 'package-lock.json' | |
- name: Install dependencies | |
run: npm ci --engine-strict=false | |
- name: Generate typescript declarations | |
run: npm run typescript:declaration | |
- name: Check TypeScript types | |
run: npm run typescript:check-types | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
cache-dependency-path: 'package-lock.json' | |
- name: Install dependencies | |
run: npm ci --engine-strict=false | |
- name: Build monorepo for testing | |
run: | | |
npm run prebuild | |
npm run build:es | |
- name: Execute tests in monorepo | |
run: npm run test | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
cache-dependency-path: 'package-lock.json' | |
- name: Install dependencies | |
run: npm ci --engine-strict=false | |
- name: Build monorepo | |
run: npm run build:es | |
- name: Build ApiDOM Playground | |
run: npm run build | |
working-directory: ./packages/apidom-playground | |
- name: Upload build artifacts from ApiDOM Playground | |
if: github.ref == 'refs/heads/main' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build | |
path: ./packages/apidom-playground/build |