|
27 | 27 | type: boolean |
28 | 28 | default: true |
29 | 29 |
|
| 30 | +# DEBUGGING NEW WORKFLOW, RESTORE THIS FILE AFTER IT IS FINISHED |
| 31 | + |
| 32 | +concurrency: |
| 33 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 34 | + cancel-in-progress: true |
| 35 | + |
| 36 | +env: |
| 37 | + smir: "" |
| 38 | + kmir: "p-token-f8c403f" |
| 39 | + proofs: "['test_ptoken_domain_data', 'this_will_fail']" |
| 40 | + |
30 | 41 | jobs: |
31 | | - test_js: |
32 | | - name: Test JS client |
| 42 | + compile: |
| 43 | + name: "Compile P-Token to SMIR JSON" |
33 | 44 | runs-on: ubuntu-latest |
34 | 45 | steps: |
35 | | - - name: Git Checkout |
| 46 | + - name: "Git Checkout" |
36 | 47 | uses: actions/checkout@v4 |
37 | 48 |
|
38 | | - - name: Setup Environment |
39 | | - uses: ./.github/actions/setup |
| 49 | + - name: "Provide nightly Rust" # https://github.com/rust-lang/rustup/issues/3409 |
| 50 | + uses: dtolnay/rust-toolchain@master |
40 | 51 | with: |
41 | | - cargo-cache-key: cargo-programs |
42 | | - solana: true |
43 | | - |
44 | | - - name: Format JS Client |
45 | | - run: pnpm clients:js:format |
| 52 | + toolchain: nightly-2024-11-29 # Hardcoded version for stable-mir-json. TODO can we use nix? |
46 | 53 |
|
47 | | - - name: Lint JS Client |
48 | | - run: pnpm clients:js:lint |
| 54 | + - name: "Provide Nix" |
| 55 | + uses: cachix/install-nix-action@v18 |
49 | 56 |
|
50 | | - - name: Build Programs |
51 | | - run: pnpm programs:build |
52 | | - |
53 | | - - name: Test JS Client |
54 | | - run: pnpm clients:js:test |
| 57 | + - name: "Build with stable_mir_json" |
| 58 | + uses: cachix/nix-shell-action@v3 |
| 59 | + with: |
| 60 | + flakes: github:runtimeverification/stable-mir-json/${{ env.smir }} |
| 61 | + script: | |
| 62 | + cd p-token |
| 63 | + RUSTC=stable_mir_json cargo build --features runtime-verification |
| 64 | + - name: "Store SMIR JSON files" |
| 65 | + uses: actions/upload-artifact@v4 |
| 66 | + with: |
| 67 | + name: p-token.smir |
| 68 | + path: ./target/debug/deps/*.smir.json |
| 69 | + if-no-files-found: error |
| 70 | + retention-days: 1 # only important during workflow run |
55 | 71 |
|
56 | | - publish_js: |
57 | | - name: Publish JS client |
| 72 | + prepare_matrix: |
| 73 | + name: "Prepare proof matrix" |
58 | 74 | runs-on: ubuntu-latest |
59 | | - needs: test_js |
60 | | - permissions: |
61 | | - contents: write |
| 75 | + outputs: |
| 76 | + proofs: ${{ steps.split.outputs.matrix }} |
62 | 77 | steps: |
63 | | - - name: Git Checkout |
64 | | - uses: actions/checkout@v4 |
65 | | - with: |
66 | | - token: ${{ secrets.ANZA_TEAM_PAT }} |
67 | | - |
68 | | - - name: Setup Environment |
69 | | - uses: ./.github/actions/setup |
| 78 | + - name: "Create Proof Array" |
| 79 | + run: | |
| 80 | + echo "proofs = '${{ env.proofs }}'" |
| 81 | + echo "matrix=${{ env.proofs }}" >> $GITHUB_OUTPUT |
70 | 82 |
|
71 | | - - name: Ensure NPM_TOKEN variable is set |
72 | | - env: |
73 | | - token: ${{ secrets.NPM_TOKEN }} |
74 | | - if: ${{ env.token == '' }} |
| 83 | + run_proof: |
| 84 | + name: "Link SMIR and Run Proofs" |
| 85 | + needs: |
| 86 | + - compile |
| 87 | + - prepare_matrix |
| 88 | + runs-on: ubuntu-latest |
| 89 | + # container: |
| 90 | + # image: runtimeverificationinc/kmir:${{ inputs.kmir }} |
| 91 | + strategy: |
| 92 | + matrix: |
| 93 | + proof: ${{ fromJSON(needs.prepare_matrix.outputs.proofs) }} |
| 94 | + env: |
| 95 | + RUNNER_NAME: "kmir-${{ github.sha }}" |
| 96 | + steps: |
| 97 | + - name: debug matrix and docker image |
75 | 98 | run: | |
76 | | - echo "The NPM_TOKEN secret variable is not set" |
77 | | - echo "Go to \"Settings\" -> \"Secrets and variables\" -> \"Actions\" -> \"New repository secret\"." |
78 | | - exit 1 |
| 99 | + echo "This is proof ${{ matrix.proof }}" |
| 100 | + echo "Running with docker image runtimeverificationinc/kmir:${{ env.kmir }}" |
| 101 | + - name: Fail |
| 102 | + run: exit 1 |
| 103 | + # - name: "Checkout" |
| 104 | + # uses: actions/checkout@v4 |
79 | 105 |
|
80 | | - - name: NPM Authentication |
81 | | - run: pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}" |
82 | | - env: |
83 | | - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 106 | + # - name: "Set up Docker host" |
| 107 | + # run: | |
| 108 | + # docker run --rm --detach \ |
| 109 | + # --user github-user \ |
| 110 | + # -v $PWD:/workdir --workdir /workdir \ |
| 111 | + # --name "${RUNNER_NAME}" \ |
| 112 | + # runtimeverificationinc/kmir:${{ inputs.kmir }} |
| 113 | + # sleep 10 |
84 | 114 |
|
85 | | - - name: Set Git Author |
86 | | - run: | |
87 | | - git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" |
88 | | - git config --global user.name "github-actions[bot]" |
| 115 | + # - name: "Get SMIR Files" |
| 116 | + # uses: actions/download-artifact@v5 |
| 117 | + # with: |
| 118 | + # name: p-token.smir |
| 119 | + # path: p-token/test-properties/artefacts/ |
89 | 120 |
|
90 | | - - name: Publish JS Client |
91 | | - id: publish |
92 | | - run: pnpm clients:js:publish ${{ inputs.level }} ${{ inputs.tag }} |
| 121 | + # - name: "Link SMIR Files" |
| 122 | + # run: | |
| 123 | + # docker exec --user github-user --workdir /workdir/p-token/test-properties/artefacts/ "${RUNNER_NAME}" \ |
| 124 | + # bash -c 'kmir link -o p-token.smir.json *.smir.json' |
93 | 125 |
|
94 | | - - name: Push Commit and Tag |
95 | | - run: git push origin --follow-tags |
| 126 | + # - name: "Run Proof ${{ matrix.proof }} with default proof settings" |
| 127 | + # run: | |
| 128 | + # docker exec --user github-user --workdir /workdir/p-token/test-properties/ "${RUNNER_NAME}" \ |
| 129 | + # ./run-proofs.sh ${{ matrix.proof }}' |
96 | 130 |
|
97 | | - - name: Create GitHub release |
98 | | - if: github.event.inputs.create_release == 'true' |
99 | | - uses: ncipollo/release-action@v1 |
100 | | - with: |
101 | | - tag: js@v${{ steps.publish.outputs.new_version }} |
| 131 | + # - name: "Shut down docker image" |
| 132 | + # if: always |
| 133 | + # run: | |
| 134 | + # docker stop ${RUNNER_NAME} |
| 135 | + # sleep 5 |
| 136 | + # docker rm -f ${RUNNER_NAME} |
0 commit comments