|
35 | 35 | exit 1 |
36 | 36 | fi |
37 | 37 |
|
38 | | - run-example: |
| 38 | + # Build `hm` once and share the binary across every matrix leg. |
| 39 | + # Each leg only needs Python + Docker + the binary; making them |
| 40 | + # re-compile the whole workspace 17× was the long tent-pole. |
| 41 | + build-hm: |
39 | 42 | needs: validate-matrix |
| 43 | + runs-on: ubuntu-latest |
| 44 | + timeout-minutes: 20 |
| 45 | + steps: |
| 46 | + - uses: actions/checkout@v4 |
| 47 | + |
| 48 | + - uses: dtolnay/rust-toolchain@stable |
| 49 | + |
| 50 | + - uses: Swatinem/rust-cache@v2 |
| 51 | + with: |
| 52 | + shared-key: examples-hm |
| 53 | + |
| 54 | + - name: Build hm |
| 55 | + run: cargo build --release -p harmont-cli |
| 56 | + |
| 57 | + - uses: actions/upload-artifact@v4 |
| 58 | + with: |
| 59 | + name: hm-bin |
| 60 | + path: target/release/hm |
| 61 | + retention-days: 1 |
| 62 | + if-no-files-found: error |
| 63 | + |
| 64 | + run-example: |
| 65 | + needs: build-hm |
40 | 66 | name: ${{ matrix.example }} |
41 | 67 | runs-on: ubuntu-latest |
42 | 68 | timeout-minutes: 20 |
|
64 | 90 | steps: |
65 | 91 | - uses: actions/checkout@v4 |
66 | 92 |
|
67 | | - - name: Install system build deps |
68 | | - # libdbus-1-dev is required by the `keyring` crate's |
69 | | - # sync-secret-service feature; the GH-hosted Ubuntu runner |
70 | | - # doesn't ship the headers by default. |
71 | | - run: | |
72 | | - sudo apt-get update |
73 | | - sudo apt-get install -y --no-install-recommends libdbus-1-dev pkg-config |
74 | | -
|
75 | | - - uses: dtolnay/rust-toolchain@stable |
76 | | - |
77 | | - - uses: Swatinem/rust-cache@v2 |
78 | | - with: |
79 | | - # All matrix legs share the same hm binary; one cache key for the |
80 | | - # whole workflow is sufficient. |
81 | | - shared-key: examples-hm |
82 | | - |
83 | 93 | - uses: actions/setup-python@v5 |
84 | 94 | with: |
85 | 95 | python-version: '3.11' |
|
89 | 99 | git clone --depth 1 https://github.com/harmont-dev/harmont-py /tmp/harmont-py |
90 | 100 | pip install /tmp/harmont-py |
91 | 101 |
|
92 | | - - name: Build hm |
93 | | - run: cargo build --release -p harmont-cli |
| 102 | + - name: Download hm binary |
| 103 | + uses: actions/download-artifact@v4 |
| 104 | + with: |
| 105 | + name: hm-bin |
| 106 | + path: bin |
| 107 | + |
| 108 | + - name: Mark hm executable |
| 109 | + run: chmod +x bin/hm |
94 | 110 |
|
95 | 111 | - name: Run example via hm run |
96 | 112 | working-directory: examples/${{ matrix.example }} |
|
99 | 115 | # pipeline; the system Python on the runner is what setup-python |
100 | 116 | # just installed. |
101 | 117 | HM_NONINTERACTIVE: '1' |
102 | | - run: ../../target/release/hm run ci |
| 118 | + run: ${{ github.workspace }}/bin/hm run ci |
0 commit comments