Skip to content

Commit 0fa1b1c

Browse files
committed
Update linux-musl.yml
1 parent c4ddc7f commit 0fa1b1c

File tree

1 file changed

+25
-48
lines changed

1 file changed

+25
-48
lines changed

.github/workflows/linux-musl.yml

Lines changed: 25 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,18 @@ concurrency:
1111
group: ${{ github.workflow }}-${{ github.ref }}
1212
cancel-in-progress: true
1313

14+
permissions: {}
15+
1416
jobs:
1517
build:
16-
runs-on: ${{ matrix.runs-on }}
18+
runs-on: ubuntu-24.04
19+
container: alpine:edge
1720
permissions:
1821
contents: read
1922
strategy:
2023
fail-fast: false
2124
matrix:
2225
build_method: ["python", "cmake"]
23-
runs-on: ["ubuntu-24.04", "ubuntu-24.04-arm"]
24-
include:
25-
- runs-on: "ubuntu-24.04"
26-
container: "amd64/alpine:latest"
27-
binary_name: amd64
28-
- runs-on: "ubuntu-24.04-arm"
29-
container: "arm64v8/alpine:latest"
30-
binary_name: aarch64
31-
- build_method: "python"
32-
build_suffix: "-python"
33-
34-
name: ${{ matrix.build_method}} ${{ matrix.binary_name }}
35-
36-
env:
37-
container_name: crossbuild
3826

3927
steps:
4028
- name: Host - checkout
@@ -43,49 +31,38 @@ jobs:
4331
fetch-depth: 0
4432
persist-credentials: false
4533

46-
- name: Host - Create docker build container
47-
run: |
48-
# We create an Alpine edge container for cross-compilation with a user named gh which has same id as runner 1001 and provide sudo access
49-
# This way we can run commands as a non-root user, avoiding permission issues on host runner. Switching between user and root as needed.
50-
docker run --name ${container_name} -it -d -e "LDFLAGS=-s -static --static" -w /home/gh -v ${{ github.workspace }}:/home/gh ${{ matrix.container }}
51-
# Create the user gh with the id 1001:1001 which is the same as the runner user id and group id.
52-
docker exec ${container_name} sh -c 'adduser -h /home/gh -Ds /bin/bash -u 1001 gh && apk add sudo'
53-
# Allow the user gh to run sudo without password prompt: docker exec -u gh:gh ${container_name} sudo ls
54-
docker exec ${container_name} sh -c 'printf "%s" "gh ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/gh'
34+
- name: Install ninja build optional dependencies
35+
run: apk update && apk add -u --no-cache python3 build-base cmake re2c
5536

56-
- name: Docker - Install ninja build optional dependencies
57-
run: |
58-
docker exec ${container_name} apk update
59-
docker exec ${container_name} apk add -u --no-cache python3 build-base cmake re2c
60-
61-
- name: Docker - Configure ${{ matrix.binary_name }}
37+
- name: Configure ninja build
6238
if: matrix.build_method == 'cmake'
63-
run: docker exec -u gh:gh ${container_name} cmake -B build -D CMAKE_BUILD_TYPE="Release"
39+
run: cmake -B build -D CMAKE_BUILD_TYPE="Release"
6440

65-
- name: Docker - Cmake Build ${{ matrix.binary_name }}
41+
- name: Cmake Build ninja
6642
if: matrix.build_method == 'cmake'
67-
run: docker exec -u gh:gh ${container_name} cmake --build build --parallel --config Release
43+
run: cmake --build build --parallel --config Release
6844

69-
- name: Docker - Cmake test ${{ matrix.binary_name }}
45+
- name: Cmake test ninja
7046
if: matrix.build_method == 'cmake'
71-
run: docker exec -u gh:gh ${container_name} build/ninja_test --gtest_color=yes
47+
run: build/ninja_test --gtest_color=yes
7248

73-
- name: Docker - Python Build ${{ matrix.binary_name }}
49+
- name: Python Build ninja
7450
if: matrix.build_method == 'python'
75-
run: docker exec -u gh:gh ${container_name} python3 configure.py --bootstrap --verbose
51+
run: python3 configure.py --bootstrap --verbose
7652

77-
- name: Docker - Python test ${{ matrix.binary_name }}
53+
- name: Python test ninja
7854
if: matrix.build_method == 'python'
7955
run: |
80-
docker exec -u gh:gh ${container_name} /home/gh/ninja all
81-
docker exec -u gh:gh ${container_name} python3 misc/ninja_syntax_test.py
82-
# docker exec -u gh:gh ${container_name} python3 misc/output_test.py
56+
./ninja all
57+
python3 misc/ninja_syntax_test.py
58+
# python3 misc/output_test.py
8359
84-
- name: Host - Rename ${{ matrix.binary_name }} to ${{ env.release_asset }}
85-
run: mv -f ${{ matrix.build_method == 'cmake' && 'build/' || '' }}ninja ninja-${{ matrix.binary_name }}${{ matrix.build_suffix }}
60+
- name: Move ninja binary
61+
if: matrix.build_method == 'cmake'
62+
run: mv -f build/ninja ninja
8663

87-
- name: Host - ninja-${{ matrix.binary_name }} --version
88-
run: ./ninja-${{ matrix.binary_name }}${{ matrix.build_suffix }} --version >> $GITHUB_STEP_SUMMARY
64+
- name: ninja-ninja --version
65+
run: ./ninja --version >> $GITHUB_STEP_SUMMARY
8966

90-
- name: Host - ${{ env.container_name}} binary info via file
91-
run: file ./ninja-${{ matrix.binary_name }}${{ matrix.build_suffix }} >> $GITHUB_STEP_SUMMARY
67+
- name: binary info via file
68+
run: file ./ninja >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)