Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 38 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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
Expand Down
Loading