1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
name: Linux CI
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, edited]
env:
BUILD_TYPE: Debug
QTEST_FUNCTION_TIMEOUT: 60000
jobs:
detect_run:
name: Check changes
outputs: { "source_code_changed": "${{ steps.source_code_changed.outputs.source_code_changed}}" }
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v6
- id: changed_files
uses: tj-actions/changed-files@v47
name: Get changed files
with:
files_ignore: |
docs/**
docker/**
requirements.txt
mkdocs.yml
README.md
.github/**
- id: source_code_changed
name: Check for source code changes
if: steps.changed_files.outputs.any_changed == 'true'
run: |
echo "Detected changed files:"
echo "${{ steps.changed_files.outputs.all_changed_files }}"
echo "source_code_changed=true" >> "$GITHUB_OUTPUT"
generate-matrix:
name: Generate build matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout sources
uses: actions/checkout@v6
- id: set-matrix
name: Generate matrix
run: |
matrix_json=$(python3 ./.github/workflows/generate-matrix.py --platform=linux)
echo "matrix=${matrix_json}" >> "$GITHUB_OUTPUT"
build:
needs: [ generate-matrix, detect_run ]
strategy:
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
fail-fast: false
defaults:
run:
shell: bash -l {0}
runs-on: ${{ matrix.runs_on }}
name: ${{ matrix.platform }}-${{ matrix.compiler_full }}-qt-${{ matrix.qt_version }}
container:
image: ghcr.io/${{ github.repository }}/build-${{ matrix.compiler_full }}-qt-${{ matrix.qt_version }}:main
steps:
- name: Checkout sources
uses: actions/checkout@v6
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' }}
- name: Create Build Environment
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' }}
run: |
cmake -E make_directory build
- name: Configure CMake
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' }}
run: |
QT_VERSION_MAJOR=$(echo ${{ matrix.qt_version }} | cut -d'.' -f1)
EXTRA_CMAKE_FLAGS="${EXTRA_CMAKE_FLAGS} -DBUILD_SHARED_LIBS=ON"
# Disable ASAN for clang-11 - we are hitting some bugs in ASAN & generators
if [[ "${{ matrix.compiler }}" == "clang" && "${{ matrix.compiler_version }}" == "11" ]]; then
EXTRA_CMAKE_FLAGS="${EXTRA_CMAKE_FLAGS} -DQCORO_ENABLE_ASAN=OFF"
fi
cmake -B build \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DUSE_QT_VERSION=$QT_VERSION_MAJOR \
-DQCORO_WITH_QTDBUS=${{ matrix.with_qtdbus }} \
-DQCORO_ENABLE_ASAN=ON \
${EXTRA_CMAKE_FLAGS}
- name: Build
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' }}
run: |
cmake --build build --config $BUILD_TYPE --parallel $(nproc) --verbose
- name: Test
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' }}
run: |
cd build
QT_LOGGING_TO_CONSOLE=1 ctest -C $BUILD_TYPE \
--output-on-failure \
--verbose \
--output-junit ${{ matrix.platform }}-${{ matrix.compiler_full }}-qt-${{ matrix.qt_version }}.xml
- name: Upload Test Results
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' && always() }}
uses: actions/upload-artifact@v5
with:
name: Unit Tests Results (${{ matrix.platform }}-${{ matrix.compiler_full }}-qt-${{ matrix.qt_version }})
path: |
${{ github.workspace }}/build/${{ matrix.platform }}-${{ matrix.compiler_full }}-qt-${{ matrix.qt_version }}.xml
- name: Upload build logs on failure
if: ${{ needs.detect_run.outputs.source_code_changed == 'true' && failure() }}
uses: actions/upload-artifact@v5
with:
name: build-${{ matrix.platform }}-${{ matrix.compiler_full }}-qt-${{ matrix.qt_version }}
path: build/**
event_file:
name: "Event File"
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v5
with:
name: Event File
path: ${{ github.event_path }}
|