GitHub Actions: put .NET workflow jobs into matrix

This commit is contained in:
Syping 2025-11-04 06:28:42 +01:00
parent ac1a73b336
commit c2626b2d5d

View file

@ -1,13 +1,21 @@
name: .NET name: .NET
on: push on: push
env:
BUILD_TYPE: Release
jobs: jobs:
Linux_amd64: Linux:
runs-on: ubuntu-24.04 runs-on: ${{matrix.runner}}
container: container:
image: almalinux:8 image: almalinux:8
env: strategy:
BUILD_TYPE: Release matrix:
arch: [arm64, x64]
include:
- arch: arm64
runner: ubuntu-24.04-arm
- arch: x64
runner: ubuntu-24.04
steps: steps:
- name: Cloning - name: Cloning
uses: actions/checkout@v5 uses: actions/checkout@v5
@ -22,83 +30,53 @@ jobs:
- name: Upload - name: Upload
uses: actions/upload-artifact@v5 uses: actions/upload-artifact@v5
with: with:
name: AlmaLinux amd64 name: Linux ${{matrix.arch}}
path: ${{github.workspace}}/install/lib64/libragephoto.so path: ${{github.workspace}}/install/lib64/libragephoto.so
Linux_arm64: macOS:
runs-on: ubuntu-24.04-arm runs-on: ${{matrix.runner}}
container:
image: almalinux:8
env:
BUILD_TYPE: Release
steps:
- name: Cloning
uses: actions/checkout@v5
- name: Install packages
run: dnf install -y cmake gcc gcc-c++
- name: Configure CMake
run: cmake -B "build" -DRAGEPHOTO_C_LIBRARY=ON -DRAGEPHOTO_EXTRACT=OFF -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
run: cmake --build "build" --config ${{env.BUILD_TYPE}}
- name: Install
run: cmake --install "build" --config ${{env.BUILD_TYPE}} --prefix "install/"
- name: Upload
uses: actions/upload-artifact@v5
with:
name: AlmaLinux arm64
path: ${{github.workspace}}/install/lib64/libragephoto.so
macOS_amd64:
runs-on: macos-15-intel
env:
BUILD_TYPE: Release
steps:
- name: Cloning
uses: actions/checkout@v5
- name: Configure CMake
run: cmake -B "${{github.workspace}}/build" -DRAGEPHOTO_C_LIBRARY=ON -DRAGEPHOTO_EXTRACT=OFF -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -GNinja
- name: Build
run: cmake --build "${{github.workspace}}/build" --config ${{env.BUILD_TYPE}}
- name: Install
run: cmake --install "${{github.workspace}}/build" --config ${{env.BUILD_TYPE}} --prefix "${{github.workspace}}/install/"
- name: Upload
uses: actions/upload-artifact@v5
with:
name: macOS amd64
path: ${{github.workspace}}/install/lib/libragephoto.dylib
macOS_arm64:
runs-on: macos-15
env:
BUILD_TYPE: Release
steps:
- name: Cloning
uses: actions/checkout@v5
- name: Configure CMake
run: cmake -B "${{github.workspace}}/build" -DRAGEPHOTO_C_LIBRARY=ON -DRAGEPHOTO_EXTRACT=OFF -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -GNinja
- name: Build
run: cmake --build "${{github.workspace}}/build" --config ${{env.BUILD_TYPE}}
- name: Install
run: cmake --install "${{github.workspace}}/build" --config ${{env.BUILD_TYPE}} --prefix "${{github.workspace}}/install/"
- name: Upload
uses: actions/upload-artifact@v5
with:
name: macOS arm64
path: ${{github.workspace}}/install/lib/libragephoto.dylib
Windows:
runs-on: windows-latest
env: env:
BUILD_TYPE: Release BUILD_TYPE: Release
strategy: strategy:
matrix: matrix:
arch: arch: [arm64, x64]
- amd64 include:
- amd64_x86 - arch: arm64
- amd64_arm64 runner: macos-15
- arch: x64
runner: macos-15-intel
steps:
- name: Cloning
uses: actions/checkout@v5
- name: Configure CMake
run: cmake -B "${{github.workspace}}/build" -DRAGEPHOTO_C_LIBRARY=ON -DRAGEPHOTO_EXTRACT=OFF -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -GNinja
- name: Build
run: cmake --build "${{github.workspace}}/build" --config ${{env.BUILD_TYPE}}
- name: Install
run: cmake --install "${{github.workspace}}/build" --config ${{env.BUILD_TYPE}} --prefix "${{github.workspace}}/install/"
- name: Upload
uses: actions/upload-artifact@v5
with:
name: macOS ${{matrix.arch}}
path: ${{github.workspace}}/install/lib/libragephoto.dylib
Windows:
runs-on: windows-latest
strategy:
matrix:
arch: [arm64, x64, x86]
include:
- arch: arm64
msvc: amd64_arm64
- arch: x64
msvc: amd64
- arch: x86
msvc: amd64_x86
steps: steps:
- name: Cloning - name: Cloning
uses: actions/checkout@v5 uses: actions/checkout@v5
- name: Setup MSVC - name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1 uses: ilammy/msvc-dev-cmd@v1
with: with:
arch: ${{matrix.arch}} arch: ${{matrix.msvc}}
- name: Configure CMake - name: Configure CMake
run: cmake -B "${{github.workspace}}/build" -DRAGEPHOTO_C_LIBRARY=ON -DRAGEPHOTO_EXTRACT=OFF -DRAGEPHOTO_UNICODE=wincvt -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -GNinja run: cmake -B "${{github.workspace}}/build" -DRAGEPHOTO_C_LIBRARY=ON -DRAGEPHOTO_EXTRACT=OFF -DRAGEPHOTO_UNICODE=wincvt -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -GNinja
- name: Build - name: Build
@ -111,50 +89,48 @@ jobs:
name: Windows MSVC ${{matrix.arch}} name: Windows MSVC ${{matrix.arch}}
path: ${{github.workspace}}/install/bin/libragephoto.dll path: ${{github.workspace}}/install/bin/libragephoto.dll
Release: Release:
needs: [Linux_amd64, Linux_arm64, macOS_amd64, macOS_arm64, Windows] needs: [Linux, macOS, Windows]
runs-on: windows-latest runs-on: windows-latest
defaults: defaults:
run: run:
shell: pwsh shell: pwsh
env:
BUILD_TYPE: Release
steps: steps:
- name: Cloning - name: Cloning
uses: actions/checkout@v5 uses: actions/checkout@v5
- name: Download Linux amd64 Assets
uses: actions/download-artifact@v6
with:
name: AlmaLinux amd64
path: assets/linux-x64
- name: Download Linux arm64 Assets - name: Download Linux arm64 Assets
uses: actions/download-artifact@v6 uses: actions/download-artifact@v6
with: with:
name: AlmaLinux arm64 name: Linux arm64
path: assets/linux-arm64 path: assets/linux-arm64
- name: Download macOS amd64 Assets - name: Download Linux x64 Assets
uses: actions/download-artifact@v6 uses: actions/download-artifact@v6
with: with:
name: macOS amd64 name: Linux x64
path: assets/osx-x64 path: assets/linux-x64
- name: Download macOS arm64 Assets - name: Download macOS arm64 Assets
uses: actions/download-artifact@v6 uses: actions/download-artifact@v6
with: with:
name: macOS arm64 name: macOS arm64
path: assets/osx-arm64 path: assets/osx-arm64
- name: Download Windows MSVC amd64 Assets - name: Download macOS x64 Assets
uses: actions/download-artifact@v6 uses: actions/download-artifact@v6
with: with:
name: Windows MSVC amd64 name: macOS x64
path: assets/win-x64 path: assets/osx-x64
- name: Download Windows MSVC arm64 Assets - name: Download Windows MSVC arm64 Assets
uses: actions/download-artifact@v6 uses: actions/download-artifact@v6
with: with:
name: Windows MSVC amd64_arm64 name: Windows MSVC arm64
path: assets/win-arm64 path: assets/win-arm64
- name: Download Windows MSVC x64 Assets
uses: actions/download-artifact@v6
with:
name: Windows MSVC x64
path: assets/win-x64
- name: Download Windows MSVC x86 Assets - name: Download Windows MSVC x86 Assets
uses: actions/download-artifact@v6 uses: actions/download-artifact@v6
with: with:
name: Windows MSVC amd64_x86 name: Windows MSVC x86
path: assets/win-x86 path: assets/win-x86
- name: Copy Assets - name: Copy Assets
run: | run: |