|
11 | 11 | type: string |
12 | 12 | required: false |
13 | 13 |
|
14 | | -env: |
15 | | - LLVM_MINGW_VERSION: llvm-mingw-20240619-msvcrt-ubuntu-20.04-x86_64 |
16 | | - LLVM_MINGW_DOWNLOAD: https://github.com/mstorsjo/llvm-mingw/releases/download/20240619/llvm-mingw-20240619-msvcrt-ubuntu-20.04-x86_64.tar.xz |
17 | | - |
18 | 14 | jobs: |
19 | 15 | build-windows: |
20 | 16 | runs-on: windows-latest |
@@ -62,87 +58,60 @@ jobs: |
62 | 58 | name: ${{ matrix.preset }} |
63 | 59 | path: out/install/${{ matrix.preset }}/ |
64 | 60 |
|
| 61 | + |
65 | 62 | build-ubuntu: |
66 | | - runs-on: ubuntu-24.04 |
| 63 | + runs-on: ubuntu-latest |
67 | 64 |
|
68 | 65 | strategy: |
69 | 66 | fail-fast: false |
70 | 67 | matrix: |
71 | | - preset: [ |
72 | | - "clang-cross-x86-release", |
73 | | - "clang-cross-x64-release", |
74 | | - "llvm-mingw-x86-release", |
75 | | - "llvm-mingw-x64-release", |
76 | | - "mingw-x86-release", |
77 | | - "mingw-x64-release", |
78 | | - ] |
| 68 | + toolchain: |
| 69 | + - preset: clang-cross-x86-release |
| 70 | + container: clang-cross |
| 71 | + - preset: clang-cross-x64-release |
| 72 | + container: clang-cross |
| 73 | + - preset: llvm-mingw-x86-release |
| 74 | + container: llvm-mingw |
| 75 | + - preset: llvm-mingw-x64-release |
| 76 | + container: llvm-mingw |
| 77 | + - preset: mingw-x86-release |
| 78 | + container: mingw |
| 79 | + - preset: mingw-x64-release |
| 80 | + container: mingw |
79 | 81 |
|
80 | 82 | steps: |
81 | | - - name: Setup CMake and Ninja |
82 | | - uses: lukka/get-cmake@latest |
83 | | - |
84 | | - - name: Setup apt packages |
85 | | - uses: awalsh128/cache-apt-pkgs-action@latest |
86 | | - with: |
87 | | - packages: msitools |
88 | | - version: ${{ runner.os }}-apt |
89 | | - |
90 | | - - name: Setup LLVM MinGW |
91 | | - if: startswith(matrix.preset, 'llvm-mingw') |
92 | | - run: | |
93 | | - wget -nv ${{ env.LLVM_MINGW_DOWNLOAD }} |
94 | | - tar -xf ${{ env.LLVM_MINGW_VERSION }}.tar.xz -C ~/ |
95 | | - echo $(readlink -f ~/${{ env.LLVM_MINGW_VERSION }}/bin) >> $GITHUB_PATH |
96 | | -
|
97 | | - - name: Setup MinGW |
98 | | - if: startswith(matrix.preset, 'mingw') |
99 | | - uses: egor-tensin/setup-mingw@v2 |
100 | | - with: |
101 | | - platform: ${{ fromJSON('["x86", "x64"]')[contains(matrix.preset, 'x64')] }} |
102 | | - |
103 | | - - name: Setup Clang |
104 | | - if: startswith(matrix.preset, 'clang-cross') |
105 | | - uses: egor-tensin/setup-clang@v1 |
106 | | - |
107 | | - - name: Restore win sdk cache |
108 | | - if: startswith(matrix.preset, 'clang-cross') |
109 | | - uses: actions/cache@v4 |
110 | | - id: cache-win-sdk |
111 | | - with: |
112 | | - path: ~/win-sdk |
113 | | - key: ${{ runner.os }}-win-sdk |
114 | | - |
115 | | - - name: Setup win sdk |
116 | | - if: startswith(matrix.preset, 'clang-cross') && steps.cache-win-sdk.outputs.cache-hit != 'true' |
117 | | - run: | |
118 | | - git clone https://github.com/mstorsjo/msvc-wine.git |
119 | | - msvc-wine/vsdownload.py --accept-license --dest ~/win-sdk Microsoft.VisualStudio.Workload.VCTools |
120 | | - msvc-wine/install.sh ~/win-sdk |
121 | | - rm -r msvc-wine |
122 | | -
|
123 | 83 | - name: Checkout repository and submodules |
124 | 84 | uses: actions/checkout@v4 |
125 | 85 | with: |
126 | 86 | submodules: recursive |
127 | 87 |
|
128 | | - - name: Configure CMake |
129 | | - working-directory: ${{ env.GITHUB_WORKSPACE }} |
130 | | - # The extra msvc wine arg won't do anything if we're not cross compiling |
131 | | - run: > |
132 | | - cmake . |
133 | | - --preset ${{ matrix.preset }} |
134 | | - -G Ninja |
135 | | - -DMSVC_WINE_ENV_SCRIPT=$(readlink -f ~)/win-sdk/bin/${{ fromJSON('["x86", "x64"]')[contains(matrix.preset, 'x64')] }}/msvcenv.sh |
| 88 | + - name: Login to GitHub Container Registry |
| 89 | + uses: docker/login-action@v2 |
| 90 | + with: |
| 91 | + registry: ghcr.io |
| 92 | + username: ${{ github.repository_owner }} |
| 93 | + password: ${{ secrets.GITHUB_TOKEN }} |
136 | 94 |
|
137 | 95 | - name: Build |
138 | | - working-directory: ${{ env.GITHUB_WORKSPACE }} |
139 | | - run: cmake --build out/build/${{ matrix.preset }} --target install |
| 96 | + uses: devcontainers/[email protected] |
| 97 | + with: |
| 98 | + cacheFrom: ghcr.io/bl-sdk/${{ matrix.toolchain.container }}:latest |
| 99 | + configFile: .devcontainer/${{ matrix.toolchain.container }}/devcontainer.json |
| 100 | + push: never |
| 101 | + # The git watcher cmake thinks something's unsafe? Doesn't happen to me locally. |
| 102 | + runCmd: | |
| 103 | + git config --global --add safe.directory `pwd` |
| 104 | +
|
| 105 | + set -e |
| 106 | +
|
| 107 | + cmake . --preset ${{ matrix.toolchain.preset }} -G Ninja |
| 108 | + cmake --build out/build/${{ matrix.toolchain.preset }} --target install |
140 | 109 |
|
141 | 110 | - name: Upload artifact |
142 | 111 | uses: actions/upload-artifact@v4 |
143 | 112 | with: |
144 | | - name: ${{ matrix.preset }} |
145 | | - path: out/install/${{ matrix.preset }}/ |
| 113 | + name: ${{ matrix.toolchain.preset }} |
| 114 | + path: out/install/${{ matrix.toolchain.preset }}/ |
146 | 115 |
|
147 | 116 | # ============================================================================== |
148 | 117 |
|
|
0 commit comments