Skip to content

Commit b65a8f9

Browse files
committed
Added CI worker for native S390X
1 parent 5a82f71 commit b65a8f9

File tree

7 files changed

+186
-5
lines changed

7 files changed

+186
-5
lines changed

.github/workflows/cmake.yml

+26-3
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,31 @@ jobs:
99
matrix:
1010
include:
1111
- name: Ubuntu GCC
12+
enabled: true
1213
os: ubuntu-latest
1314
compiler: gcc
1415
cflags: -Wall -Wextra
1516
pkgtgt: package package_source
1617
cmake-args: -DMINIZIP_ENABLE_BZIP2=ON
1718

1819
- name: Ubuntu GCC -O3
20+
enabled: true
1921
os: ubuntu-latest
2022
compiler: gcc
2123
cflags: -O3 -Wall -Wextra
2224
pkgtgt: package package_source
2325
cmake-args: -DMINIZIP_ENABLE_BZIP2=ON
2426

2527
- name: Ubuntu Clang
28+
enabled: true
2629
os: ubuntu-latest
2730
compiler: clang
2831
cflags: -Wall -Wextra
2932
pkgtgt: package package_source
3033
cmake-args: -DMINIZIP_ENABLE_BZIP2=ON
3134

3235
- name: Ubuntu Clang Debug
36+
enabled: true
3337
os: ubuntu-latest
3438
compiler: clang
3539
cflags: -Wall -Wextra
@@ -38,72 +42,91 @@ jobs:
3842
cmake-args: -DMINIZIP_ENABLE_BZIP2=ON
3943

4044
- name: Windows MSVC Win32
45+
enabled: true
4146
os: windows-latest
4247
compiler: cl
4348
cflags: /W3
4449
cmake-args: -A Win32
4550
pkgtgt: PACKAGE
4651

4752
- name: Windows MSVC Win64
53+
enabled: true
4854
os: windows-latest
4955
compiler: cl
5056
cflags: /W3
5157
cmake-args: -A x64 -DMINIZIP_ENABLE_BZIP2=OFF
5258
pkgtgt: PACKAGE
5359

5460
- name: Windows GCC
61+
enabled: true
5562
os: windows-latest
5663
compiler: gcc
5764
cflags: -Wall -Wextra
5865
cmake-args: -G Ninja -DMINIZIP_ENABLE_BZIP2=OFF
5966
pkgtgt: package
6067

6168
- name: macOS Clang
69+
enabled: true
6270
os: macos-latest
6371
compiler: clang
6472
cflags: -Wall -Wextra
6573
pkgtgt: package
6674
cmake-args: -DMINIZIP_ENABLE_BZIP2=ON
6775

6876
- name: macOS GCC
77+
enabled: true
6978
os: macos-latest
7079
compiler: gcc-12
7180
cflags: -Wall -Wextra
7281
pkgtgt: package
7382
cmake-args: -DMINIZIP_ENABLE_BZIP2=ON
7483

84+
- name: S390X Native GCC
85+
enabled: ${{ github.repository == 'fneddy/zlib' && 'true' || false }}
86+
os: ${{ github.repository == 'fneddy/zlib' && 'S390X' || 'ubuntu-latest' }}
87+
compiler: gcc
88+
cflags: -Wall -Wextra
89+
cmake-args: -DMINIZIP_ENABLE_BZIP2=OFF
90+
pkgtgt: package
91+
7592
steps:
7693
- name: Checkout repository
94+
if: matrix.enabled
7795
uses: actions/checkout@v4
7896

7997
- name: Install packages (Windows)
80-
if: runner.os == 'Windows'
98+
if: runner.os == 'Windows' && matrix.enabled
8199
run: |
82100
choco install --no-progress ninja
83101
84102
- name: Install packages (Linux)
85-
if: runner.os == 'Linux'
103+
if: runner.os == 'Linux' && matrix.os != 'S390X' && matrix.enabled
86104
run: |
87105
sudo apt install libbz2-dev
106+
88107
- name: Generate project files
108+
if: matrix.enabled
89109
run: cmake -S . -B ../build ${{ matrix.cmake-args }} -D CMAKE_BUILD_TYPE=${{ matrix.build-config || 'Release' }} -DZLIB_BUILD_MINIZIP=ON
90110
env:
91111
CC: ${{ matrix.compiler }}
92112
CFLAGS: ${{ matrix.cflags }}
93113

94114
- name: Compile source code
115+
if: matrix.enabled
95116
run: cmake --build ../build --config ${{ matrix.build-config || 'Release' }}
96117

97118
- name: Run test cases
119+
if: matrix.enabled
98120
run: ctest -C Release --output-on-failure --max-width 120
99121
working-directory: ../build
100122

101123
- name: create packages
124+
if: matrix.enabled
102125
run: cmake --build ../build --config ${{ matrix.build-config || 'Release' }} -t ${{ matrix.pkgtgt }}
103126

104127
- name: Upload build errors
105128
uses: actions/upload-artifact@v4
106-
if: failure()
129+
if: failure() && matrix.enabled == true
107130
with:
108131
name: ${{ matrix.name }} (cmake)
109132
path: |

.github/workflows/configure.yml

+24-2
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,22 @@ jobs:
99
matrix:
1010
include:
1111
- name: Ubuntu GCC
12+
enabled: true
1213
os: ubuntu-latest
1314
compiler: gcc
1415
configure-args: --warn
1516

1617
# Test out of source builds
1718
- name: Ubuntu GCC OSB
19+
enabled: true
1820
os: ubuntu-latest
1921
compiler: gcc
2022
configure-args: --warn
2123
build-dir: ../build
2224
src-dir: ../zlib
2325

2426
- name: Ubuntu GCC ARM SF
27+
enabled: true
2528
os: ubuntu-latest
2629
compiler: arm-linux-gnueabi-gcc
2730
configure-args: --warn
@@ -30,6 +33,7 @@ jobs:
3033
qemu-run: qemu-arm -L /usr/arm-linux-gnueabi
3134

3235
- name: Ubuntu GCC ARM HF
36+
enabled: true
3337
os: ubuntu-latest
3438
compiler: arm-linux-gnueabihf-gcc
3539
configure-args: --warn
@@ -38,6 +42,7 @@ jobs:
3842
qemu-run: qemu-arm -L /usr/arm-linux-gnueabihf
3943

4044
- name: Ubuntu GCC AARCH64
45+
enabled: true
4146
os: ubuntu-latest
4247
compiler: aarch64-linux-gnu-gcc
4348
configure-args: --warn
@@ -46,6 +51,7 @@ jobs:
4651
qemu-run: qemu-aarch64 -L /usr/aarch64-linux-gnu
4752

4853
- name: Ubuntu GCC PPC
54+
enabled: true
4955
os: ubuntu-latest
5056
compiler: powerpc-linux-gnu-gcc
5157
configure-args: --warn --static
@@ -56,6 +62,7 @@ jobs:
5662
ldflags: -static
5763

5864
- name: Ubuntu GCC PPC64
65+
enabled: true
5966
os: ubuntu-latest
6067
compiler: powerpc64-linux-gnu-gcc
6168
configure-args: --warn --static
@@ -66,14 +73,17 @@ jobs:
6673
ldflags: -static
6774

6875
- name: Ubuntu GCC PPC64LE
76+
enabled: true
6977
os: ubuntu-latest
7078
compiler: powerpc64le-linux-gnu-gcc
7179
configure-args: --warn
7280
chost: powerpc64le-linux-gnu
7381
packages: qemu-system qemu-user gcc-powerpc64le-linux-gnu libc-dev-ppc64el-cross
7482
qemu-run: qemu-ppc64le -L /usr/powerpc64le-linux-gnu
7583

84+
# if on base repo use the native workflow runner, else QEMU
7685
- name: Ubuntu GCC S390X
86+
enabled: true
7787
os: ubuntu-latest
7888
compiler: s390x-linux-gnu-gcc
7989
configure-args: --warn --static
@@ -83,27 +93,37 @@ jobs:
8393
cflags: -static
8494
ldflags: -static
8595

96+
- name: Native S390X GCC
97+
enabled: ${{ github.repository == 'fneddy/zlib' && 'true' || false }}
98+
os: ${{ github.repository == 'fneddy/zlib' && 'S390X' || 'ubuntu-latest' }}
99+
compiler: gcc
100+
configure-args: --warn
101+
86102
- name: macOS GCC
103+
enabled: true
87104
os: macos-latest
88105
compiler: gcc-12
89106
configure-args: --warn
90107

91108
- name: macOS Clang
109+
enabled: true
92110
os: macos-latest
93111
compiler: clang
94112
configure-args: --warn
95113

96114
steps:
97115
- name: Checkout repository
116+
if: matrix.enabled
98117
uses: actions/checkout@v4
99118

100119
- name: Install packages (Ubuntu)
101-
if: runner.os == 'Linux' && matrix.packages
120+
if: runner.os == 'Linux' && matrix.packages && matrix.enabled
102121
run: |
103122
sudo apt-get update
104123
sudo apt-get install -y ${{ matrix.packages }}
105124
106125
- name: Generate project files
126+
if: matrix.enabled
107127
run: |
108128
[ -d ${{ matrix.build-dir || '.' }} ] || mkdir ${{ matrix.build-dir || '.' }}
109129
cd ${{ matrix.build-dir || '.' }}
@@ -115,10 +135,12 @@ jobs:
115135
CHOST: ${{ matrix.chost }}
116136

117137
- name: Compile source code
138+
if: matrix.enabled
118139
run: make -j2
119140
working-directory: ${{ matrix.build-dir }}
120141

121142
- name: Run test cases
143+
if: matrix.enabled
122144
run: |
123145
make test
124146
make cover
@@ -128,7 +150,7 @@ jobs:
128150

129151
- name: Upload build errors
130152
uses: actions/upload-artifact@v4
131-
if: failure()
153+
if: failure() && matrix.enabled
132154
with:
133155
name: ${{ matrix.name }} (configure)
134156
path: |

contrib/README.contrib

+3
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,6 @@ untgz/ by Pedro A. Aranda Gutierrez <[email protected]>
5555
vstudio/ by Gilles Vollant <[email protected]>
5656
Building a minizip-enhanced zlib with Microsoft Visual Studio
5757
Includes vc11 from kreuzerkrieg and vc12 from davispuh
58+
59+
s390x/ by Eduard Stefes <[email protected]
60+
Scripts to create S390X github action workers.

contrib/s390x/README.md

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# General Notes
2+
3+
> [!NOTE]
4+
> This is a modified and simplified copy of the s390x self-hosted action runner scripts from here:
5+
> - https://github.com/zlib-ng/zlib-ng/tree/a0fa24710c8faa1a746a20cfd5c7c24571e15ca4/arch/s390/self-hosted-builder
6+
> - https://github.com/anup-kodlekere/gaplib
7+
>
8+
> **This code does NOT setup an ephemeral workers**. That means that the worker context is is reused between CI runs and will never be destroyed.
9+
>
10+
> This has several implications:
11+
> - one needs to check a PR that does not leak the /etc/actions_runner_conf
12+
> - one needs to check a PR that it does not alter the system in a persistent way
13+
> - one needs to check a PR that it does not access any file outside of the build folder
14+
>
15+
> To create ephemeral workers we need to setup a token request process similar like zlib-ng has done. But such a process implies that the worker maintainer needs, not just commit, but administration rights to the repository.
16+
17+
## Self Hosted Runner
18+
19+
Given complexity of Vector and DFLTCC machine instruction, it is not clear whether QEMU TCG will ever support it. At the time of writing, one has to have access to an IBM z15+ VM or LPAR in order to test the support. Since DFLTCC and Vector instructions are non-privileged, neither special VM/LPAR configuration nor root are required.
20+
21+
The CI uses an self-hosted builder, provided by marist university. There is no official IBM Z GitHub Actions runner, so we build one inspired by anup-kodlekere/gaplib. Future updates to actions-runner might need an updated patch. The .net version number patch has been separated into a separate file to avoid a need for constantly changing the patch.
22+
23+
### Setup
24+
25+
1. request an account at https://linuxone.cloud.marist.edu/#/login and create a VM
26+
2. install podman:
27+
28+
```
29+
sudo apt install podman
30+
```
31+
32+
3. request an action runner authentication token via the github project website:
33+
```
34+
Settings->Actions->Runners->New self-hosted runner
35+
```
36+
4. setup the repo and token in the actions_runner_conf.sh file:
37+
```
38+
REPO="fneddy/zlib"
39+
TOKEN="AAGXXXXXXXXXXXXXXXXXXXXXXXXXX"
40+
LABEL="S390X"
41+
```
42+
5. build the action runner container:
43+
```
44+
podman build -f actions_runner_ubuntu.Dockerfile --tag zlib/actions_runner .
45+
```
46+
6. run the action runner container:
47+
```
48+
podman run --rm -it zlib/actions_runner
49+
```
50+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
#
4+
# Ephemeral runner startup script.
5+
#
6+
# Expects the following environment variables:
7+
#
8+
# - REPO=<owner>
9+
# - TOKEN=<***>
10+
# - LABEL=<LABELS for this runner>
11+
#
12+
13+
set -e -u
14+
source /etc/actions_runner_conf
15+
16+
# Validate required environment variables
17+
if [ -z "${REPO:-}" ] || [ -z "${TOKEN:-}" ] || [ -z "${LABEL:-}" ]; then
18+
echo "Error: REPO and/or TOKEN and/or LABEL environment variables not found"
19+
exit 1
20+
fi
21+
22+
echo "https://github.com/$REPO"
23+
echo "$TOKEN"
24+
echo "$LABEL"
25+
26+
./config.sh \
27+
--unattended \
28+
--url "https://github.com/$REPO" \
29+
--token "$TOKEN" \
30+
--disableupdate \
31+
--labels "$LABEL"
32+
33+
# Run the actions-runner
34+
./run.sh
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
REPO="fneddy/zlib"
2+
TOKEN="AAG..."
3+
LABEL="S390X"

0 commit comments

Comments
 (0)