|
| 1 | +name: Cargo Hack Check |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + |
| 6 | +env: |
| 7 | + RUST_BACKTRACE: full |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: cargo-hack-check-${{ github.head_ref || github.ref || github.run_id }} |
| 11 | + cancel-in-progress: ${{ github.event_name == 'pull_request' }} |
| 12 | + |
| 13 | +jobs: |
| 14 | + # Setup job to prepare common dependencies |
| 15 | + setup: |
| 16 | + name: Setup |
| 17 | + runs-on: ubuntu-latest |
| 18 | + outputs: |
| 19 | + rust-toolchain: ${{ steps.toolchain.outputs.rust-toolchain }} |
| 20 | + steps: |
| 21 | + - name: Checkout |
| 22 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 23 | + with: |
| 24 | + persist-credentials: false |
| 25 | + |
| 26 | + - name: Get Rust toolchain |
| 27 | + id: toolchain |
| 28 | + run: echo "rust-toolchain=$(cat ./rust-toolchain)" >> $GITHUB_OUTPUT |
| 29 | + |
| 30 | + # Native targets (Windows/Linux) |
| 31 | + native-targets: |
| 32 | + name: All Crates (Windows/Linux) |
| 33 | + runs-on: ubuntu-latest |
| 34 | + needs: setup |
| 35 | + steps: |
| 36 | + - name: Checkout |
| 37 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 38 | + with: |
| 39 | + persist-credentials: false |
| 40 | + |
| 41 | + - name: Setup Rust with Cache |
| 42 | + uses: actions-rust-lang/setup-rust-toolchain@11df97af8e8102fd60b60a77dfbf58d40cd843b8 # v1.10.1 |
| 43 | + with: |
| 44 | + toolchain: ${{ needs.setup.outputs.rust-toolchain }} |
| 45 | + target: x86_64-pc-windows-gnu,x86_64-unknown-linux-gnu |
| 46 | + cache: true |
| 47 | + cache-key: cargo-hack-native-${{ needs.setup.outputs.rust-toolchain }}-${{ hashFiles('**/Cargo.lock') }} |
| 48 | + |
| 49 | + - name: Install cargo-hack |
| 50 | + uses: taiki-e/install-action@2383334cf567d78771fc7d89b6b3802ef1412cf6 # v2.56.8 |
| 51 | + with: |
| 52 | + tool: cargo-hack |
| 53 | + |
| 54 | + - name: Install Windows cross-compilation tools |
| 55 | + run: | |
| 56 | + sudo apt-get update |
| 57 | + sudo apt-get install -y gcc-mingw-w64-x86-64 |
| 58 | +
|
| 59 | + - name: Run cargo hack check |
| 60 | + run: | |
| 61 | + cargo hack check \ |
| 62 | + --all \ |
| 63 | + --each-feature \ |
| 64 | + --no-dev-deps \ |
| 65 | + --exclude-features=wasm-deterministic,wasm-web \ |
| 66 | + --target x86_64-pc-windows-gnu \ |
| 67 | + --target x86_64-unknown-linux-gnu |
| 68 | +
|
| 69 | + # WASM targets - separate cache since dependencies differ |
| 70 | + wasm-targets: |
| 71 | + name: ${{ matrix.name }} |
| 72 | + runs-on: ubuntu-latest |
| 73 | + needs: setup |
| 74 | + strategy: |
| 75 | + fail-fast: false |
| 76 | + matrix: |
| 77 | + include: |
| 78 | + - name: "Clarity & Stacks-Common WASM Web" |
| 79 | + command: | |
| 80 | + cargo hack check \ |
| 81 | + -p clarity-serialization \ |
| 82 | + -p stacks-common \ |
| 83 | + --each-feature \ |
| 84 | + --no-dev-deps \ |
| 85 | + --exclude-features=default,rusqlite,ctrlc-handler,wasm-deterministic \ |
| 86 | + --features=wasm-web |
| 87 | +
|
| 88 | + - name: "Clarity & Stacks-Common WASM Deterministic" |
| 89 | + command: | |
| 90 | + cargo hack check \ |
| 91 | + -p clarity-serialization \ |
| 92 | + -p stacks-common \ |
| 93 | + --each-feature \ |
| 94 | + --no-dev-deps \ |
| 95 | + --include-features=wasm-deterministic,slog_json \ |
| 96 | + --features=wasm-deterministic |
| 97 | +
|
| 98 | + steps: |
| 99 | + - name: Checkout |
| 100 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 101 | + with: |
| 102 | + persist-credentials: false |
| 103 | + |
| 104 | + - name: Setup Rust with Cache |
| 105 | + uses: actions-rust-lang/setup-rust-toolchain@11df97af8e8102fd60b60a77dfbf58d40cd843b8 # v1.10.1 |
| 106 | + with: |
| 107 | + toolchain: ${{ needs.setup.outputs.rust-toolchain }} |
| 108 | + target: wasm32-unknown-unknown |
| 109 | + cache: true |
| 110 | + cache-key: cargo-hack-wasm-${{ matrix.name }}-${{ needs.setup.outputs.rust-toolchain }}-${{ hashFiles('**/Cargo.lock') }} |
| 111 | + |
| 112 | + - name: Install cargo-hack |
| 113 | + uses: taiki-e/install-action@2383334cf567d78771fc7d89b6b3802ef1412cf6 # v2.56.8 |
| 114 | + with: |
| 115 | + tool: cargo-hack |
| 116 | + |
| 117 | + - name: Run cargo hack check |
| 118 | + run: ${{ matrix.command }} |
0 commit comments