|
1 | 1 | name: release |
2 | 2 |
|
3 | | -# Cross-compiled static release binaries, one per architecture. |
4 | | -# |
5 | | -# Toolchains come from cross-tools/musl-cross GitHub Releases |
6 | | -# (https://github.com/cross-tools/musl-cross/releases): musl, fetched over |
7 | | -# GitHub (musl.cc blocks GitHub Actions), and broad enough to cover every arch |
8 | | -# kasld targets — including loongarch64, which musl.cc never provided. |
| 3 | +# Cross-compiled static release binaries, one per architecture. The per-arch |
| 4 | +# build matrix + steps live in the reusable _cross-build.yml (shared with |
| 5 | +# build.yml's compile gate); this workflow resolves the toolchain version, |
| 6 | +# builds + packages in release mode, and publishes the GitHub Release. |
9 | 7 | on: |
10 | 8 | push: |
11 | 9 | tags: |
@@ -44,109 +42,13 @@ jobs: |
44 | 42 | echo "Using cross-tools/musl-cross ${VER}" |
45 | 43 | echo "version=${VER}" >> "$GITHUB_OUTPUT" |
46 | 44 |
|
| 45 | + # Build + package every arch (matrix + steps in _cross-build.yml). |
47 | 46 | build-release: |
48 | 47 | needs: resolve-toolchain |
49 | | - runs-on: ubuntu-latest |
50 | | - strategy: |
51 | | - fail-fast: false |
52 | | - matrix: |
53 | | - # arch: friendly name, used only in the artifact / tarball name. |
54 | | - # musl_triple: cross-tools/musl-cross triple — the tar.xz stem, the |
55 | | - # extracted directory name, and the <triple>-gcc prefix. |
56 | | - # KEEP IN SYNC with build.yml's cross-compile matrix (which gates the |
57 | | - # same arches on every push/PR). armeb has no cross-tools toolchain. |
58 | | - include: |
59 | | - # --- x86 --- |
60 | | - - { arch: x86_64, musl_triple: x86_64-unknown-linux-musl, native_test: true } |
61 | | - - { arch: i686, musl_triple: i686-unknown-linux-musl } |
62 | | - - { arch: i586, musl_triple: i586-unknown-linux-musl } # older x86 baseline |
63 | | - # --- ARM (soft/hard float, v6/v7) --- |
64 | | - # NOTE: armeb (big-endian ARM) is intentionally omitted — cross-tools/ |
65 | | - # musl-cross ships no armeb toolchain. Re-add if a source appears. |
66 | | - - { arch: aarch64, musl_triple: aarch64-unknown-linux-musl } |
67 | | - - { arch: arm, musl_triple: arm-unknown-linux-musleabi } # v6 soft-float |
68 | | - - { arch: armhf, musl_triple: arm-unknown-linux-musleabihf } # v6 hard-float |
69 | | - - { arch: armv7, musl_triple: armv7-unknown-linux-musleabi } # v7 soft-float |
70 | | - - { arch: armv7l, musl_triple: armv7-unknown-linux-musleabihf } # v7 hard-float |
71 | | - # --- MIPS (hard/soft float, BE/LE) --- |
72 | | - - { arch: mips, musl_triple: mips-unknown-linux-musl } |
73 | | - - { arch: mipssf, musl_triple: mips-unknown-linux-muslsf } # soft-float |
74 | | - - { arch: mipsel, musl_triple: mipsel-unknown-linux-musl } |
75 | | - - { arch: mipselsf, musl_triple: mipsel-unknown-linux-muslsf } # soft-float |
76 | | - - { arch: mips64, musl_triple: mips64-unknown-linux-musl } |
77 | | - - { arch: mips64el, musl_triple: mips64el-unknown-linux-musl } |
78 | | - # --- POWER (32/64, BE/LE) --- |
79 | | - - { arch: powerpc, musl_triple: powerpc-unknown-linux-musl } # ppc32 BE |
80 | | - - { arch: powerpcle, musl_triple: powerpcle-unknown-linux-musl } # ppc32 LE |
81 | | - - { arch: powerpc64, musl_triple: powerpc64-unknown-linux-musl } |
82 | | - - { arch: powerpc64le, musl_triple: powerpc64le-unknown-linux-musl } |
83 | | - # --- RISC-V (32/64) --- |
84 | | - - { arch: riscv32, musl_triple: riscv32-unknown-linux-musl } |
85 | | - - { arch: riscv64, musl_triple: riscv64-unknown-linux-musl } |
86 | | - # --- s390x --- |
87 | | - - { arch: s390x, musl_triple: s390x-ibm-linux-musl } |
88 | | - # --- LoongArch --- |
89 | | - - { arch: loongarch64, musl_triple: loongarch64-unknown-linux-musl } |
90 | | - |
91 | | - env: |
92 | | - TC_VERSION: ${{ needs.resolve-toolchain.outputs.version }} |
93 | | - |
94 | | - steps: |
95 | | - - uses: actions/checkout@v6 |
96 | | - |
97 | | - - name: Download + verify musl cross-compiler |
98 | | - run: | |
99 | | - set -euo pipefail |
100 | | - base="https://github.com/cross-tools/musl-cross/releases/download/${TC_VERSION}" |
101 | | - tarball="${{ matrix.musl_triple }}.tar.xz" |
102 | | - # Retry: the releases CDN occasionally returns a transient 5xx. |
103 | | - dl() { curl -fsSL --retry 5 --retry-delay 5 --retry-all-errors "$1" -o "$2"; } |
104 | | - dl "${base}/${tarball}" "${tarball}" |
105 | | - dl "${base}/${tarball}.sha256" "${tarball}.sha256" |
106 | | - # The .sha256 file holds only the bare digest, so pair it with the |
107 | | - # local filename before checking. |
108 | | - echo "$(cut -d' ' -f1 "${tarball}.sha256") ${tarball}" | sha256sum -c - |
109 | | - mkdir -p "${RUNNER_TEMP}/toolchain" |
110 | | - tar -xJf "${tarball}" -C "${RUNNER_TEMP}/toolchain" |
111 | | - echo "${RUNNER_TEMP}/toolchain/${{ matrix.musl_triple }}/bin" >> "$GITHUB_PATH" |
112 | | -
|
113 | | - - name: Build static binaries |
114 | | - run: make build CC=${{ matrix.musl_triple }}-gcc |
115 | | - |
116 | | - - name: Identify build directory |
117 | | - id: builddir |
118 | | - run: echo "dir=build/$(${{ matrix.musl_triple }}-gcc -dumpmachine)" >> "$GITHUB_OUTPUT" |
119 | | - |
120 | | - - name: Verify static linkage |
121 | | - run: | |
122 | | - file "${{ steps.builddir.outputs.dir }}/kasld" |
123 | | - file "${{ steps.builddir.outputs.dir }}/kasld" | grep -q "statically linked" |
124 | | -
|
125 | | - - name: Run tests (native only) |
126 | | - if: matrix.native_test |
127 | | - run: make test CC=${{ matrix.musl_triple }}-gcc |
128 | | - |
129 | | - - name: Package release tarball |
130 | | - run: | |
131 | | - set -euo pipefail |
132 | | - TAG="${GITHUB_REF_NAME}" |
133 | | - DIR="kasld-${TAG}-${{ matrix.arch }}" |
134 | | - mkdir -p "${DIR}" |
135 | | - # Ship the build/<arch> output (kasld + components/), minus the .o |
136 | | - # build intermediates. |
137 | | - cp -a "${{ steps.builddir.outputs.dir }}/." "${DIR}/" |
138 | | - find "${DIR}" -name '*.o' -delete |
139 | | - cp README.md LICENSE "${DIR}/" |
140 | | - tar czf "${DIR}.tar.gz" "${DIR}" |
141 | | - sha256sum "${DIR}.tar.gz" > "${DIR}.tar.gz.sha256" |
142 | | -
|
143 | | - - name: Upload artifact |
144 | | - uses: actions/upload-artifact@v5 |
145 | | - with: |
146 | | - name: kasld-${{ matrix.arch }} |
147 | | - path: | |
148 | | - kasld-*-${{ matrix.arch }}.tar.gz |
149 | | - kasld-*-${{ matrix.arch }}.tar.gz.sha256 |
| 48 | + uses: ./.github/workflows/_cross-build.yml |
| 49 | + with: |
| 50 | + toolchain_version: ${{ needs.resolve-toolchain.outputs.version }} |
| 51 | + package: true |
150 | 52 |
|
151 | 53 | create-release: |
152 | 54 | needs: build-release |
|
0 commit comments