Skip to content

Force node to use CJS to get around dependency import errors, and validate package types in CI #658

Force node to use CJS to get around dependency import errors, and validate package types in CI

Force node to use CJS to get around dependency import errors, and validate package types in CI #658

Workflow file for this run

name: build-test
# Run this for pushes to the main branch and for pull requests, and allow this
# to be called from other workflows
on:
push:
branches: ["main"]
pull_request:
workflow_call:
jobs:
build_and_test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18]
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- run: pnpm install
- name: Dependencies audit
run: pnpm audit --audit-level=high
- name: Check for duplicate dependencies
run: pnpm dedupe --check
- name: Build
run: pnpm run build
- name: Type check
# Though this largely happens as part of `pnpm run build`, there are
# some files that are not part of the publishable build but which we'd
# also like to type-check.
run: pnpm run type:check
- name: Format check
run: pnpm run format:check
- name: Lint check
run: pnpm run lint:check
- name: Spell check
run: pnpm run spell:check
# We run the spell check so we can see the output in CI if/when we like,
# but we won't enforce it, since there are too many technical/product
# words used that are outside the standard dictionary.
continue-on-error: true
- name: Validate markdown links
# Since most of our documentation is in README.md, notably with lots of
# internal anchor links, validate that they're formed properly. As the
# README and documentation is updated, we want to ensure that links
# remain correct. (This also checks external links, though that's a
# secondary concern.)
run: pnpm run md-link:check
- name: Test
# Run the tests and print out the coverage information. In the future,
# we could integrate with Codecov or something.
run: pnpm run test:coverage
- name: Validate the build's packaging CJS and ESM compatibility
run: npx @arethetypeswrong/cli@0.15.4 --pack