|
| 1 | +name: Alpine on ARM |
| 2 | + |
| 3 | +on: push |
| 4 | + |
| 5 | +jobs: |
| 6 | + alpine: |
| 7 | + runs-on: ubuntu-24.04-arm |
| 8 | + container: |
| 9 | + image: 'alpine:3.22' |
| 10 | + # Volume needed for monkey-patch step. |
| 11 | + volumes: |
| 12 | + - /:/host |
| 13 | + steps: |
| 14 | + # Git is required so that actions/checkout does a proper Git checkout. |
| 15 | + - name: Install Git in container |
| 16 | + run: | |
| 17 | + apk update |
| 18 | + apk add git |
| 19 | + git config --global --add safe.directory "$GITHUB_WORKSPACE" |
| 20 | + - name: Monkey-patch Alpine Node.js into runner |
| 21 | + # This step is required because the actions refuse to run on ARM 64 |
| 22 | + # while in a container. So the OS ID is changed and the host's Node.js |
| 23 | + # binary is replaced with the one from the container. |
| 24 | + # Works for now, but may fail when Node or other stuff gets updated on |
| 25 | + # the runner's side. |
| 26 | + run: | |
| 27 | + apk add nodejs |
| 28 | + sed -i 's~ID=alpine~ID=nopine~g' /etc/os-release |
| 29 | + cd /host/home/runner/runners/*/externals/ |
| 30 | + rm -rf node20/* |
| 31 | + mkdir node20/bin |
| 32 | + ln -s /usr/bin/node node20/bin/node |
| 33 | + # Checks-out the repository under $GITHUB_WORKSPACE. |
| 34 | + - uses: actions/checkout@v4 |
| 35 | + with: |
| 36 | + fetch-depth: 0 |
| 37 | + submodules: 'recursive' |
| 38 | + - name: Install packages |
| 39 | + run: | |
| 40 | + apk update |
| 41 | + apk add cmake g++ git make |
| 42 | + - name: Build statically linked binaries |
| 43 | + run: | |
| 44 | + cd "$GITHUB_WORKSPACE" |
| 45 | + mkdir build-static |
| 46 | + cd build-static |
| 47 | + cmake ../ -DENABLE_LTO=ON -DENABLE_STATIC_LINKING=ON |
| 48 | + # Only build the executable, no tests. |
| 49 | + cmake --build . -j2 --target sha256 |
| 50 | + - name: Collect files |
| 51 | + run: | |
| 52 | + mkdir -p "$GITHUB_WORKSPACE"/artifacts |
| 53 | + cd "$GITHUB_WORKSPACE" |
| 54 | + cp build-static/sha256/sha256 artifacts/ |
| 55 | + cp ReadMe.de.txt artifacts/ |
| 56 | + cp ReadMe.en.txt artifacts/ |
| 57 | + cp ChangeLog.md artifacts/ |
| 58 | + cp LICENSE artifacts/ |
| 59 | + cp third-party.md artifacts/ |
| 60 | + VERSION=$(git describe --always) |
| 61 | + mv artifacts sha256_$VERSION |
| 62 | + tar czf sha256_${VERSION}_linux-arm64-generic.tar.gz sha256_$VERSION |
| 63 | + - name: Upload artifact |
| 64 | + uses: actions/upload-artifact@v4 |
| 65 | + with: |
| 66 | + name: sha256_linux-arm64-generic |
| 67 | + path: | |
| 68 | + sha256_*_linux-arm64-generic.tar.gz |
0 commit comments