|
| 1 | +name: Alpine |
| 2 | + |
| 3 | +on: push |
| 4 | + |
| 5 | +jobs: |
| 6 | + alpine: |
| 7 | + runs-on: ubuntu-24.04 |
| 8 | + container: 'alpine:3.22' |
| 9 | + |
| 10 | + steps: |
| 11 | + - name: Install and prepare Git |
| 12 | + run: | |
| 13 | + apk update && apk upgrade |
| 14 | + apk add git |
| 15 | + git config --global --add safe.directory "$GITHUB_WORKSPACE" |
| 16 | + # Checks-out the repository under $GITHUB_WORKSPACE. |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + with: |
| 19 | + fetch-depth: 0 |
| 20 | + submodules: 'recursive' |
| 21 | + - name: Install packages |
| 22 | + run: | |
| 23 | + apk update |
| 24 | + apk add catch2 cmake g++ libxml2-dev make pkgconf zlib-dev |
| 25 | + - name: Build |
| 26 | + run: | |
| 27 | + cd "$GITHUB_WORKSPACE" |
| 28 | + mkdir build |
| 29 | + cd build |
| 30 | + cmake ../ |
| 31 | + cmake --build . -j4 |
| 32 | + - name: Run tests |
| 33 | + run: | |
| 34 | + cd "$GITHUB_WORKSPACE/build" |
| 35 | + ctest -V |
| 36 | + - name: Install statically linked libraries |
| 37 | + run: | |
| 38 | + apk add libxml2-static xz-static zlib-static |
| 39 | + - name: Build statically linked executables |
| 40 | + run: | |
| 41 | + cd "$GITHUB_WORKSPACE" |
| 42 | + mkdir build-static |
| 43 | + cd build-static |
| 44 | + cmake ../ -DENABLE_LTO=ON -DENABLE_STATIC_LINKING=ON |
| 45 | + cmake --build . -j4 |
| 46 | + - name: Run tests for statically linked build |
| 47 | + run: | |
| 48 | + cd "$GITHUB_WORKSPACE/build-static" |
| 49 | + ctest -V |
| 50 | + - name: Gather build artifacts |
| 51 | + run: | |
| 52 | + cd "$GITHUB_WORKSPACE" |
| 53 | + mkdir artifacts |
| 54 | + # binary files |
| 55 | + cp build-static/code/pmdb artifacts/ |
| 56 | + # license |
| 57 | + cp LICENSE artifacts/ |
| 58 | + # determine version |
| 59 | + VERSION=$(git describe --always) |
| 60 | + echo Version is $VERSION. |
| 61 | + mv artifacts pmdb-$VERSION |
| 62 | + tar czf pmdb_${VERSION}_linux-amd64-generic.tar.gz pmdb-$VERSION |
| 63 | + - name: Archive build artifacts |
| 64 | + uses: actions/upload-artifact@v4 |
| 65 | + with: |
| 66 | + name: pmdb_linux-amd64-generic |
| 67 | + path: pmdb_*_linux-amd64-generic.tar.gz |
| 68 | + if-no-files-found: error |
0 commit comments