|
| 1 | +name: build-rgfw-modular |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + push: |
| 5 | + branches: [bleeding, master] |
| 6 | + paths-ignore: ['**/*.md'] |
| 7 | + pull_request: |
| 8 | + paths-ignore: ['**/*.md'] |
| 9 | +concurrency: |
| 10 | + group: ${{ github.workflow }}-${{ startsWith(github.ref, 'refs/tags/') && github.run_id || github.event.pull_request.number || github.ref }} |
| 11 | + cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/') }} |
| 12 | +permissions: |
| 13 | + contents: write |
| 14 | + actions: read |
| 15 | +jobs: |
| 16 | + pre-check: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + outputs: |
| 19 | + build_needed: ${{ steps.plan.outputs.build_needed }} |
| 20 | + matrix: ${{ steps.plan.outputs.matrix }} |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v7.0.1 |
| 23 | + with: |
| 24 | + fetch-depth: 0 |
| 25 | + - uses: actions/github-script@v9.0.0 |
| 26 | + id: plan |
| 27 | + with: |
| 28 | + script: | |
| 29 | + await require(`${process.env.GITHUB_WORKSPACE}/scripts/release-build-plan.cjs`).plan({github, context, core, workflow: '.github/workflows/build-rgfw-modular.yml', job: 'build'}); |
| 30 | + - uses: actions/upload-artifact@v7.0.0 |
| 31 | + with: |
| 32 | + name: build-plan-${{ github.workflow }} |
| 33 | + path: .build-plans/*.pkl |
| 34 | + include-hidden-files: true |
| 35 | + if-no-files-found: error |
| 36 | + build: |
| 37 | + needs: pre-check |
| 38 | + if: needs.pre-check.outputs.build_needed == 'true' |
| 39 | + name: RGFW - ${{ matrix.target }} - ${{ matrix.arch }} |
| 40 | + runs-on: ${{ matrix.runner }} |
| 41 | + strategy: |
| 42 | + fail-fast: false |
| 43 | + matrix: ${{ fromJSON(needs.pre-check.outputs.matrix) }} |
| 44 | + defaults: |
| 45 | + run: |
| 46 | + shell: bash |
| 47 | + env: |
| 48 | + TARGET: ${{ matrix.target }} |
| 49 | + TYPE: ${{ matrix.target }} |
| 50 | + ARCH: ${{ matrix.arch }} |
| 51 | + OPTIONAL_ARCHS: ${{ matrix.archs }} |
| 52 | + VS_VER: ${{ matrix.vs }} |
| 53 | + EMSDK_VERSION: ${{ matrix.emsdk }} |
| 54 | + PACKAGE_LIBS: rgfw |
| 55 | + FORMULAS_OVERRIDE: rgfw |
| 56 | + ALWAYS_BUILD: 1 |
| 57 | + NO_FORCE: 1 |
| 58 | + steps: |
| 59 | + - uses: msys2/setup-msys2@v2.32.0 |
| 60 | + if: matrix.target == 'vs' || matrix.target == 'msys2' |
| 61 | + with: |
| 62 | + release: ${{ matrix.flavor == 'clangarm64' }} |
| 63 | + update: true |
| 64 | + msystem: ${{ matrix.target == 'msys2' && matrix.flavor || 'MINGW64' }} |
| 65 | + install: base-devel git curl unzip |
| 66 | + pacboy: cmake:p ninja:p gcc:p |
| 67 | + - uses: actions/checkout@v7.0.1 |
| 68 | + - name: Set up macOS build tools |
| 69 | + if: matrix.target == 'osx' |
| 70 | + run: bash scripts/apple-install-tools.sh cmake coreutils bash |
| 71 | + - name: Set up Emscripten |
| 72 | + if: matrix.target == 'emscripten' |
| 73 | + run: source scripts/emscripten/setup.sh |
| 74 | + - name: Restore compatible binary artifacts |
| 75 | + id: baseline |
| 76 | + continue-on-error: true |
| 77 | + uses: ./.github/actions/platform-artifacts |
| 78 | + with: |
| 79 | + phase: restore |
| 80 | + variant: rgfw-${{ matrix.target }}-${{ matrix.arch }} |
| 81 | + archs: ${{ matrix.archs }} |
| 82 | + shell: ${{ (matrix.target == 'vs' || matrix.target == 'msys2') && 'msys2 {0}' || 'bash' }} |
| 83 | + - name: Build and package RGFW (Windows) |
| 84 | + if: matrix.target == 'vs' || matrix.target == 'msys2' |
| 85 | + shell: msys2 {0} |
| 86 | + run: bash scripts/build-modular-optional.sh |
| 87 | + - name: Build and package RGFW (macOS / Emscripten) |
| 88 | + if: matrix.target != 'vs' && matrix.target != 'msys2' |
| 89 | + run: | |
| 90 | + if [ "$TYPE" = emscripten ]; then source "$EMSDK/emsdk_env.sh"; fi |
| 91 | + bash scripts/build-modular-optional.sh |
| 92 | + - name: Save compatible binary artifacts |
| 93 | + if: github.event_name == 'push' && steps.baseline.outcome == 'success' |
| 94 | + continue-on-error: true |
| 95 | + uses: ./.github/actions/platform-artifacts |
| 96 | + with: |
| 97 | + phase: save |
| 98 | + variant: rgfw-${{ matrix.target }}-${{ matrix.arch }} |
| 99 | + archs: ${{ matrix.archs }} |
| 100 | + shell: ${{ (matrix.target == 'vs' || matrix.target == 'msys2') && 'msys2 {0}' || 'bash' }} |
| 101 | + - name: Upload PR packages for inspection |
| 102 | + if: github.event_name == 'pull_request' |
| 103 | + uses: actions/upload-artifact@v7.0.0 |
| 104 | + with: |
| 105 | + name: rgfw-${{ matrix.target }}-${{ matrix.arch }} |
| 106 | + path: | |
| 107 | + out/oF_rgfw_*.zip |
| 108 | + out/oF_rgfw_*.tar.bz2 |
| 109 | + xout/oF_rgfw_*.tar.bz2 |
| 110 | + if-no-files-found: error |
| 111 | + - name: Publish modular archives |
| 112 | + if: github.repository == 'openframeworks/apothecary' && github.event_name == 'push' |
| 113 | + uses: softprops/action-gh-release@v3.0.3 |
| 114 | + with: |
| 115 | + token: ${{ secrets.PAT_TOKEN || secrets.GITHUB_TOKEN }} |
| 116 | + tag_name: latest-modular |
| 117 | + fail_on_unmatched_files: false |
| 118 | + files: | |
| 119 | + out/oF_rgfw_*.zip |
| 120 | + out/oF_rgfw_*.tar.bz2 |
| 121 | + xout/oF_rgfw_*.tar.bz2 |
| 122 | + - name: Download build plans |
| 123 | + if: github.repository == 'openframeworks/apothecary' && github.event_name == 'push' |
| 124 | + uses: actions/download-artifact@v8 |
| 125 | + with: |
| 126 | + name: build-plan-${{ github.workflow }} |
| 127 | + path: ${{ runner.temp }}/build-plans |
| 128 | + - name: Record verified release metadata |
| 129 | + if: github.repository == 'openframeworks/apothecary' && github.event_name == 'push' |
| 130 | + uses: actions/github-script@v9.0.0 |
| 131 | + env: |
| 132 | + BUILD_PLAN_MATRIX: ${{ toJSON(matrix) }} |
| 133 | + with: |
| 134 | + github-token: ${{ secrets.PAT_TOKEN || secrets.GITHUB_TOKEN }} |
| 135 | + script: | |
| 136 | + await require(`${process.env.GITHUB_WORKSPACE}/scripts/release-build-plan.cjs`).record({github, context, core, workflow: '.github/workflows/build-rgfw-modular.yml', job: 'build', matrix: JSON.parse(process.env.BUILD_PLAN_MATRIX)}); |
0 commit comments