From 4a5f40142f1ac2a889e5a90463deffcaf6112a16 Mon Sep 17 00:00:00 2001 From: narimiran Date: Fri, 8 Nov 2024 14:58:33 +0100 Subject: [PATCH] try to make a reusable matrix --- .github/workflows/common.yml | 60 ++++++++++++++++-------------------- .github/workflows/matrix.yml | 26 ++++++++++++++++ 2 files changed, 52 insertions(+), 34 deletions(-) create mode 100644 .github/workflows/matrix.yml diff --git a/.github/workflows/common.yml b/.github/workflows/common.yml index ef7baf9..d1518ea 100644 --- a/.github/workflows/common.yml +++ b/.github/workflows/common.yml @@ -2,42 +2,34 @@ name: CI on: workflow_call: + outputs: + matrix: + value: ${{ jobs.generate-json-matrix.outputs.matrix }} + concurrency: # Cancel stale PR builds (but not push builds) group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} cancel-in-progress: true jobs: + create-matrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.convert.outputs.matrix }} + steps: + - name: Checkout + uses: actions/checkout@v4 + - id: convert + run: | + echo "matrix=$(yq -o=json -I=0 '.' .github/workflows/matrix.yml" >> $GITHUB_OUTPUT + build: + needs: create-matrix + outputs: + matrix: ${{ needs.create-matrix.outputs.matrix }} strategy: fail-fast: false - matrix: - target: - - os: linux - cpu: amd64 - platform: x64 - builder: ubuntu-latest - - os: linux-gcc-14 # This is to use ubuntu 24 and install gcc 14. Should be removed when ubuntu-latest is 26.04 - cpu: amd64 - platform: x64 - builder: ubuntu-24.04 - - os: macos - cpu: amd64 - platform: x64 - builder: macos-13 - - os: windows - cpu: amd64 - platform: x64 - builder: windows-latest - - os: linux - cpu: i386 - platform: x86 - builder: ubuntu-latest - - os: macos - cpu: arm64 - platform: arm64 - builder: macos-latest - branch: [version-2-0, version-2-2, devel] + matrix: ${{ fromJSON(needs.create-matrix.outputs.matrix) }} defaults: run: shell: bash @@ -134,10 +126,10 @@ jobs: bash build_nim.sh nim csources dist/nimble NimBinaries echo '${{ github.workspace }}/nim/bin' >> $GITHUB_PATH - - name: Run tests - run: | - nim --version - nimble --version - gcc --version - nimble install -y --depsOnly - nimble test + # - name: Run tests + # run: | + # nim --version + # nimble --version + # gcc --version + # nimble install -y --depsOnly + # nimble test diff --git a/.github/workflows/matrix.yml b/.github/workflows/matrix.yml new file mode 100644 index 0000000..1e2ddc8 --- /dev/null +++ b/.github/workflows/matrix.yml @@ -0,0 +1,26 @@ +target: + - os: linux + cpu: amd64 + platform: x64 + builder: ubuntu-latest + - os: linux-gcc-14 # This is to use ubuntu 24 and install gcc 14. Should be removed when ubuntu-latest is 26.04 + cpu: amd64 + platform: x64 + builder: ubuntu-24.04 + - os: macos + cpu: amd64 + platform: x64 + builder: macos-13 + - os: windows + cpu: amd64 + platform: x64 + builder: windows-latest + - os: linux + cpu: i386 + platform: x86 + builder: ubuntu-latest + - os: macos + cpu: arm64 + platform: arm64 + builder: macos-latest +branch: [version-2-0, version-2-2, devel]