summaryrefslogtreecommitdiff
path: root/.github/workflows/build-arm64-layer.yml
blob: 973a548e40dcb2c5b587f3cf39ebb36c71ca0bdd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Build ARM64 lsfg-vk layer

on:
  workflow_dispatch:
  pull_request:
    paths:
      - .github/workflows/build-arm64-layer.yml

permissions:
  contents: read

env:
  SOURCE_REPOSITORY: https://github.com/FrankBarretta/lsfg-vk-android.git
  SOURCE_COMMIT: 3e89e5439a98f55d5acb003d20039426ab24e69c

jobs:
  build:
    name: Native AArch64 release build
    runs-on: ubuntu-24.04-arm

    steps:
      - name: Install build dependencies
        run: |
          sudo apt-get update
          sudo apt-get install --yes --no-install-recommends \
            clang cmake g++ git libvulkan-dev ninja-build

      - name: Check out the pinned layer source
        run: |
          git init lsfg-vk-android
          cd lsfg-vk-android
          git remote add origin "${SOURCE_REPOSITORY}"
          git fetch --depth=1 origin "${SOURCE_COMMIT}"
          git checkout --detach FETCH_HEAD
          git submodule update --init --recursive --depth=1
          test "$(git rev-parse HEAD)" = "${SOURCE_COMMIT}"

      - name: Build with static C++ runtimes
        run: |
          cmake -S lsfg-vk-android -B build -G Ninja \
            -DCMAKE_BUILD_TYPE=Release \
            -DCMAKE_C_COMPILER=clang \
            -DCMAKE_CXX_COMPILER=clang++ \
            -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF \
            -DCMAKE_SHARED_LINKER_FLAGS="-static-libstdc++ -static-libgcc -Wl,--exclude-libs,ALL"
          cmake --build build --parallel 4
          strip --strip-unneeded build/liblsfg-vk.so

      - name: Verify and document the artifact
        run: |
          mkdir -p artifact
          install -m 0755 build/liblsfg-vk.so artifact/liblsfg-vk-arm64.so
          readelf -h artifact/liblsfg-vk-arm64.so | grep -q 'Machine:.*AArch64'
          readelf -d artifact/liblsfg-vk-arm64.so | tee artifact/ELF-DYNAMIC.txt
          ! grep -Eq 'libstdc\+\+\.so|libgcc_s\.so' artifact/ELF-DYNAMIC.txt
          sha256sum artifact/liblsfg-vk-arm64.so | tee artifact/SHA256SUMS
          {
            echo "Source repository: ${SOURCE_REPOSITORY}"
            echo "Source commit: ${SOURCE_COMMIT}"
            echo "Runner: ubuntu-24.04-arm"
            echo "Compiler: $(clang++ --version | head -n1)"
            echo "CMake: $(cmake --version | head -n1)"
            echo "Static runtimes: libstdc++ and libgcc"
          } > artifact/SOURCE.txt

      - name: Upload ARM64 layer
        uses: actions/upload-artifact@v4
        with:
          name: lsfg-vk-arm64-${{ env.SOURCE_COMMIT }}
          path: artifact/
          if-no-files-found: error
          retention-days: 90