Merge pull request #17 from saiichihashimoto/stryker-and-tests #22
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
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions | |
name: "Checks" | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
permissions: | |
contents: read | |
concurrency: checks-${{ github.ref == 'refs/heads/main' && 'main' || github.event.pull_request.head.sha }} | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
id-token: write | |
issues: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- uses: actions/setup-node@v4.0.1 | |
with: | |
node-version-file: "package.json" | |
cache: "npm" | |
- id: node-modules | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
packages/*/node_modules | |
key: node-modules-${{ hashFiles('package-lock.json') }} | |
- if: steps.node-modules.outputs.cache-hit != 'true' | |
run: npm ci --ignore-scripts | |
- run: npm run build | |
- env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: npx semantic-release | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: actions/setup-node@v4.0.1 | |
with: | |
node-version-file: "package.json" | |
cache: "npm" | |
- id: node-modules | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
packages/*/node_modules | |
key: node-modules-${{ hashFiles('package-lock.json') }} | |
- if: steps.node-modules.outputs.cache-hit != 'true' | |
run: npm ci --ignore-scripts | |
- run: npm ls --package-lock-only | |
- uses: actions/cache@v3 | |
with: | |
path: node_modules/.cache/prettier/.prettier-cache | |
key: prettier-${{ github.run_id }} | |
restore-keys: | | |
prettier- | |
- run: npm run lint | |
- run: | | |
if [[ $(git status --porcelain) != "" ]]; then | |
git --no-pager diff --color --text HEAD | |
exit 1 | |
fi | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: actions/setup-node@v4.0.1 | |
with: | |
node-version-file: "package.json" | |
cache: "npm" | |
- id: node-modules | |
uses: actions/cache@v3 | |
with: | |
path: | | |
node_modules | |
packages/*/node_modules | |
key: node-modules-${{ hashFiles('package-lock.json') }} | |
- if: steps.node-modules.outputs.cache-hit != 'true' | |
run: npm ci --ignore-scripts | |
- run: npm ls --package-lock-only | |
- run: npm run stryker |