From 0274bd14921ea1a84770c70c2d2276be02f3b34d Mon Sep 17 00:00:00 2001 From: James H Ball Date: Sat, 30 Aug 2025 15:54:33 +0100 Subject: [PATCH] Simplify build.yaml significantly --- .github/workflows/build.yaml | 162 ++++++++++++++--------------------- 1 file changed, 62 insertions(+), 100 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 9f6d6db6..6ca75e93 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -5,19 +5,20 @@ on: - main - develop workflow_dispatch: + jobs: - build-linux: - name: Build Linux - runs-on: ubuntu-24.04 + build: + name: Build (${{ matrix.project }} ${{ matrix.version }} @ ${{ matrix.os }}) + runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: - include: - - project: osci-render - version: free - - project: osci-render - version: premium + os: [ubuntu-24.04, macos-latest, windows-latest] + project: [osci-render, sosci] + version: [free, premium] + exclude: - project: sosci - version: premium + version: free steps: - name: Fix up git URLs run: echo -e '[url "https://github.com/"]\n insteadOf = "git@github.com:"' >> ~/.gitconfig @@ -28,47 +29,28 @@ jobs: token: ${{ secrets.ACCESS_TOKEN }} submodules: true - - name: "Run script" + - name: Set platform variables + shell: bash run: | - export OS="linux" - source ./ci/setup-env.sh - source ./ci/test.sh - source ./ci/build.sh "${{ matrix.project }}" "${{ matrix.version }}" - shell: bash - - - name: Upload Artifact - uses: actions/upload-artifact@v4 - with: - name: "${{ matrix.project }}-${{ matrix.version }}-linux" - path: bin - retention-days: 7 - build-macos: - name: Build macOS - runs-on: macos-latest - strategy: - matrix: - include: - - project: osci-render - version: free - - project: osci-render - version: premium - - project: sosci - version: premium - steps: - - name: Fix up git URLs - run: echo -e '[url "https://github.com/"]\n insteadOf = "git@github.com:"' >> ~/.gitconfig - shell: bash - - - uses: actions/checkout@v1 - with: - token: ${{ secrets.ACCESS_TOKEN }} - submodules: true + if [[ "${{ matrix.os }}" == ubuntu* ]]; then + echo "OS=linux" >> $GITHUB_ENV + echo "OS_ARTIFACT=linux" >> $GITHUB_ENV + elif [[ "${{ matrix.os }}" == macos* ]]; then + echo "OS=mac" >> $GITHUB_ENV + echo "OS_ARTIFACT=macos" >> $GITHUB_ENV + else + echo "OS=win" >> $GITHUB_ENV + echo "OS_ARTIFACT=windows" >> $GITHUB_ENV + fi + # macOS specific: setup Xcode and import certificates - uses: maxim-lobanov/setup-xcode@v1 + if: matrix.os == 'macos-latest' with: xcode-version: latest - + - name: Import application certificates + if: matrix.os == 'macos-latest' uses: apple-actions/import-codesign-certs@v3 with: keychain: oscirender @@ -77,6 +59,7 @@ jobs: p12-password: ${{ secrets.APPLE_APPLICATION_CERTIFICATE_PASSWORD }} - name: Import installer certificates + if: matrix.os == 'macos-latest' uses: apple-actions/import-codesign-certs@v3 with: keychain: oscirender @@ -85,32 +68,47 @@ jobs: p12-password: ${{ secrets.APPLE_INSTALLER_CERTIFICATE_PASSWORD }} create-keychain: false - - name: "Run script" + # Windows specific: NuGet setup + - name: Setup NuGet.exe for use with actions + if: matrix.os == 'windows-latest' + uses: NuGet/setup-nuget@v1.0.5 + + - name: NuGet Sources + if: matrix.os == 'windows-latest' + run: nuget sources + + - name: Run build & tests + shell: bash run: | - export OS="mac" source ./ci/setup-env.sh source ./ci/test.sh source ./ci/build.sh "${{ matrix.project }}" "${{ matrix.version }}" - shell: bash + # macOS packaging & notarization - name: Download Packages installer build tool + if: matrix.os == 'macos-latest' run: wget http://s.sudre.free.fr/files/Packages_1211_dev.dmg - name: Mount Packages image + if: matrix.os == 'macos-latest' run: hdiutil attach Packages_1211_dev.dmg - name: Install Packages + if: matrix.os == 'macos-latest' run: sudo installer -pkg /Volumes/Packages\ 1.2.11/Install\ Packages.pkg -target / - - name: Build installer + - name: Build installer (macOS pkg) + if: matrix.os == 'macos-latest' run: packagesbuild --project "packaging/${{ matrix.project }}.pkgproj" - - name: Sign installer + - name: Sign installer (macOS pkg) + if: matrix.os == 'macos-latest' run: | productsign -s "${{ secrets.APPLE_DEVELOPER_ID_INSTALLER }}" "packaging/build/${{ matrix.project }}.pkg" "bin/${{ matrix.project }}-${{ matrix.version }}.pkg" pkgutil --check-signature "bin/${{ matrix.project }}-${{ matrix.version }}.pkg" - - - name: Notarize installer + + - name: Notarize installer (macOS) + if: matrix.os == 'macos-latest' uses: lando/notarize-action@v2 with: product-path: "bin/${{ matrix.project }}-${{ matrix.version }}.pkg" @@ -120,66 +118,30 @@ jobs: primary-bundle-id: com.${{ matrix.project }}.pkg tool: notarytool verbose: true - - - name: Staple installer + + - name: Staple installer (macOS) + if: matrix.os == 'macos-latest' run: xcrun stapler staple "bin/${{ matrix.project }}-${{ matrix.version }}.pkg" - - - name: Check installer + + - name: Check installer (macOS) + if: matrix.os == 'macos-latest' run: spctl -a -vvv -t install "bin/${{ matrix.project }}-${{ matrix.version }}.pkg" - - name: Upload Artifact - uses: actions/upload-artifact@v4 - with: - name: "${{ matrix.project }}-${{ matrix.version }}-macos" - path: bin - retention-days: 7 - build-windows: - name: Build Windows - runs-on: windows-latest - strategy: - matrix: - include: - - project: osci-render - version: free - - project: osci-render - version: premium - - project: sosci - version: premium - steps: - - name: Fix up git URLs - run: echo -e '[url "https://github.com/"]\n insteadOf = "git@github.com:"' >> ~/.gitconfig - shell: bash - - - uses: actions/checkout@v1 - with: - token: ${{ secrets.ACCESS_TOKEN }} - submodules: true - - - name: Setup NuGet.exe for use with actions - uses: NuGet/setup-nuget@v1.0.5 - - - name: NuGet Sources - run: nuget sources - - - name: "Run script" - run: | - export OS="win" - source ./ci/setup-env.sh - source ./ci/test.sh - source ./ci/build.sh "${{ matrix.project }}" "${{ matrix.version }}" - shell: bash - + # Windows packaging (Inno Setup) - name: Compile .ISS to .EXE Installer + if: matrix.os == 'windows-latest' uses: Minionguyjpro/Inno-Setup-Action@v1.2.2 with: path: "packaging/${{ matrix.project }}.iss" - - - name: Move installer to bin + + - name: Move installer to bin (Windows) + if: matrix.os == 'windows-latest' + shell: bash run: mv "packaging/build/${{ matrix.project }}.exe" "bin/${{ matrix.project }}-${{ matrix.version }}.exe" - name: Upload Artifact uses: actions/upload-artifact@v4 with: - name: "${{ matrix.project }}-${{ matrix.version }}-windows" + name: "${{ matrix.project }}-${{ matrix.version }}-${{ env.OS_ARTIFACT }}" path: bin retention-days: 7