Add !build-profiling command in PRs to request builds in profiling mode

This commit is contained in:
Keavon Chambers 2023-11-26 05:39:55 -08:00
parent 94fcd295c5
commit 4ea01345c2
2 changed files with 16 additions and 4 deletions

View file

@ -12,7 +12,7 @@ jobs:
# Command should be limited to core team members (those in the organization) for security.
# From the GitHub Actions docs:
# author_association = 'MEMBER': Author is a member of the organization that owns the repository.
if: github.event.issue.pull_request && github.event.comment.body == '!build' && github.event.comment.author_association == 'MEMBER'
if: github.event.issue.pull_request && (github.event.comment.body == '!build' || github.event.comment.body == '!build-profiling') && github.event.comment.author_association == 'MEMBER'
runs-on: self-hosted
permissions:
contents: read
@ -67,12 +67,23 @@ jobs:
export INDEX_HTML_HEAD_REPLACEMENT=""
sed -i "s|<!-- INDEX_HTML_HEAD_REPLACEMENT -->|$INDEX_HTML_HEAD_REPLACEMENT|" frontend/index.html
- name: ⌨ Set build command based on comment
id: build_command
run: |
if [[ "${{ github.event.comment.body }}" == "!build" ]]; then
echo "command=build" >> $GITHUB_OUTPUT
elif [[ "${{ github.event.comment.body }}" == "!build-profiling" ]]; then
echo "command=build-profiling" >> $GITHUB_OUTPUT
else
echo "command=print-building-help" >> $GITHUB_OUTPUT
fi
- name: 🌐 Build Graphite web code
env:
NODE_ENV: production
run: |
cd frontend
mold -run npm run build
mold -run npm run ${{ steps.build_command.outputs.command }}
- name: 📤 Publish to Cloudflare Pages
id: cloudflare

View file

@ -8,9 +8,11 @@
"scripts": {
"start": "npm run build-wasm && concurrently -k -n \"VITE,RUST\" \"vite\" \"npm run watch:wasm\" || (npm run print-building-help && exit 1)",
"profiling": "npm run build-wasm-profiling && concurrently -k -n \"VITE,RUST\" \"vite\" \"npm run watch:wasm-profiling\" || (npm run print-building-help && exit 1)",
"build": "npm run build-wasm-prod && vite build || (npm run print-building-help && exit 1)",
"build-profiling": "npm run build-wasm-profiling && vite build || (npm run print-building-help && exit 1)",
"lint": "eslint .",
"lint-fix": "eslint . --fix",
"build": "npm run build-wasm-prod && vite build || (npm run print-building-help && exit 1)",
"--------------------": "",
"build-wasm": "wasm-pack build ./wasm --dev --target=web",
"build-wasm-profiling": "wasm-pack build ./wasm --profiling --target=web",
"build-wasm-prod": "wasm-pack build ./wasm --release --target=web",
@ -18,7 +20,6 @@
"tauri:build-wasm": "wasm-pack build ./wasm --release --target=web -- --features tauri",
"watch:wasm": "cargo watch --postpone --watch-when-idle --workdir=wasm --shell \"wasm-pack build . --dev --target=web -- --color=always\"",
"watch:wasm-profiling": "cargo watch --postpone --watch-when-idle --workdir=wasm --shell \"wasm-pack build . --profiling --target=web -- --color=always\"",
"--------------------": "",
"print-building-help": "echo 'Graphite project failed to build. Did you remember to `npm install` the dependencies in `/frontend`?'",
"print-linting-help": "echo 'Graphite project had lint errors, or may have otherwise failed. In the latter case, did you remember to `npm install` the dependencies in `/frontend`?'"
},