fix(ci): dynamic matrix #33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | ||
|
Check failure on line 1 in .github/workflows/build.yml
|
||
| on: push | ||
| jobs: | ||
| define-matrix: | ||
| runs-on: ubuntu-24.04-arm | ||
| outputs: | ||
| matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
| env: | ||
| ARCH: [x86_64, aarch64] | ||
| PLATFORM: [linux-musl, windows-msvc, macos, freebsd, netbsd] | ||
| OPTIMIZE_MODE: [Debug, ReleaseSafe, ReleaseFast, ReleaseSmall] | ||
| steps: | ||
| - name: Set matrix | ||
| id: set-matrix | ||
| run: | | ||
| echo "matrix=$(yq -n -oj -I0 ' | ||
| env(ARCH) as $arch | | ||
| env(PLATFORM) as $platform | | ||
| env(OPTIMIZE_MODE) as $optimize_mode | | ||
| ( | ||
| [ | ||
| { "arch": "x86", "platform": "windows-msvc" }, | ||
| { "arch": "wasm32", "platform": "wasi" } | ||
| ] | ||
| + | ||
| [ | ||
| $arch[] as $a | | ||
| $platform[] as $p | | ||
| { "arch": $a, "platform": $p } | ||
| ] | ||
| ) as $triple | | ||
| { | ||
| "include": [ | ||
| $triple[] as $t | | ||
| $optimize_mode[] as $o | | ||
| $t + { "optimize": $o } | ||
| ] | ||
| } | ||
| ')" >> "$GITHUB_OUTPUT" | ||
| build: | ||
| runs-on: macos-latest | ||
| needs: define-matrix | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: ${{ fromJSON(needs.define-matrix.outputs.matrix) }} | ||
| env: | ||
| XWIN_SDK_VERSION: 10.0.22621 | ||
| VCLTL_VERSION: 5.2.2 | ||
| VCLTL_TARGET_VERSION: 10.0.19041.0 | ||
| XCODE_VERSION: 26.0.1 | ||
| MACOS_SDK_VERSION: 26.0 | ||
| TARGET_ARCH: ${{ matrix.arch }} | ||
| TARGET_PLATFORM: ${{ matrix.platform }} | ||
| TARGET_TRIPLE: ${{ matrix.arch }}-${{ matrix.platform }} | ||
| OPTIMIZE_MODE: ${{ matrix.optimize }} | ||
| steps: | ||
| - name: Check out repository code | ||
| uses: actions/checkout@v4 | ||
| - name: Setup zig | ||
| uses: mlugg/setup-zig@v2 | ||
| - name: Install xwin | ||
| if: ${{ matrix.platform == 'windows-msvc' }} | ||
| run: | | ||
| brew update | ||
| brew install xwin | ||
| - name: Build and pack | ||
| run: ./.github/workflows/build.sh | ||
| - name: Upload artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ${{ env.TARGET_TRIPLE }}-${{ matrix.optimize }} | ||
| path: gnuplot-${{ env.TARGET_TRIPLE }}.* | ||
| if-no-files-found: error | ||