ci: cut GitHub Actions cost by scaling the matrices per event #156
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Amalgamate | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| schedule: | |
| - cron: '0 3 * * 1' | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} | |
| cancel-in-progress: true | |
| jobs: | |
| # Which platforms run for this event is defined in tools/ci_matrix.json. | |
| select_matrix: | |
| name: "Select matrix" | |
| runs-on: ubuntu-latest | |
| outputs: | |
| amalgamate: ${{ steps.select.outputs.amalgamate }} | |
| steps: | |
| - name: "Checkout repository" | |
| uses: actions/checkout@v7 | |
| - name: "Select the matrices for ${{ github.event_name }}" | |
| id: select | |
| run: ./tools/select_ci_matrix.sh >> "$GITHUB_OUTPUT" | |
| build: | |
| name: "Amalgamate, ${{ matrix.compiler }}, ${{ matrix.os }}" | |
| needs: select_matrix | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: ${{ fromJSON(needs.select_matrix.outputs.amalgamate) }} | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: "Checkout repository" | |
| uses: actions/checkout@v7 | |
| - name: "Setup Cpp" | |
| uses: aminya/setup-cpp@v1 | |
| with: | |
| compiler: ${{ matrix.compiler }} | |
| vcvarsall: ${{ contains(matrix.os, 'windows' )}} | |
| cmake: true | |
| - name: Amalgamate | |
| run: python ./tools/amalgamate.py | |
| - name: Verify (Compile Split) | |
| shell: bash | |
| env: | |
| MSYS_NO_PATHCONV: 1 | |
| run: | | |
| cat <<EOF > test_split.cpp | |
| #include "ftxui.hpp" | |
| int main() { return 0; } | |
| EOF | |
| if [ "${{ runner.os }}" == "Windows" ]; then | |
| cl /std:c++17 test_split.cpp ftxui.cpp /I. /Fe:test_split /utf-8 /DUNICODE /D_UNICODE /DNOMINMAX | |
| else | |
| ${{ matrix.cxx }} -std=c++17 test_split.cpp ftxui.cpp -I. -o test_split -pthread | |
| fi | |
| - name: Verify (Compile Header-Only) | |
| shell: bash | |
| env: | |
| MSYS_NO_PATHCONV: 1 | |
| run: | | |
| cat <<EOF > test_header_only.cpp | |
| #define FTXUI_IMPLEMENTATION | |
| #include "ftxui_all.hpp" | |
| int main() { return 0; } | |
| EOF | |
| if [ "${{ runner.os }}" == "Windows" ]; then | |
| cl /std:c++17 test_header_only.cpp /I. /Fe:test_header_only /utf-8 /DUNICODE /D_UNICODE /DNOMINMAX | |
| else | |
| ${{ matrix.cxx }} -std=c++17 test_header_only.cpp -I. -o test_header_only -pthread | |
| fi | |
| - name: Upload Amalgamated Files | |
| if: matrix.name == 'Linux GCC' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: ftxui-amalgamated | |
| path: | | |
| ftxui.hpp | |
| ftxui.cpp | |
| ftxui_all.hpp | |
| LICENSE |