Skip to content

Generics

Generics #515

Workflow file for this run

name: Node.js CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
name: "Build and run integration tests"
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 19.x, 20.x, 21.x]
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm run build
- name: Install dependencies
run: pnpm install -r
- name: Build Other Packages (excluding docs website)
run: pnpm run --filter="!website" -r build
- name: Run Integration Tests
run: pnpm run integration-tests
- name: Build Docs Website
working-directory: ./website
run: ./scripts/build.sh
test:
name: "JS Tests"
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x, 19.x, 20.x, 21.x]
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Build # Integration tests depend upon having .js versions created by tsc
run: pnpm run build
- name: Unit Tests
run: pnpm run test
lint:
name: "Lint"
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 19.x, 20.x, 21.x]
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Lint
run: pnpm run lint
main-release:
name: Publish to NPM
runs-on: ubuntu-latest
environment: CI
if: github.event_name == 'push' && github.repository == 'captbaritone/grats'
needs: [build, test, lint]
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Build latest (main) version
if: github.ref == 'refs/heads/main'
run: pnpm run build
- name: Set package version
run: pnpm version --no-git-tag-version 0.0.0-main-${RELEASE_COMMIT_SHA:0:8}
env:
RELEASE_COMMIT_SHA: ${{ github.sha }}
# https://github.com/pnpm/pnpm/issues/3141#issuecomment-1305563972
- name: Set publishing config
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}"
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Publish
run: pnpm publish --tag main --access=public --no-git-checks