add minimal initial impl #41
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: check | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| packages: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| environment: | |
| name: resolve reference environment | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| image: ${{ steps.lock.outputs.image }} | |
| steps: | |
| - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 | |
| - name: Read the unique environment lock | |
| id: lock | |
| run: | | |
| image="$(node -e ' | |
| const { readEnvironmentLock } = require("./tools/why3_reference/reference_environment.cjs"); | |
| const lock = readEnvironmentLock(); | |
| process.stdout.write(`${lock.image.repository}@${lock.image.digest}`); | |
| ')" | |
| echo "image=$image" >> "$GITHUB_OUTPUT" | |
| project: | |
| name: project | |
| needs: | |
| - environment | |
| runs-on: ubuntu-24.04 | |
| container: | |
| image: ${{ needs.environment.outputs.image }} | |
| credentials: | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| env: | |
| WHY3_REFERENCE_CACHE_DIR: ${{ github.workspace }}/.cache/why3-reference | |
| WHY3_REFERENCE_CONTEXT_DIR: ${{ github.workspace }}/_build/reference-context | |
| steps: | |
| - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 | |
| - name: Trust checkout workspace | |
| run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
| - name: Restore patched Why3 runtime | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 | |
| with: | |
| path: ${{ env.WHY3_REFERENCE_CACHE_DIR }} | |
| key: reference-runtime-${{ runner.os }}-${{ hashFiles('tools/contracts/reference-environment-lock-v1.json', 'tools/why3_reference/reference_runtime.mjs', 'tools/why3_reference/patches/driver-trace.patch') }} | |
| - name: Set up MoonBit stable | |
| uses: moonbit-community/setup-moonbit@04293a8a813bfd4b6c2fce22701b52ae1050d100 | |
| with: | |
| version: stable | |
| - name: Bootstrap and check the project | |
| run: | | |
| node tools/run.mjs bootstrap | |
| node tools/run.mjs project | |
| - name: Check the fixed reference | |
| run: | | |
| node tools/run.mjs reference \ | |
| --why3-archive "$WHY3_REFERENCE_ARCHIVE" | |
| - name: Upload resolved environment provenance | |
| if: always() | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a | |
| with: | |
| name: reference-context-${{ github.sha }} | |
| path: ${{ env.WHY3_REFERENCE_CONTEXT_DIR }} | |
| if-no-files-found: warn |