8989 id : push
9090 with :
9191 file : images/Containerfile.edera-check
92- platforms : linux/amd64
92+ platforms : " linux/amd64,linux/arm64 "
9393 tags : ' ${{ steps.meta.outputs.tags }}'
94+ cache-from : type=gha
95+ cache-to : type=gha,mode=max
9496 push : true
9597
9698 - name : ' Install cosign'
@@ -110,8 +112,65 @@ jobs:
110112 TAGS : ' ${{ steps.meta.outputs.tags }}'
111113 DIGEST : ' ${{ steps.push.outputs.digest }}'
112114
115+ # Release builds are built with `musl` targets.
116+ # Since we don't use a `musl` runner and distro-level "musl"-y shims
117+ # tend to be very incomplete, we build inside our own published `cross-rs`
118+ # `musl` OCI image contexts as defined by `Cross.toml` in the repo root.
119+ build-cross :
120+ name : Build cross-rs binaries
121+ strategy :
122+ matrix :
123+ platform :
124+ - { on: ubuntu-latest }
125+ - { on: ubuntu-24.04-arm }
126+ runs-on : ' ${{ matrix.platform.on }}'
127+ outputs :
128+ cross-revision : ${{ steps.cross-version.outputs.revision }}
129+ steps :
130+ - name : harden runner
131+ uses : step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
132+ with :
133+ egress-policy : audit
134+ - name : ' Checkout repository'
135+ uses : actions/checkout@6b42224f41ee5dfe5395e27c8b2746f1f9955030 # v4.2.0
136+ with :
137+ submodules : recursive
138+ persist-credentials : false
139+ - name : Get cross-rs revision
140+ id : cross-version
141+ run : |
142+ set -euo pipefail
143+ CROSS_RS_REV=$(grep "CROSS_RS_REV=" ./hack/build/install-cross-rs.sh | cut -d'"' -f2)
144+ if [ -z "${CROSS_RS_REV}" ]; then
145+ echo "Error: Failed to extract CROSS_RS_REV from install-cross-rs.sh"
146+ exit 1
147+ fi
148+ echo "Extracted cross-rs revision: ${CROSS_RS_REV}"
149+ echo "revision=${CROSS_RS_REV}" >> $GITHUB_OUTPUT
150+ - name : Restore cross-rs binaries from cache
151+ id : cache-cross
152+ uses : actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
153+ with :
154+ path : |
155+ ~/.cargo/bin/cross
156+ ~/.cargo/bin/cross-util
157+ key : ${{ runner.os }}-${{ runner.arch }}-cross-rs-${{ steps.cross-version.outputs.revision }}
158+ - name : Build cross-rs binaries
159+ if : steps.cache-cross.outputs.cache-hit != 'true'
160+ run : |
161+ ./hack/build/install-cross-rs.sh
162+ - name : Save cross-rs binaries to cache
163+ if : steps.cache-cross.outputs.cache-hit != 'true'
164+ uses : actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
165+ with :
166+ path : |
167+ ~/.cargo/bin/cross
168+ ~/.cargo/bin/cross-util
169+ key : ${{ runner.os }}-${{ runner.arch }}-cross-rs-${{ steps.cross-version.outputs.revision }}
170+
113171 upload-artifact :
114172 if : ${{ github.repository_owner == 'edera-dev' && (github.event_name == 'release' || github.event.pull_request.head.repo.full_name == github.repository) }}
173+ needs : [build-cross]
115174 name : Publish Binaries to Release
116175 permissions :
117176 contents : write
@@ -120,7 +179,7 @@ jobs:
120179 matrix :
121180 platform :
122181 - { os: linux, arch: x86_64, libc: musl, static: true, on: ubuntu-latest }
123- - { os: linux, arch: aarch64, libc: musl, static: true, on: ubuntu-latest }
182+ - { os: linux, arch: aarch64, libc: musl, static: true, on: ubuntu-24.04-arm }
124183 binary :
125184 - edera-check
126185 runs-on : ' ${{ matrix.platform.on }}'
@@ -136,10 +195,15 @@ jobs:
136195 fetch-depth : 0
137196 persist-credentials : false
138197
139- - name : Install Rust toolchain
140- uses : dtolnay/rust-toolchain@5d458579430fc14a04a08a1e7d3694f545e91ce6 # zizmor: ignore[stale-action-refs]
198+ - name : Restore cross-rs binaries
199+ uses : actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
200+ with :
201+ path : |
202+ ~/.cargo/bin/cross
203+ ~/.cargo/bin/cross-util
204+ key : ${{ runner.os }}-${{ runner.arch }}-cross-rs-${{ inputs.cross-revision }}
141205
142- - name : ' Build and assemble ${{ matrix.binary }}'
206+ - name : ' Build and assemble ${{ matrix.binary }} ${{ matrix.platform.os }}-${{ matrix.platform.arch }}-${{ matrix.platform.libc }} '
143207 run : |
144208 set -e
145209
@@ -149,7 +213,7 @@ jobs:
149213
150214 ${{ matrix.platform.static == true && 'export RUSTFLAGS="-Ctarget-feature=+crt-static"' || '' }}
151215
152- cargo build --release --target "$TARGET"
216+ hack/ build/cargo.sh --release --target "$TARGET"
153217
154218 # Platform name
155219 PLATFORM="${{ matrix.platform.os }}-${{ matrix.platform.arch }}-${{ matrix.platform.libc }}"
0 commit comments