Create linux-musl.yml #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci-linux-musl | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
release: | |
types: [published] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-24.04 # needs to be ubuntu-24.04 for qemu-user-static loongarch64 support | |
permissions: | |
contents: read | |
id-token: write | |
attestations: write | |
strategy: | |
fail-fast: false | |
matrix: | |
build_method: ["python", "cmake"] | |
arch: | |
[ | |
aarch64-linux-musl, | |
arm-linux-musleabi, | |
arm-linux-musleabihf, | |
armv6-linux-musleabihf, | |
armv7l-linux-musleabihf, | |
i686-linux-musl, | |
x86_64-linux-musl, | |
mips-linux-musl, | |
mips64-linux-musl, | |
mips64el-linux-musl, | |
mipsel-linux-musl, | |
powerpc-linux-musl, | |
powerpc64le-linux-musl, | |
s390x-linux-musl, | |
riscv64-linux-musl, | |
loongarch64-linux-musl, | |
] | |
include: | |
- arch: aarch64-linux-musl | |
binary_name: aarch64 | |
- arch: arm-linux-musleabi | |
binary_name: armv5 | |
- arch: arm-linux-musleabihf | |
binary_name: armhf | |
- arch: armv6-linux-musleabihf | |
binary_name: armv6 | |
- arch: armv7l-linux-musleabihf | |
binary_name: armv7 | |
- arch: i686-linux-musl | |
binary_name: x86 | |
- arch: x86_64-linux-musl | |
binary_name: x86_64 | |
- arch: mips-linux-musl | |
binary_name: mips | |
- arch: mips64-linux-musl | |
binary_name: mips64 | |
- arch: mips64el-linux-musl | |
binary_name: mips64el | |
- arch: mipsel-linux-musl | |
binary_name: mipsel | |
- arch: powerpc-linux-musl | |
binary_name: powerpc | |
- arch: powerpc64le-linux-musl | |
binary_name: powerpc64le | |
- arch: s390x-linux-musl | |
binary_name: s390x | |
- arch: riscv64-linux-musl | |
binary_name: riscv64 | |
- arch: loongarch64-linux-musl | |
binary_name: loongarch64 | |
name: ${{ matrix.build_method}} ${{ matrix.arch }} | |
steps: | |
- name: Host - checkout | |
uses: actions/checkout@v4 | |
- name: Host - update | |
run: sudo apt-get update | |
- name: Host - set up qemu-user-static binfmt-support | |
run: sudo apt-get install libpipeline1 qemu-user-static binfmt-support | |
- name: Host - Create docker crossbuild container | |
run: docker run --name crossbuild -it -d -e "LDFLAGS=-s -static --static" -w /home/github -v ${{ github.workspace }}:/home/github ghcr.io/userdocs/qbt-musl-cross-make:${{ matrix.arch }} | |
- name: Docker - Install ninja build optional dependencies | |
run: | | |
docker exec crossbuild sudo apk update | |
docker exec crossbuild sudo apk add --no-cache gtest gtest-dev python3 | |
- name: Docker - Configure ${{ matrix.binary_name }} | |
if: matrix.build_method == 'cmake' | |
run: > | |
docker exec crossbuild | |
cmake -B build | |
-D CMAKE_BUILD_TYPE="Release" | |
- name: Docker - Cmake Build ${{ matrix.binary_name }} | |
if: matrix.build_method == 'cmake' | |
run: docker exec crossbuild cmake --build build --parallel --config Release | |
- name: Docker - Python Build ${{ matrix.binary_name }} | |
if: matrix.build_method == 'python' | |
run: | | |
docker exec crossbuild ./configure.py --bootstrap --verbose | |
printf "%s\n" "build_method=-python" >> $GITHUB_ENV | |
- name: Host - Rename ${{ matrix.binary_name }} to ${{ env.release_asset }} | |
run: mv -f ${{ github.workspace }}/ninja ninja-${{ matrix.binary_name }} | |
- name: Host - ninja-${{ matrix.binary_name }} --version | |
run: ./ninja-${{ matrix.binary_name }}${{ env.build_method }} --version >> $GITHUB_STEP_SUMMARY | |
- name: Host - crossbuild binary info via file | |
run: file ./ninja-${{ matrix.binary_name }}${{ env.build_method }} >> $GITHUB_STEP_SUMMARY | |
- name: Host - signed build provenance attestations | |
uses: actions/attest-build-provenance@v2 | |
with: | |
subject-path: ninja-${{ matrix.binary_name }}${{ env.build_method }} | |
- name: Upload artifact - ${{ matrix.binary_name }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ninja-${{ matrix.binary_name }}${{ env.build_method }} | |
path: ninja-${{ matrix.binary_name }}${{ env.build_method }} |