| 1 |
name: Validate Monorepo |
| 2 |
|
| 3 |
on: |
| 4 |
pull_request: |
| 5 |
types: |
| 6 |
- edited |
| 7 |
- opened |
| 8 |
- synchronize |
| 9 |
workflow_dispatch: |
| 10 |
|
| 11 |
jobs: |
| 12 |
build: |
| 13 |
runs-on: ubuntu-latest |
| 14 |
|
| 15 |
strategy: |
| 16 |
matrix: |
| 17 |
node: ['20', '24'] |
| 18 |
|
| 19 |
name: Node v${{ matrix.node }} |
| 20 |
|
| 21 |
steps: |
| 22 |
- name: Checkout Commit |
| 23 |
uses: actions/checkout@v4 |
| 24 |
with: |
| 25 |
fetch-depth: 2 |
| 26 |
|
| 27 |
- name: Update Master |
| 28 |
run: | |
| 29 |
# Ensure the remote-tracking ref exists and is up-to-date without invoking an implicit merge |
| 30 |
set -euo pipefail |
| 31 |
# Ensure the remote-tracking ref and local branch ref are up-to-date without invoking an implicit merge |
| 32 |
DEFAULT_BRANCH="${{ github.event.repository.default_branch }}" |
| 33 |
git fetch --no-tags --force origin \ |
| 34 |
"+refs/heads/${DEFAULT_BRANCH}:refs/remotes/origin/${DEFAULT_BRANCH}" \ |
| 35 |
"+refs/heads/${DEFAULT_BRANCH}:refs/heads/${DEFAULT_BRANCH}" |
| 36 |
|
| 37 |
- name: Setup Node |
| 38 |
uses: actions/setup-node@v3 |
| 39 |
with: |
| 40 |
node-version: ${{ matrix.node }} |
| 41 |
|
| 42 |
- name: Install PNPM |
| 43 |
uses: pnpm/action-setup@v4 |
| 44 |
|
| 45 |
- name: ESLint Cache |
| 46 |
uses: actions/cache@v3 |
| 47 |
with: |
| 48 |
path: ./.eslintcache |
| 49 |
key: ${{ runner.os }}-eslintcache-${{ hashFiles('./eslintcache') }} |
| 50 |
restore-keys: | |
| 51 |
${{ runner.os }}-eslintcache- |
| 52 |
|
| 53 |
- name: Sanity Check |
| 54 |
run: | |
| 55 |
echo git `git version`; |
| 56 |
echo branch `git branch --show-current`; |
| 57 |
echo node `node -v`; |
| 58 |
echo pnpm `pnpm -v` |
| 59 |
echo `moon --version` |
| 60 |
|
| 61 |
- name: pnpm install |
| 62 |
run: pnpm install --frozen-lockfile |
| 63 |
|
| 64 |
- name: Prettier |
| 65 |
run: pnpm run prettier:check |
| 66 |
|
| 67 |
# pnpm audit isn't as robust as it needs to be atm |
| 68 |
# - name: Audit Dependencies |
| 69 |
# run: pnpm security |
| 70 |
|
| 71 |
- name: Build Packages |
| 72 |
run: pnpm --recursive build |
| 73 |
|
| 74 |
- name: Lint Monorepo |
| 75 |
run: pnpm lint:js |
| 76 |
|
| 77 |
- name: Run Tests |
| 78 |
run: pnpm --filter "...[origin/master]" ci:coverage |