Try actions matrix #1166
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: Run Knip against external projects | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- '**' | |
tags: | |
- '!**' | |
jobs: | |
prepare: | |
name: Build and publish Knip | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: oven-sh/setup-bun@v2 | |
- run: bun install --ignore-scripts --frozen-lockfile | |
working-directory: packages/knip | |
- run: bun run build | |
working-directory: packages/knip | |
- run: bunx pkg-pr-new publish --compact ./packages/knip | |
test: | |
name: Run | |
runs-on: ubuntu-latest | |
needs: prepare | |
continue-on-error: true | |
strategy: | |
matrix: | |
project: | |
- name: create-typescript-app | |
repo: JoshuaKGoldberg/create-typescript-app | |
commands: | | |
pnpm install | |
pnpm dlx https://pkg.pr.new/knip@${{ github.sha }} | |
- name: slonik | |
repo: gajus/slonik | |
commands: | | |
pnpm install | |
pnpm dlx https://pkg.pr.new/knip@${{ github.sha }} | |
- name: 10ten-ja-reader | |
repo: birchill/10ten-ja-reader | |
commands: | | |
pnpm install | |
pnpm dlx https://pkg.pr.new/knip@${{ github.sha }} | |
- name: DefinitelyTyped-tools | |
repo: microsoft/DefinitelyTyped-tools | |
commands: | | |
pnpm install | |
pnpm dlx https://pkg.pr.new/knip@${{ github.sha }} | |
- name: query | |
repo: TanStack/query | |
commands: | | |
pnpm install | |
pnpm add -D -w https://pkg.pr.new/knip@${{ github.sha }} | |
pnpm test:knip --cache | |
pnpm test:knip --cache | |
- name: argos | |
repo: argos-ci/argos | |
commands: | | |
npm ci | |
npm add -D https://pkg.pr.new/knip@${{ github.sha }} | |
npm run knip | |
- name: eslint | |
repo: eslint/eslint | |
commands: | | |
npm install --force | |
npm install --prefix docs | |
npm install --force -D https://pkg.pr.new/knip@${{ github.sha }} | |
npm run lint:unused -- --cache | |
npm run lint:unused -- --cache | |
- name: TypeScript | |
repo: microsoft/TypeScript | |
commands: | | |
npm ci | |
npm install -D https://pkg.pr.new/knip@${{ github.sha }} | |
npm run knip | |
- name: InvokeAI | |
repo: invoke-ai/InvokeAI | |
sparse-checkout: invokeai/frontend/web | |
commands: | | |
cd invokeai/frontend/web | |
pnpm install | |
pnpm add -D https://pkg.pr.new/knip@${{ github.sha }} | |
bunx --bun knip --tags=-knipignore | |
bunx --bun knip --tags=-knipignore --production --fix --no-exit-code --allow-remove-files | |
bunx --bun knip --tags=-knipignore --production | |
- name: prettier | |
repo: prettier/prettier | |
commands: | | |
yarn | |
yarn --cwd scripts/release | |
yarn --cwd scripts/tools/bundle-test | |
yarn --cwd scripts/tools/eslint-plugin-prettier-internal-rules | |
yarn --cwd website | |
yarn add -D knip@https://pkg.pr.new/knip@${{ github.sha }} | |
yarn knip | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- uses: oven-sh/setup-bun@v2 | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 8 | |
- name: Check out ${{ matrix.project.repo }} | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ matrix.project.repo }} | |
path: ${{ matrix.project.name }} | |
sparse-checkout: ${{ matrix.project.sparse-checkout }} | |
- name: Run Knip in ${{ matrix.project.repo }} | |
run: | | |
cd ${{ matrix.project.name }} | |
${{ matrix.project.commands }} |