|
| 1 | +name: Alpine on ARM 64 |
| 2 | + |
| 3 | +on: push |
| 4 | + |
| 5 | +jobs: |
| 6 | + alpine: |
| 7 | + runs-on: ubuntu-24.04-arm |
| 8 | + container: |
| 9 | + image: 'alpine:3.22' |
| 10 | + # Needed for Monkey-patch step. |
| 11 | + volumes: |
| 12 | + - /:/host |
| 13 | + steps: |
| 14 | + - name: Install and prepare Git |
| 15 | + run: | |
| 16 | + apk update && apk upgrade |
| 17 | + apk add git |
| 18 | + git config --global --add safe.directory "$GITHUB_WORKSPACE" |
| 19 | + - name: Monkey-patch Alpine Node.js into runner |
| 20 | + # This step is required because the actions refuse to run on ARM 64 |
| 21 | + # while in a container. So the OS ID is changed and the host's Node.js |
| 22 | + # binary is replaced with the one from the container. |
| 23 | + # Works for now, but may fail when Node or other stuff gets updated on |
| 24 | + # the runner's side. |
| 25 | + run: | |
| 26 | + apk add nodejs |
| 27 | + sed -i 's~ID=alpine~ID=nopine~g' /etc/os-release |
| 28 | + cd /host/home/runner/runners/*/externals/ |
| 29 | + rm -rf node20/* |
| 30 | + mkdir node20/bin |
| 31 | + ln -s /usr/bin/node node20/bin/node |
| 32 | + # Checks-out the repository under $GITHUB_WORKSPACE. |
| 33 | + - uses: actions/checkout@v4 |
| 34 | + with: |
| 35 | + fetch-depth: 0 |
| 36 | + submodules: 'recursive' |
| 37 | + - name: Install packages |
| 38 | + run: | |
| 39 | + apk update |
| 40 | + apk add catch2 cmake g++ libxml2-dev make pkgconf zlib-dev |
| 41 | + - name: Build |
| 42 | + run: | |
| 43 | + cd "$GITHUB_WORKSPACE" |
| 44 | + mkdir build |
| 45 | + cd build |
| 46 | + cmake ../ |
| 47 | + cmake --build . -j4 |
| 48 | + - name: Run tests |
| 49 | + run: | |
| 50 | + cd "$GITHUB_WORKSPACE/build" |
| 51 | + ctest -V |
| 52 | + - name: Install statically linked libraries |
| 53 | + run: | |
| 54 | + apk add libxml2-static xz-static zlib-static |
| 55 | + - name: Build statically linked executables |
| 56 | + run: | |
| 57 | + cd "$GITHUB_WORKSPACE" |
| 58 | + mkdir build-static |
| 59 | + cd build-static |
| 60 | + cmake ../ -DENABLE_LTO=ON -DENABLE_STATIC_LINKING=ON |
| 61 | + cmake --build . -j4 |
| 62 | + - name: Run tests for statically linked build |
| 63 | + run: | |
| 64 | + cd "$GITHUB_WORKSPACE/build-static" |
| 65 | + ctest -V |
| 66 | + - name: Gather build artifacts |
| 67 | + run: | |
| 68 | + cd "$GITHUB_WORKSPACE" |
| 69 | + mkdir artifacts |
| 70 | + # binary files |
| 71 | + cp build-static/code/pmdb artifacts/ |
| 72 | + # license + third-party notices |
| 73 | + cp LICENSE artifacts/ |
| 74 | + cp third-party.md artifacts/ |
| 75 | + # template files |
| 76 | + cp code/templates/*.tpl artifacts/ |
| 77 | + # documentation |
| 78 | + cp -R documentation artifacts/documentation |
| 79 | + unlink artifacts/documentation/msys2-build.md |
| 80 | + # determine version |
| 81 | + VERSION=$(git describe --always) |
| 82 | + echo Version is $VERSION. |
| 83 | + mv artifacts pmdb-$VERSION |
| 84 | + tar czf pmdb_${VERSION}_linux-arm64-generic.tar.gz pmdb-$VERSION |
| 85 | + - name: Archive build artifacts |
| 86 | + uses: actions/upload-artifact@v4 |
| 87 | + with: |
| 88 | + name: pmdb_linux-arm64-generic |
| 89 | + path: pmdb_*_linux-aarm64-generic.tar.gz |
| 90 | + if-no-files-found: error |
0 commit comments