ci: script #77
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: Continuous Integration | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
validate: | |
runs-on: ubuntu-20.04 | |
name: Validate | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
- name: Setup NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: "pnpm" | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Check Style | |
run: pnpm style:check | |
- name: Check Types | |
run: pnpm types:check | |
- name: Compile | |
run: pnpm build | |
tests: | |
runs-on: ubuntu-20.04 | |
name: Tests | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: [18, 20] | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
- name: Setup NodeJS | |
id: setup-node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
# See https://github.com/actions/setup-node/issues/641#issuecomment-1358859686 | |
- name: pnpm cache path | |
id: pnpm-cache-path | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- name: pnpm cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.pnpm-cache-path.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-${{ steps.setup-node.outputs.node-version }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-${{ steps.setup-node.outputs.node-version }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Run tests | |
run: pnpm test |