mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-10-29 22:05:13 +08:00
60 lines
1.2 KiB
YAML
60 lines
1.2 KiB
YAML
name: Test
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- ".dev/**"
|
|
- "htdocs/**"
|
|
- ".github/workflows/test.yml"
|
|
pull_request:
|
|
paths:
|
|
- ".dev/**"
|
|
- "htdocs/**"
|
|
- ".github/workflows/test.yml"
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
test:
|
|
name: Build and test
|
|
runs-on: ubuntu-latest
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: .dev
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v5
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v5
|
|
with:
|
|
node-version: "lts/*"
|
|
|
|
# Corepack installs the pnpm pinned by package.json's packageManager,
|
|
# the same version the lockfile and local builds use.
|
|
- name: Enable Corepack
|
|
run: |
|
|
corepack enable
|
|
echo "pnpm version: $(pnpm --version)"
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Build frontend assets
|
|
run: pnpm build
|
|
|
|
# tests/compat.test.js opens the DOM fixtures in the runner's Chrome.
|
|
- name: Run tests
|
|
run: pnpm test
|
|
env:
|
|
CI: "true"
|
|
CHROME_BIN: /usr/bin/google-chrome
|