Fix memory-safety defects in ELF and virtio-blk #348
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: WebAssembly | |
| on: | |
| pull_request_target: | |
| branches: | |
| - master | |
| types: | |
| - closed | |
| workflow_dispatch: | |
| repository_dispatch: # listening to rv32emu-prebuilt events | |
| types: [deploy_user_wasm, deploy_system_wasm] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: false # Don't cancel deployments | |
| permissions: | |
| contents: read | |
| jobs: | |
| # Resolve both file sets once, so each deploy job carries a single condition | |
| # instead of repeating it on every step. | |
| # Only the merge path needs a file diff. On workflow_dispatch and | |
| # repository_dispatch there is no base commit to diff against, and | |
| # changed-files errors out; those events deploy unconditionally anyway. | |
| detect-file-changes: | |
| if: github.event_name == 'pull_request_target' | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| system: ${{ steps.system.outputs.any_modified }} | |
| user: ${{ steps.user.outputs.any_modified }} | |
| steps: | |
| - name: Check out the repo | |
| uses: actions/checkout@v7 | |
| - name: Verify if the system emulation files have been modified | |
| id: system | |
| uses: tj-actions/changed-files@v47 | |
| with: | |
| files: | | |
| assets/wasm/html/system.html | |
| assets/wasm/js/system-pre.js | |
| src/em_runtime.c | |
| # Build system configuration | |
| mk/kconfig.mk | |
| mk/wasm.mk | |
| configs/wasm_defconfig | |
| tools/detect-env.py | |
| # Helper scripts the deploy job runs | |
| .ci/wasm-build.sh | |
| .ci/fetch-artifacts.sh | |
| .ci/emsdk-warm-cache.sh | |
| # rootfs overlay tooling (S99automount auto-mounts /dev/vda) | |
| tools/cpio-inject.py | |
| tools/rootfs-automount.sh | |
| # Files below may have a potential performance impact (reference from benchmark.yml) | |
| src/devices/*.c | |
| src/system.c | |
| src/riscv.c | |
| src/decode.c | |
| src/emulate.c | |
| src/rv32_template.c | |
| src/rv32_constopt.c | |
| - name: Verify if the user emulation files have been modified | |
| id: user | |
| uses: tj-actions/changed-files@v47 | |
| with: | |
| files: | | |
| assets/wasm/html/user.html | |
| # Landing page is committed at the repo root by the user job | |
| assets/wasm/html/demo-index.html | |
| assets/wasm/js/user-pre.js | |
| build/*.elf | |
| tools/gen-elf-list-js.py | |
| src/em_runtime.c | |
| # Build system configuration | |
| mk/kconfig.mk | |
| mk/wasm.mk | |
| configs/wasm_defconfig | |
| tools/detect-env.py | |
| # Helper scripts the deploy job runs | |
| .ci/wasm-build.sh | |
| .ci/fetch-artifacts.sh | |
| .ci/emsdk-warm-cache.sh | |
| # Files below may have a potential performance impact (reference from benchmark.yml) | |
| src/riscv.c | |
| src/decode.c | |
| src/emulate.c | |
| src/rv32_template.c | |
| src/rv32_constopt.c | |
| wasm-system-deploy: | |
| needs: [detect-file-changes] | |
| # !cancelled() keeps this reachable when detect-file-changes is skipped (a | |
| # dispatch event) or fails. Without a status function the default rule | |
| # skips every dependent job, which would silently cancel a deploy that was | |
| # asked for explicitly. | |
| if: > | |
| !cancelled() && ( | |
| (github.event.pull_request.merged == true && needs.detect-file-changes.outputs.system == 'true') || | |
| github.event_name == 'workflow_dispatch' || | |
| (github.event_name == 'repository_dispatch' && github.event.action == 'deploy_system_wasm') | |
| ) | |
| timeout-minutes: 60 | |
| runs-on: ubuntu-24.04 | |
| # GH_TOKEN authenticates the parse-time fetch-releases-tag call in | |
| # mk/artifact.mk so the GitHub API request escapes the 60 req/hr | |
| # anonymous (IP-shared) limit and stops flaking when several merges land | |
| # back-to-back. | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - name: Check out the repo | |
| uses: actions/checkout@v7 | |
| with: | |
| submodules: 'true' | |
| - name: Install dependencies | |
| run: .ci/apt-install.sh curl device-tree-compiler | |
| # Pinned to the emsdk tag: newer Emscripten releases tightened the | |
| # port-cache lock and broke "make -j" builds here. | |
| - name: Set up emsdk | |
| uses: mymindstorm/setup-emsdk@v16 | |
| with: | |
| version: 3.1.51 | |
| actions-cache-folder: 'emsdk-cache' | |
| - name: Fetch artifact | |
| run: .ci/fetch-artifacts.sh linux-image | |
| - name: Warm emscripten port cache | |
| run: .ci/emsdk-warm-cache.sh | |
| - name: Build system emulation demo | |
| run: .ci/wasm-build.sh system | |
| - name: Check out the rv32emu-demo repo | |
| uses: actions/checkout@v7 | |
| with: | |
| persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token. | |
| repository: sysprog21/rv32emu-demo | |
| - name: Create local changes | |
| run: | | |
| mkdir -p system | |
| mv /tmp/rv32emu-system-demo/* ./system/ | |
| - name: Commit files | |
| id: commit | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add system/ | |
| if git diff --cached --quiet; then | |
| echo "committed=false" >> $GITHUB_OUTPUT | |
| else | |
| git commit -m "Add changes to system emulation" | |
| echo "committed=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Push changes | |
| if: steps.commit.outputs.committed == 'true' | |
| uses: ad-m/github-push-action@v1.3.0 | |
| with: | |
| repository: sysprog21/rv32emu-demo | |
| github_token: ${{ secrets.RV32EMU_DEMO_TOKEN }} | |
| branch: main | |
| wasm-user-deploy: | |
| # Sequential with the system job: both push to the same demo repository. | |
| # "skipped" is not a failure here, a merge may touch only one of the two. | |
| needs: [detect-file-changes, wasm-system-deploy] | |
| if: > | |
| !cancelled() && needs.wasm-system-deploy.result != 'failure' && ( | |
| (github.event.pull_request.merged == true && needs.detect-file-changes.outputs.user == 'true') || | |
| github.event_name == 'workflow_dispatch' || | |
| (github.event_name == 'repository_dispatch' && github.event.action == 'deploy_user_wasm') | |
| ) | |
| timeout-minutes: 60 | |
| runs-on: ubuntu-24.04 | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - name: Check out the repo | |
| uses: actions/checkout@v7 | |
| with: | |
| submodules: 'true' | |
| - name: Install dependencies | |
| run: .ci/apt-install.sh curl device-tree-compiler | |
| - name: Set up emsdk | |
| uses: mymindstorm/setup-emsdk@v16 | |
| with: | |
| version: 3.1.51 | |
| actions-cache-folder: 'emsdk-cache' | |
| - name: Fetch artifact | |
| run: .ci/fetch-artifacts.sh elf doom | |
| - name: Warm emscripten port cache | |
| run: .ci/emsdk-warm-cache.sh | |
| - name: Build user emulation demo | |
| run: .ci/wasm-build.sh user | |
| - name: Check out the rv32emu-demo repo | |
| uses: actions/checkout@v7 | |
| with: | |
| persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token. | |
| repository: sysprog21/rv32emu-demo | |
| - name: Create local changes | |
| run: | | |
| # Migration: earlier deploys placed user-mode assets at the repo | |
| # root. Drop the stale copies so the layout stays consistent | |
| # (landing page at /, user mode at /user/, system at /system/). | |
| rm -f navigation.html coi-serviceworker.min.js xterm.min.js \ | |
| xterm.min.css elf_list.js rv32emu.js rv32emu.wasm \ | |
| rv32emu.worker.js | |
| mkdir -p user | |
| mv /tmp/rv32emu-demo/landing.html ./index.html | |
| mv /tmp/rv32emu-demo/* ./user/ | |
| - name: Commit files | |
| id: commit | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add --all | |
| if git diff --cached --quiet; then | |
| echo "committed=false" >> $GITHUB_OUTPUT | |
| else | |
| git commit -m "Add changes to user emulation" | |
| echo "committed=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Push changes | |
| if: steps.commit.outputs.committed == 'true' | |
| uses: ad-m/github-push-action@v1.3.0 | |
| with: | |
| repository: sysprog21/rv32emu-demo | |
| github_token: ${{ secrets.RV32EMU_DEMO_TOKEN }} | |
| branch: main |