From 557b85444e54e7a93c369b516b7a99a31d6c81f0 Mon Sep 17 00:00:00 2001 From: Stelios Tsampas Date: Thu, 13 Feb 2025 16:43:48 +0200 Subject: [PATCH] workflows: add multiple build targets --- .github/workflows/build.yml | 21 ++++++-- .github/workflows/release.yml | 52 ++++++++----------- .github/workflows/{devel.yml => snapshot.yml} | 16 ++++-- .github/workflows/upload.yml | 31 +++++++++++ 4 files changed, 82 insertions(+), 38 deletions(-) rename .github/workflows/{devel.yml => snapshot.yml} (71%) create mode 100644 .github/workflows/upload.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2324f2010..5df74aa5b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,10 +6,16 @@ on: name: required: true type: string + cpu_arch: + required: true + type: string + cpu_tune: + required: true + type: string jobs: proton: - name: ${{ inputs.name }} + name: Build ${{ inputs.name }} runs-on: ubuntu-latest steps: - name: Prepare host @@ -19,9 +25,9 @@ jobs: uses: actions/cache@v4 with: path: ~/.ccache - key: ccache-proton-${{ github.run_id }} + key: ccache-proton-${{ inputs.cpu_arch }}-${{ inputs.cpu_tune }}-${{ github.run_id }} restore-keys: | - ccache-proton + ccache-proton-${{ inputs.cpu_arch }}-${{ inputs.cpu_tune }} - name: Checkout uses: actions/checkout@v4 @@ -32,15 +38,19 @@ jobs: - name: Patch run: | + sed 's/-march=nocona/-march=${{ inputs.cpu_arch }}/g' -i Makefile.in + sed 's/-mtune=core-avx2/-mtune=${{ inputs.cpu_tune }}/g' -i Makefile.in mkdir ./build - name: Configure working-directory: ./build - run: ../configure.sh --build-name=${{ inputs.name }} --enable-ccache --container-engine=docker + run: | + ../configure.sh --build-name=${{ inputs.name }} --enable-ccache --container-engine=docker - name: Make ${{ inputs.name }} working-directory: ./build - run: make -j3 redist + run: | + make -j$(nproc) redist - name: Upload artifact ${{ inputs.name }}.tar.xz uses: actions/upload-artifact@v4 @@ -53,3 +63,4 @@ jobs: with: name: ${{ inputs.name }}.sha512sum path: ./build/${{ inputs.name }}.sha512sum + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4283d88f1..c3df0cae2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,38 +6,30 @@ on: jobs: build: + strategy: + matrix: + include: + - name: proton-${{ github.ref_name }}-x86_64 + cpu_arch: nocona + cpu_tune: core-avx2 + - name: proton-${{ github.ref_name }}-x86_64_v3 + cpu_arch: core-avx2 + cpu_tune: core-avx2 name: Build uses: ./.github/workflows/build.yml with: - name: proton-${{ github.ref_name }} + name: ${{ matrix.name }} + cpu_arch: ${{ matrix.cpu_arch }} + cpu_tune: ${{ matrix.cpu_tune }} - release: - name: Release ${{ github.ref_name }} + upload: + strategy: + matrix: + include: + - name: proton-${{ github.ref_name }}-x86_64 + - name: proton-${{ github.ref_name }}-x86_64_v3 + name: Upload needs: build - runs-on: ubuntu-latest - steps: - - name: Download ${{ github.ref_name }}.tar.xz artifact - uses: actions/download-artifact@v4 - with: - name: proton-${{ github.ref_name }}.tar.xz - - - name: Download ${{ github.ref_name }}.sha512sum artifact - uses: actions/download-artifact@v4 - with: - name: proton-${{ github.ref_name }}.sha512sum - - - name: Upload ${{ github.ref_name }}.tar.xz to release - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - tag: ${{ github.ref_name }} - file: proton-${{ github.ref_name }}.tar.xz - overwrite: false - - - name: Upload ${{ github.ref_name }}.sha512sum to release - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - tag: ${{ github.ref_name }} - file: proton-${{ github.ref_name }}.sha512sum - overwrite: false + uses: ./.github/workflows/upload.yml + with: + name: ${{ matrix.name }} diff --git a/.github/workflows/devel.yml b/.github/workflows/snapshot.yml similarity index 71% rename from .github/workflows/devel.yml rename to .github/workflows/snapshot.yml index df20439fb..7fbb1b3f3 100644 --- a/.github/workflows/devel.yml +++ b/.github/workflows/snapshot.yml @@ -1,4 +1,4 @@ -name: Development +name: Snapshot on: workflow_dispatch: @@ -32,10 +32,20 @@ jobs: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT build: + strategy: + matrix: + include: + - name: proton-${{ needs.version.outputs.full_desc }}-x86_64 + cpu_arch: nocona + cpu_tune: core-avx2 + - name: proton-${{ needs.version.outputs.full_desc }}-x86_64_v3 + cpu_arch: core-avx2 + cpu_tune: core-avx2 needs: version name: Build uses: ./.github/workflows/build.yml with: - name: proton-${{ needs.version.outputs.full_desc }}-${{ needs.version.outputs.branch }} - + name: ${{ matrix.name }} + cpu_arch: ${{ matrix.cpu_arch }} + cpu_tune: ${{ matrix.cpu_tune }} diff --git a/.github/workflows/upload.yml b/.github/workflows/upload.yml new file mode 100644 index 000000000..db390c55e --- /dev/null +++ b/.github/workflows/upload.yml @@ -0,0 +1,31 @@ +name: Upload + +on: + workflow_call: + inputs: + name: + required: true + type: string + +jobs: + upload: + name: Upload ${{ inputs.name }} + strategy: + matrix: + include: + - file: ${{ inputs.name }}.tar.xz + - file: ${{ inputs.name }}.sha512sum + runs-on: ubuntu-latest + steps: + - name: Download ${{ matrix.file }} artifact + uses: actions/download-artifact@v4 + with: + name: ${{ matrix.file }} + + - name: Upload ${{ matrix.file }} to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ github.ref_name }} + file: ${{ matrix.file }} + overwrite: false