Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 26 additions & 24 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20

# Re-use node_modules between runs until package-lock.json changes.
# Re-use node_modules between runs until bun.lock changes.
- name: Cache node_modules
id: cache-node_modules
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ hashFiles('package-lock.json') }}
key: node_modules-${{ hashFiles('bun.lock') }}

# Re-use ~/.elm between runs until elm.json or review/elm.json changes.
# The Elm compiler saves downloaded Elm packages to ~/.elm saves
Expand All @@ -35,18 +36,18 @@ jobs:
key: elm-${{ hashFiles('elm.json', 'review/elm.json') }}

# Install npm packages, unless we restored them from cache.
# Since `npm ci` removes the node_modules folder before running it’s
# Since `bun ci` removes the node_modules folder before running it’s
# important to skip this step if cache was restored.
- name: npm ci
- name: bun ci
if: steps.cache-node_modules.outputs.cache-hit != 'true'
run: npm ci
run: bun ci

- name: Format
run: npm run format
run: bun run format
- name: Review
run: npm run review
run: bun run review
- name: Test
run: npm run test
run: bun run test

diff-generation:
permissions:
Expand All @@ -58,33 +59,34 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20
- uses: oven-sh/setup-bun@v2

- name: Checkout branch
uses: actions/checkout@v4
with:
path: branch

- name: Checkout main
uses: actions/checkout@v4
with:
ref: main
path: main

# Re-use node_modules between runs until package-lock.json changes.
# Re-use node_modules between runs until bun.lock changes.
- name: Cache node_modules (branch)
id: cache-node_modules-branch
uses: actions/cache@v4
with:
path: branch/node_modules
key: node_modules-${{ hashFiles('branch/package-lock.json') }}
key: node_modules-${{ hashFiles('branch/bun.lock') }}

# Re-use node_modules between runs until package-lock.json changes.
# Re-use node_modules between runs until bun.lock changes.
- name: Cache node_modules (main)
id: cache-node_modules-main
uses: actions/cache@v4
with:
path: main/node_modules
key: node_modules-${{ hashFiles('main/package-lock.json') }}
key: node_modules-${{ hashFiles('main/bun.lock') }}

# Re-use ~/.elm between runs until elm.json or review/elm.json changes.
# The Elm compiler saves downloaded Elm packages to ~/.elm saves
Expand All @@ -96,28 +98,28 @@ jobs:
key: elm-${{ hashFiles('main/elm.json', 'main/review/elm.json', 'branch/elm.json', 'branch/review/elm.json') }}

# Install npm packages, unless we restored them from cache.
# Since `npm ci` removes the node_modules folder before running it’s
# Since `bun ci` removes the node_modules folder before running it’s
# important to skip this step if cache was restored.
- name: npm ci (branch)
- name: bun ci (branch)
if: steps.cache-node_modules-branch.outputs.cache-hit != 'true'
working-directory: branch
run: npm ci
run: bun ci

# Install npm packages, unless we restored them from cache.
# Since `npm ci` removes the node_modules folder before running it’s
# Since `bun ci` removes the node_modules folder before running it’s
# important to skip this step if cache was restored.
- name: npm ci (main)
- name: bun ci (main)
if: steps.cache-node_modules-main.outputs.cache-hit != 'true'
working-directory: main
run: npm ci
run: bun ci

- name: Generate (branch)
working-directory: branch
run: npm run test:gen
run: bun run test:gen

- name: Generate (main)
working-directory: main
run: npm run test:gen || true # We don't want to block on main failing to generate
run: bun run test:gen || true # We don't want to block on main failing to generate

- name: Diff the outputs
run: |
Expand All @@ -131,4 +133,4 @@ jobs:
uses: JoseThen/comment-pr@v1.2.0
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
file_path: './diff.md'
file_path: "./diff.md"
Loading