diff --git a/.github/workflows/build-matrix.yml b/.github/workflows/build-matrix.yml new file mode 100644 index 00000000..cfeb4cdd --- /dev/null +++ b/.github/workflows/build-matrix.yml @@ -0,0 +1,78 @@ +name: 🔢 Build Matrix + +on: + workflow_call: + workflow_dispatch: + +jobs: + build-matrix: + name: ${{ matrix.name }} + runs-on: ${{ matrix.os }} + permissions: + contents: read + strategy: + fail-fast: false + matrix: + include: + - identifier: windows-debug + os: windows-latest + name: 🏁 Windows Debug + target: template_debug + platform: windows + arch: x86_64 + test-bin-suffix: .md.exe + + - identifier: windows-release + os: windows-latest + name: 🏁 Windows Release + target: template_release + platform: windows + arch: x86_64 + test-bin-suffix: .md.exe + + - identifier: macos-debug + os: macos-latest + name: 🍎 macOS (universal) Debug + target: template_debug + platform: macos + arch: universal + + - identifier: macos-release + os: macos-latest + name: 🍎 macOS (universal) Release + target: template_release + platform: macos + arch: universal + + - identifier: linux-debug + os: ubuntu-22.04 + name: 🐧 Linux Debug + target: template_debug + platform: linux + arch: x86_64 + + - identifier: linux-release + os: ubuntu-22.04 + name: 🐧 Linux Release + target: template_release + platform: linux + arch: x86_64 + + steps: + - name: Checkout project + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + submodules: recursive + persist-credentials: false + + - name: Build + uses: ./.github/actions/openvic-sim-build + with: + identifier: ${{ matrix.identifier }} + target: ${{ matrix.target }} + platform: ${{ matrix.platform }} + arch: ${{ matrix.arch }} + + - name: Run tests + run: | + ./tests/bin/openvic-simulation.tests.${{ matrix.platform }}.${{ matrix.target }}.${{ matrix.arch }}${{ matrix.test-bin-suffix || '' }} \ No newline at end of file diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index b4ad9c73..e007f28d 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -3,39 +3,7 @@ name: 🖥️ Builds on: push: branches: ['master'] - paths: - - '.github/workflows/builds.yml' - - '.github/actions/openvic-sim-build/action.yml' - - '**/{SConstruct,SCsub,*.py}' - - '**/*.{hpp,cpp,inc}' - - 'scripts' - - 'deps/**' - - 'tests/**' - - 'AUTHORS.md' - - 'COPYRIGHT' - - 'LICENSE.md' - - '.pre-commit-config.yaml' - - 'pyproject.toml' - - '.clang-format' - - '.clang-tidy' - - '.gitmodules' pull_request: - paths: - - '.github/workflows/builds.yml' - - '.github/actions/openvic-sim-build/action.yml' - - '**/{SConstruct,SCsub,*.py}' - - '**/*.{hpp,cpp,inc}' - - 'scripts' - - 'deps/**' - - 'tests/**' - - 'AUTHORS.md' - - 'COPYRIGHT' - - 'LICENSE.md' - - '.pre-commit-config.yaml' - - 'pyproject.toml' - - '.clang-format' - - '.clang-tidy' - - '.gitmodules' merge_group: workflow_dispatch: @@ -83,78 +51,12 @@ jobs: extra-args: --files ${{ env.CHANGED_FILES }} build-master: - name: ${{ matrix.name }} - runs-on: ${{ matrix.os }} + name: Build needs: static-checks-builds if: needs.static-checks-builds.outputs.sources-changed == 'true' || github.event_name != 'pull_request' permissions: contents: read - strategy: - fail-fast: false - matrix: - include: - - identifier: windows-debug - os: windows-latest - name: 🏁 Windows Debug - target: template_debug - platform: windows - arch: x86_64 - test-bin-suffix: .md.exe - - - identifier: windows-release - os: windows-latest - name: 🏁 Windows Release - target: template_release - platform: windows - arch: x86_64 - test-bin-suffix: .md.exe - - - identifier: macos-debug - os: macos-latest - name: 🍎 macOS (universal) Debug - target: template_debug - platform: macos - arch: universal - - - identifier: macos-release - os: macos-latest - name: 🍎 macOS (universal) Release - target: template_release - platform: macos - arch: universal - - - identifier: linux-debug - os: ubuntu-22.04 - name: 🐧 Linux Debug - target: template_debug - platform: linux - arch: x86_64 - - - identifier: linux-release - os: ubuntu-22.04 - name: 🐧 Linux Release - target: template_release - platform: linux - arch: x86_64 - - steps: - - name: Checkout project - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - submodules: recursive - persist-credentials: false - - - name: Build - uses: ./.github/actions/openvic-sim-build - with: - identifier: ${{ matrix.identifier }} - target: ${{ matrix.target }} - platform: ${{ matrix.platform }} - arch: ${{ matrix.arch }} - - - name: Run tests - run: | - ./tests/bin/openvic-simulation.tests.${{ matrix.platform }}.${{ matrix.target }}.${{ matrix.arch }}${{ matrix.test-bin-suffix || '' }} + uses: ./.github/workflows/build-matrix.yml merge-library-files: name: 📚 Merge Library Files