Skip to content

Commit

Permalink
feat: new CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Zamiell committed Nov 1, 2023
1 parent ffadcab commit b107523
Show file tree
Hide file tree
Showing 70 changed files with 2,380 additions and 1,139 deletions.
115 changes: 91 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,104 @@ name: CI
on: [push, pull_request]

jobs:
build_and_lint:
build-packages:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- uses: actions/checkout@v3
- id: set-matrix
run: npx tsx ./scripts/getMonorepoPackageNames.ts build

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: lts/*
cache: yarn
build:
needs: build-packages
runs-on: ubuntu-latest
strategy:
matrix:
package-name: ${{ fromJson(needs.build-packages.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/setup
- working-directory: ./packages/${{ matrix.package-name }}
run: npm run build

- name: Retrieve the cached "node_modules" directory (if present)
uses: actions/cache@v3
id: node-cache
with:
path: node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
lint-packages:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- id: set-matrix
run: npx tsx ./scripts/getMonorepoPackageNames.ts lint

- name: Install dependencies (if the cached directory was not found)
if: steps.node-cache.outputs.cache-hit != 'true'
run: yarn install --immutable
lint:
needs: lint-packages
runs-on: ubuntu-latest
strategy:
matrix:
package-name: ${{ fromJson(needs.lint-packages.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/setup
- working-directory: ./packages/${{ matrix.package-name }}
run: npm run lint

- name: Build every package in the monorepo
run: bash build.sh
test-packages:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- id: set-matrix
run: npx tsx ./scripts/getMonorepoPackageNames.ts test

- name: Test every package in the monorepo
run: bash test.sh
test:
needs: test-packages
runs-on: ubuntu-latest
strategy:
matrix:
package-name: ${{ fromJson(needs.test-packages.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/setup
- working-directory: ./packages/${{ matrix.package-name }}
run: npm run test

- name: Lint every package in the monorepo
run: bash lint.sh
unused:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/setup

#- name: Check for unused files, dependencies, and exports
# run: npx knip

format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/setup

- name: Check that the entire repository is formatted with Prettier
# "--log-level=warn" makes it only output errors.
run: npx prettier --log-level=warn --check .

spell-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/setup

- name: Spell check the entire repository
# "--no-progress" and "--no-summary" make it only output errors.
run: npx cspell --no-progress --no-summary .

docs-deploy:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/setup

- name: Checkout the docs repository
uses: actions/checkout@v3
Expand Down Expand Up @@ -66,7 +133,7 @@ jobs:

discord:
name: Discord Failure Notification
needs: [build_and_lint]
needs: [lint, unused, format, spell-check, docs-deploy]
if: always() # This is needed to always run this job, even if the other jobs fail.
runs-on: ubuntu-latest
steps:
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
runs:
using: composite

steps:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: lts/*
cache: yarn

- name: Retrieve the cached "node_modules" directory (if present)
uses: actions/cache@v3
id: node-modules-cache
with:
path: node_modules
key: client-build-node-modules-${{ hashFiles('yarn.lock') }}

- name: Install dependencies (if the cached directory was not found)
if: steps.node-modules-cache.outputs.cache-hit != 'true'
run: yarn install --immutable
shell: bash # Composite jobs must specify the shell.
14 changes: 0 additions & 14 deletions build-package.sh

This file was deleted.

29 changes: 0 additions & 29 deletions build.sh

This file was deleted.

11 changes: 0 additions & 11 deletions cache.sh

This file was deleted.

12 changes: 0 additions & 12 deletions cloc.sh

This file was deleted.

11 changes: 0 additions & 11 deletions eslint-debug.sh

This file was deleted.

3 changes: 3 additions & 0 deletions knip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"$schema": "https://unpkg.com/knip@2/schema.json"
}
16 changes: 0 additions & 16 deletions link-isaacscript-common.sh

This file was deleted.

14 changes: 0 additions & 14 deletions lint-package.sh

This file was deleted.

44 changes: 0 additions & 44 deletions lint.sh

This file was deleted.

53 changes: 0 additions & 53 deletions nuke.sh

This file was deleted.

Loading

0 comments on commit b107523

Please sign in to comment.