diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 30429663..23a10944 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,6 +3,12 @@ name: build on: workflow_call: inputs: + arch: + type: string + default: 'all' + compiler: + type: string + default: 'all' coverage: type: boolean default: false @@ -15,6 +21,20 @@ on: workflow_dispatch: inputs: + arch: + type: choice + options: + - all + - amd64 + - arm64 + default: 'all' + compiler: + type: choice + options: + - all + - gcc + - clang + default: 'all' coverage: type: boolean default: false @@ -41,7 +61,12 @@ jobs: exclude-regex: 'build' build: - runs-on: ubuntu-latest + strategy: + matrix: + arch: ${{ inputs.arch == 'all' && fromJson('["amd64", "arm64"]') || fromJson(format('["{0}"]', inputs.arch)) }} + compiler: ${{ inputs.compiler == 'all' && fromJson('["gcc", "clang"]') || fromJson(format('["{0}"]', inputs.compiler)) }} + + runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-24.04' || 'ubuntu-24.04-arm' }} container: image: joinframework/join-ci:latest @@ -66,60 +91,60 @@ jobs: run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - name: Initialize codeql - if: inputs.scan + if: inputs.scan && matrix.arch == 'amd64' uses: github/codeql-action/init@v3 - name: Configure if: inputs.scan || inputs.coverage - run: cmake --preset gcc-debug + run: cmake --preset ${{ matrix.compiler }}-debug - name: Build if: inputs.scan || inputs.coverage - run: cmake --build --preset gcc-debug + run: cmake --build --preset ${{ matrix.compiler }}-debug - name: Run codeql scan - if: inputs.scan + if: inputs.scan && matrix.arch == 'amd64' uses: github/codeql-action/analyze@v3 - name: Run tests if: inputs.coverage - run: ctest --preset gcc-debug + run: ctest --preset ${{ matrix.compiler }}-debug - name: Generate coverage report if: inputs.coverage run: | - lcov --directory build/gcc/debug --capture --exclude "*/usr/include/*" --exclude '*/tests/*' --output-file lcov.info + lcov --directory build/${{ matrix.compiler }}/debug --capture --exclude "*/usr/include/*" --exclude '*/tests/*' --output-file lcov.info genhtml lcov.info --prefix $GITHUB_WORKSPACE --output-directory coverage - name: Upload coverage data to GitHub if: inputs.coverage uses: actions/upload-artifact@v4 with: - name: coverage-data + name: ${{ matrix.compiler }}-${{ matrix.arch }}-coverage-data path: lcov.info - name: Upload coverage report to GitHub if: inputs.coverage uses: actions/upload-artifact@v4 with: - name: coverage-report + name: ${{ matrix.compiler }}-${{ matrix.arch }}-coverage-report path: coverage/ - name: Run doxygen - if: inputs.doc + if: inputs.doc && matrix.compiler == 'gcc' && matrix.arch == 'amd64' uses: mattnotmitt/doxygen-action@v1 with: doxyfile-path: ./doxyfile working-directory: . - name: Upload documentation to GitHub - if: inputs.doc + if: inputs.doc && matrix.compiler == 'gcc' && matrix.arch == 'amd64' uses: actions/upload-pages-artifact@v3 with: path: ./doc/html deploy-coverage: - if: inputs.coverage + if: inputs.coverage && (inputs.compiler == 'all' || inputs.compiler == 'gcc') && (inputs.arch == 'all' || inputs.arch == 'amd64') runs-on: ubuntu-latest @@ -138,7 +163,7 @@ jobs: - name: Download coverage data from GitHub uses: actions/download-artifact@v4 with: - name: coverage-data + name: gcc-amd64-coverage-data path: ./ - name: Deploy coverage report to coveralls