-
Notifications
You must be signed in to change notification settings - Fork 1
CI: consolidate workflows, fix Pages deployment, add caching #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8ee24bd
e04436b
c943576
7660736
46e9064
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -5,9 +5,19 @@ on: | |||||
| branches: ["main"] | ||||||
| pull_request: | ||||||
| branches: ["main"] | ||||||
| workflow_dispatch: | ||||||
|
|
||||||
| permissions: | ||||||
| contents: read | ||||||
| pages: write | ||||||
| id-token: write | ||||||
|
|
||||||
| concurrency: | ||||||
| group: "pages" | ||||||
| cancel-in-progress: false | ||||||
|
Comment on lines
+15
to
+17
|
||||||
|
|
||||||
| jobs: | ||||||
| check: | ||||||
| build-test-webapi: | ||||||
| runs-on: ubuntu-latest | ||||||
| steps: | ||||||
| - name: Checkout | ||||||
|
|
@@ -22,11 +32,24 @@ jobs: | |||||
| uses: actions/setup-node@v4 | ||||||
| with: | ||||||
| node-version: 22 | ||||||
| cache: 'npm' | ||||||
| cache-dependency-path: | | ||||||
| webapi_gen/package-lock.json | ||||||
| tests/package-lock.json | ||||||
|
|
||||||
| - name: Install npm dependencies | ||||||
| working-directory: webapi_gen | ||||||
| run: npm ci | ||||||
|
|
||||||
| - name: Cache MoonBit packages | ||||||
| uses: actions/cache@v4 | ||||||
| with: | ||||||
| path: | | ||||||
| .mooncakes | ||||||
| webapi_gen/.mooncakes | ||||||
| examples/.mooncakes | ||||||
| key: mooncakes-${{ runner.os }}-${{ hashFiles('moon.mod.json', 'webapi_gen/moon.mod.json', 'examples/moon.mod.json') }} | ||||||
|
|
||||||
| - name: Install MoonBit dependencies | ||||||
| run: | | ||||||
| moon version --all | ||||||
|
|
@@ -42,27 +65,6 @@ jobs: | |||||
| working-directory: webapi_gen | ||||||
| run: moon test | ||||||
|
|
||||||
| examples: | ||||||
| runs-on: ubuntu-latest | ||||||
| steps: | ||||||
| - name: Checkout | ||||||
| uses: actions/checkout@v4 | ||||||
|
|
||||||
| - name: Set up MoonBit | ||||||
| run: | | ||||||
| curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash | ||||||
| echo "$HOME/.moon/bin" >> $GITHUB_PATH | ||||||
|
|
||||||
| - name: Set up Node.js | ||||||
| uses: actions/setup-node@v4 | ||||||
| with: | ||||||
| node-version: 22 | ||||||
|
|
||||||
| - name: Install MoonBit dependencies | ||||||
| run: | | ||||||
| moon version --all | ||||||
| moon update | ||||||
|
|
||||||
| - name: Build examples (JS) | ||||||
| working-directory: examples | ||||||
| run: moon build --target js --release | ||||||
|
|
@@ -71,12 +73,50 @@ jobs: | |||||
| working-directory: examples | ||||||
| run: moon build --target wasm-gc --release | ||||||
|
|
||||||
| - name: Cache Playwright browsers | ||||||
| id: cache-playwright | ||||||
| uses: actions/cache@v4 | ||||||
| with: | ||||||
| path: ~/.cache/ms-playwright | ||||||
| key: playwright-${{ runner.os }}-${{ hashFiles('tests/package-lock.json') }} | ||||||
|
|
||||||
| - name: Install Playwright dependencies | ||||||
| working-directory: tests | ||||||
| run: | | ||||||
| npm ci | ||||||
| npx playwright install chromium | ||||||
| npx playwright install chromium --with-deps | ||||||
|
|
||||||
| - name: Run Playwright tests | ||||||
| working-directory: tests | ||||||
| run: npx playwright test --workers 2 | ||||||
|
|
||||||
| - name: Prepare site | ||||||
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||||||
| run: | | ||||||
| mkdir -p _site/src | ||||||
| cp -rL examples _site/examples | ||||||
|
||||||
| cp -rL examples _site/examples | |
| cp -r examples _site/examples |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Workflow-level
permissionsgrantpages: writeandid-token: writeon all events includingpull_request. Even though the deploy job is gated, this still broadens the GITHUB_TOKEN for PR jobs; prefer setting minimal default permissions (e.g.,contents: read) and grantingpages/id-tokenonly on the deploy/upload steps or jobs that need it.