|
| 1 | +name: build |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + checkout_ref: |
| 7 | + description: Git ref or SHA to build |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + outputs: |
| 11 | + version: |
| 12 | + description: Version derived from the built Linux artifact |
| 13 | + value: ${{ jobs.metadata.outputs.version }} |
| 14 | + |
| 15 | +permissions: |
| 16 | + contents: read |
| 17 | + |
| 18 | +jobs: |
| 19 | + build: |
| 20 | + if: github.repository == 'verus-lang/verus' |
| 21 | + |
| 22 | + strategy: |
| 23 | + matrix: |
| 24 | + build: [macos, macos-x86_64, linux, windows] |
| 25 | + include: |
| 26 | + - build: macos |
| 27 | + os: macos-14 |
| 28 | + release_name: verus-arm64-macos |
| 29 | + - build: macos-x86_64 |
| 30 | + os: macos-15-intel |
| 31 | + release_name: verus-x86-macos |
| 32 | + - build: linux |
| 33 | + os: ubuntu-24.04 |
| 34 | + release_name: verus-x86-linux |
| 35 | + - build: windows |
| 36 | + os: windows-2022 |
| 37 | + release_name: verus-x86-win |
| 38 | + |
| 39 | + runs-on: ${{ matrix.os }} |
| 40 | + |
| 41 | + defaults: |
| 42 | + run: |
| 43 | + shell: bash |
| 44 | + |
| 45 | + steps: |
| 46 | + - name: checkout |
| 47 | + uses: actions/checkout@v6 |
| 48 | + with: |
| 49 | + ref: ${{ inputs.checkout_ref }} |
| 50 | + |
| 51 | + - name: get z3 |
| 52 | + working-directory: ./source |
| 53 | + run: | |
| 54 | + ./tools/get-z3.sh |
| 55 | + echo "z3 version $(./z3 --version)" |
| 56 | +
|
| 57 | + - name: setup rust |
| 58 | + uses: dtolnay/rust-toolchain@master |
| 59 | + with: |
| 60 | + toolchain: 1.96.0 |
| 61 | + |
| 62 | + - name: build |
| 63 | + working-directory: ./source |
| 64 | + run: | |
| 65 | + . ../tools/activate |
| 66 | + vargo clean |
| 67 | + vargo build --release |
| 68 | +
|
| 69 | + - name: create archive |
| 70 | + working-directory: ./source |
| 71 | + run: | |
| 72 | + ./target-verus/release/verus --version --output-json > ./target-verus/release/version.json |
| 73 | + cp -R ./target-verus/release "../${{ matrix.release_name }}" |
| 74 | + cd .. |
| 75 | + if [ "${{ matrix.os }}" == "windows-2022" ]; then |
| 76 | + 7z a "${{ matrix.release_name }}.zip" "./${{ matrix.release_name }}" |
| 77 | + else |
| 78 | + zip -r "${{ matrix.release_name }}.zip" "./${{ matrix.release_name }}" |
| 79 | + fi |
| 80 | +
|
| 81 | + - name: upload release artifact |
| 82 | + uses: actions/upload-artifact@v7 |
| 83 | + with: |
| 84 | + name: ${{ matrix.release_name }} |
| 85 | + path: ${{ matrix.release_name }}.zip |
| 86 | + |
| 87 | + metadata: |
| 88 | + needs: [build] |
| 89 | + runs-on: ubuntu-24.04 |
| 90 | + outputs: |
| 91 | + version: ${{ steps.read_version.outputs.version }} |
| 92 | + steps: |
| 93 | + - name: download linux artifact |
| 94 | + uses: actions/download-artifact@v8 |
| 95 | + with: |
| 96 | + name: verus-x86-linux |
| 97 | + path: verus-x86-linux |
| 98 | + |
| 99 | + - name: read version |
| 100 | + id: read_version |
| 101 | + shell: bash |
| 102 | + run: | |
| 103 | + cd verus-x86-linux |
| 104 | + unzip verus-x86-linux.zip |
| 105 | + version="$(cat ./verus-x86-linux/version.txt)" |
| 106 | + echo "version=$version" >> "$GITHUB_OUTPUT" |
| 107 | + echo "${version}" |
0 commit comments