diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7fec077f3..cc3c19068 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -3,107 +3,59 @@ name: Build and Test on: [push, pull_request] jobs: - linux0: + linux: runs-on: ubuntu-latest strategy: fail-fast: false matrix: + qt: + - 5 + - 5.9.9 + - 5.10.1 + - 5.11.3 + - 5.12.12 + - 5.13.2 + - 5.14.2 + - 5.15.2 + - 6 + - 6.2.4 + - 6.3.2 + - 6.4.3 + - 6.5.3 + - 6.6.3 env: - { cc: clang, cxx: clang++, coverage: false } - { cc: gcc, cxx: g++, coverage: false } - { cc: gcc, cxx: g++, coverage: true } steps: - - uses: actions/checkout@v4 - - name: Install Qt + - name: Upgrade OS run: | sudo apt-mark hold grub-efi-amd64-signed - sudo apt update - sudo apt upgrade - sudo apt install lcov libfuse2 qt6-base-dev qt6-connectivity-dev qt6-tools-dev qt6-tools-dev-tools - - name: Install linuxdeploy - run: | - curl --create-dirs --location --output-dir /home/runner/.local/bin --remote-name-all \ - 'https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage' \ - 'https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-x86_64.AppImage' \ - 'https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage' - chmod a+x /home/runner/.local/bin/linuxdeploy{,-plugin-{appimage,qt}}-x86_64.AppImage - - name: Build - id: build - env: - CC: ${{ matrix.env.cc }} - CXX: ${{ matrix.env.cxx }} - PROJECT_BUILD_ID: ${{ github.run_number }}.linux.x86-64.${{ matrix.env.cc }}${{ matrix.env.coverage && '-cov' || '' }} + sudo apt update && sudo apt upgrade + sudo apt install lcov libfuse2 + - name: Install Ubuntu's Qt5 + if: matrix.qt == 5 + run: sudo apt install qtbase5{,-doc}-dev qtconnectivity5-{dev,doc-html} qttools5-dev{,-tools} + - name: Install Ubuntu's Qt6 + if: matrix.qt == 6 run: | - cmake -D CMAKE_BUILD_TYPE=Release -D ENABLE_COVERAGE=${{ matrix.env.coverage }} -S "$GITHUB_WORKSPACE" -B "$RUNNER_TEMP" - echo "dokitVersion=$(cat "$RUNNER_TEMP/version.txt")" | tee -a "$GITHUB_OUTPUT" - { echo -n 'tap='; [[ '${{ matrix.qt }}' =~ ^5\.1[2-9]|6 ]] && echo true || echo false; } | tee -a "$GITHUB_OUTPUT" - cmake --build "$RUNNER_TEMP" - "$RUNNER_TEMP/src/cli/dokit" --version - - name: Test - run: ctest --output-on-failure --test-dir "$RUNNER_TEMP" --verbose - - name: Collate test coverage - if: matrix.env.coverage - run: cmake --build "$RUNNER_TEMP" --target coverage - - name: Upload test results - if: matrix.env.coverage || fromJSON(steps.build.outputs.tap) - uses: actions/upload-artifact@v4 - with: - name: test-results-${{ steps.build.outputs.dokitVersion }} - path: | - ${{ runner.temp }}/coverage.info - ${{ runner.temp }}/removeHtmlDates.sh - ${{ runner.temp }}/test/**/*.tap - if-no-files-found: error - - name: Report parallel coverage to Codacy - if: matrix.env.coverage && github.event_name == 'push' && github.actor != 'dependabot[bot]' - env: - CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} - run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report --partial -l CPP -r "${{ runner.temp }}/coverage.info" - - name: Report parallel coverage to Coveralls - if: matrix.env.coverage && github.event_name == 'push' && github.actor != 'dependabot[bot]' - uses: coverallsapp/github-action@v2 - with: - file: ${{ runner.temp }}/coverage.info - format: lcov - flag-name: linux0-${{ matrix.env.cc }} - parallel: true - - name: Build AppImage - run: cmake --build "$RUNNER_TEMP" --target cli-appimage - - name: Upload build artifacts - uses: actions/upload-artifact@v4 - with: - name: dokit-${{ steps.build.outputs.dokitVersion }} - path: | - ${{ runner.temp }}/src/lib/libQtPokit.so - ${{ runner.temp }}/src/cli/dokit - if-no-files-found: error - - name: Upload AppImage - uses: actions/upload-artifact@v4 + # \todo Add the Qt6 doc packages here when GitHub ugrades to Ubuntu 23.x+ + sudo apt install qt6-{base-dev{,-tools},connectivity-dev,l10n-tools,tools-dev{,-tools}} + # \todo Remove this QT_VERSION env var when GitHub ugrades to Ubuntu 23.x+ + echo "QT_VERSION=$(/usr/lib/qt6/bin/qtpaths6 --qt-query QT_VERSION)" | tee "$GITHUB_ENV" + - name: Install Qt docs + # \todo Remove this step when GitHub updates their Ubuntu image. This is only required for Ubuntu 22.04, since + # that release is missing the Qt6 documentation packages. Can also remove the above QT_VERSION env var then too. + if: matrix.qt == 6 + uses: jurplel/install-qt-action@v3 with: - name: dokit-${{ steps.build.outputs.dokitVersion }}.AppImage - path: ${{ runner.temp }}/dokit-${{ steps.build.outputs.dokitVersion }}.AppImage - if-no-files-found: error - - linux: - if: false - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - qt: [ '5.9.9', '5.10.1', '5.11.3', '5.12.12', '5.13.2', '5.14.2', '5.15.2', '6.2.4', '6.3.2', '6.4.3', '6.5.3', '6.6.3' ] - env: - - { cc: clang, cxx: clang++, coverage: false } - - { cc: gcc, cxx: g++, coverage: false } - - { cc: gcc, cxx: g++, coverage: true } - steps: - - uses: actions/checkout@v4 - - name: Install Tools - run: | - sudo apt-mark hold grub-efi-amd64-signed - sudo apt update - sudo apt upgrade - sudo apt install clang lcov libfuse2 - - name: Install Qt + version: ${{ env.QT_VERSION }} + no-qt-binaries: true + documentation: true + doc-archives: 'qtcore' + doc-modules: 'qtbluetooth' + - name: Install online Qt version + if: contains(matrix.qt, '.') # ie if not using Ubuntu's Qt5/Qt6. uses: jurplel/install-qt-action@v3 with: version: ${{ matrix.qt }} @@ -119,6 +71,7 @@ jobs: 'https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-x86_64.AppImage' \ 'https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage' chmod a+x /home/runner/.local/bin/linuxdeploy{,-plugin-{appimage,qt}}-x86_64.AppImage + - uses: actions/checkout@v4 - name: Build id: build env: @@ -126,9 +79,10 @@ jobs: CXX: ${{ matrix.env.cxx }} PROJECT_BUILD_ID: ${{ github.run_number }}.linux.x86-64.${{ matrix.env.cc }}${{ matrix.env.coverage && '-cov' || '' }}.qt-${{ matrix.qt }} run: | + [[ '${{ matrix.qt }}' == '5' ]] || qtInstallDocs="$RUNNER_WORKSPACE/Qt/Docs/Qt-${QT_VERSION:-${{ matrix.qt }}}" cmake -D CMAKE_BUILD_TYPE=Release \ -D ENABLE_COVERAGE=${{ matrix.env.coverage }} \ - -D QT_INSTALL_DOCS="$RUNNER_WORKSPACE/Qt/Docs/Qt-${{ matrix.qt }}" \ + ${qtInstallDocs:+-D "QT_INSTALL_DOCS=$qtInstallDocs"} \ -S "$GITHUB_WORKSPACE" -B "$RUNNER_TEMP" echo "dokitVersion=$(cat "$RUNNER_TEMP/version.txt")" | tee -a "$GITHUB_OUTPUT" { echo -n 'tap='; [[ '${{ matrix.qt }}' =~ ^5\.1[2-9]|6 ]] && echo true || echo false; } | tee -a "$GITHUB_OUTPUT" @@ -180,7 +134,6 @@ jobs: if-no-files-found: error mac: - if: false runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -290,7 +243,6 @@ jobs: if-no-files-found: error win: - if: false runs-on: windows-latest defaults: { run: { shell: cmd } } strategy: @@ -451,7 +403,7 @@ jobs: if-no-files-found: error collate-test-results: - needs: [ linux0, linux, mac, win ] + needs: [ linux, mac, win ] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -479,8 +431,8 @@ jobs: # Generate the HTML report. echo 'genhtml_sort = 0' >> ~/.lcovrc genhtml --output-directory coverage coverage.info - # Can use any of the removeHtmlDates.sh scripts here, so the linux0 job's version will do. - /usr/bin/env bash ./artifacts/test-results-*-cov/removeHtmlDates.sh + # Can use any of the removeHtmlDates.sh scripts here, so the Ubuntu GCC Qt6 job's version will do. + /usr/bin/env bash ./artifacts/test-results-*-cov.qt-6/removeHtmlDates.sh # Remove build numbers from pre-releases, and remove extra build info (such as ".linux.x86-64.gcc-cov") # from all releases, since this coverage report is an aggregation of many build hosts. sed -i -Ee 's/(headerValue">([0-9]+\.){2}[0-9]+)(((-pre)\+[0-9]+)|(\+[0-9]+))\..*