Skip to content

Correct YAML syntax #784

Correct YAML syntax

Correct YAML syntax #784

Workflow file for this run

name: Build and Test
on: [push, pull_request]
jobs:
linux0:
if: false
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
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
run: |
sudo apt-mark hold grub-efi-amd64-signed
sudo apt update
sudo apt upgrade
sudo apt install lcov libfuse2 qtbase5-dev qtconnectivity5-dev qttools5-dev qttools5-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
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' || '' }}
run: |
cmake -D CMAKE_BUILD_TYPE=Release -D ENABLE_COVERAGE=${{ matrix.env.coverage }} -S "$GITHUB_WORKSPACE" -B "$RUNNER_TEMP"
cmake --build "$RUNNER_TEMP"
"$RUNNER_TEMP/src/cli/dokit" --version
- name: Test
run: ctest --output-on-failure --test-dir "$RUNNER_TEMP" --verbose --debug
- name: Collate test coverage
if: matrix.env.coverage
run: cmake --build "$RUNNER_TEMP" --target coverage
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: test-results-linux-${{ matrix.env.cc }}
path: |
${{ runner.temp }}/coverage.info
${{ runner.temp }}/removeHtmlDates.sh
${{ runner.temp }}/test/**/*.tap
if-no-files-found: ignore
- 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@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ${{ runner.temp }}/coverage.info
flag-name: linux0-${{ matrix.env.cc }}
parallel: true
- name: Build AppImage
run: cmake --build "$RUNNER_TEMP" --target cli-appimage
- name: Setup artifacts
run: echo "dokitVersion=$(cat "$RUNNER_TEMP/version.txt")" >> $GITHUB_ENV
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: dokit-${{ env.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@v3
with:
name: dokit-${{ env.dokitVersion }}.AppImage
path: ${{ runner.temp }}/dokit-${{ env.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.0' ]
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
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt }}
modules: ${{ startsWith(matrix.qt, '6') && 'qtconnectivity' || '' }}
- 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
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' || '' }}.qt-${{ matrix.qt }}
run: |
cmake -D CMAKE_BUILD_TYPE=Release -D ENABLE_COVERAGE=${{ matrix.env.coverage }} -S "$GITHUB_WORKSPACE" -B "$RUNNER_TEMP"
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
uses: actions/upload-artifact@v3
with:
name: test-results-linux-${{ matrix.env.cc }}-${{ matrix.qt }}
path: |
${{ runner.temp }}/coverage.info
${{ runner.temp }}/test/**/*.tap
if-no-files-found: ignore
- 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@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ${{ runner.temp }}/coverage.info
flag-name: linux-${{ matrix.env.cc }}-${{ matrix.qt }}
parallel: true
- name: Build AppImage
run: cmake --build "$RUNNER_TEMP" --target cli-appimage
- name: Setup artifacts
run: echo "dokitVersion=$(cat "$RUNNER_TEMP/version.txt")" >> $GITHUB_ENV
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: dokit-${{ env.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@v3
with:
name: dokit-${{ env.dokitVersion }}.AppImage
path: ${{ runner.temp }}/dokit-${{ env.dokitVersion }}.AppImage
if-no-files-found: error
mac:
if: false
runs-on: macos-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.0' ]
env:
- { cc: clang, cxx: clang++, coverage: false }
- { cc: gcc-12, cxx: g++-12, coverage: false }
- { cc: gcc-12, cxx: g++-12, coverage: true }
exclude:
# Exclude Qt 5.10 with GCC on macOS. See https://bugreports.qt.io/browse/QTBUG-66585
- { qt: '5.10.1', env: { cc: gcc-12 } }
# Exclude Qt6 with GCC on macOS for now, as GCC (only) has lots of false compiler
# errors, that even if worked-around result in SIGBUS errors in unit tests. See
# https://bugreports.qt.io/browse/QTBUG-107050 (non-exhaustive).
- { qt: '6.2.4', env: { cc: gcc-12 } }
- { qt: '6.3.2', env: { cc: gcc-12 } }
- { qt: '6.4.3', env: { cc: gcc-12 } }
- { qt: '6.5.3', env: { cc: gcc-12 } }
- { qt: '6.6.0', env: { cc: gcc-12 } }
steps:
- uses: actions/checkout@v4
- name: Install lcov
run: brew install lcov
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt }}
modules: ${{ startsWith(matrix.qt, '6') && 'qtconnectivity' || '' }}
- name: Build
env:
CC: ${{ matrix.env.cc }}
CXX: ${{ matrix.env.cxx }}
CMAKE_OSX_ARCHITECTURES: ${{ startsWith(matrix.qt, '6') && 'arm64;' || '' }}x86_64
PROJECT_BUILD_ID: ${{ github.run_number }}.mac.${{ startsWith(matrix.qt, '6') && 'arm64-' || '' }}x86_64.${{ matrix.env.cc }}${{ matrix.env.coverage && '-cov' || '' }}.qt-${{ matrix.qt }}
run: |
cmake -D CMAKE_BUILD_TYPE=Release \
-D CODECOV_GCOV=${{ startsWith(matrix.env.cc, 'gcc') && '/usr/local/bin/gcov-12' || '/usr/bin/gcov'}} \
-D ENABLE_COVERAGE=${{ matrix.env.coverage }} \
-S "$GITHUB_WORKSPACE" -B "$RUNNER_TEMP"
cmake --build "$RUNNER_TEMP" -- VERBOSE=1
find "$RUNNER_TEMP" -name 'Info.plist'
find "$RUNNER_TEMP" -name 'Info.plist' -execdir cat '{}' \;
"$RUNNER_TEMP/src/cli/dokit.app/Contents/MacOS/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
uses: actions/upload-artifact@v3
with:
name: test-results-mac-${{ matrix.env.cc }}-${{ matrix.qt }}
path: |
${{ runner.temp }}/coverage.info
${{ runner.temp }}/test/**/*.tap
if-no-files-found: ignore
- 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@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ${{ runner.temp }}/coverage.info
flag-name: mac-${{ matrix.env.cc }}-${{ matrix.qt }}
parallel: true
- name: Make app bundle
run: macdeployqt "$RUNNER_TEMP/src/cli/dokit.app" -dmg -verbose=2
- name: Setup artifacts
run: echo "dokitVersion=$(cat "$RUNNER_TEMP/version.txt")" >> $GITHUB_ENV
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: dokit-${{ env.dokitVersion }}
path: ${{ runner.temp }}/src/cli/*.app
if-no-files-found: error
win:
runs-on: windows-latest
defaults: { run: { shell: cmd } }
strategy:
fail-fast: false
matrix:
qt: [ '6.6.0' ]
generator: [ 'MinGW Makefiles', 'NMake Makefiles' ]
arch: [ x86-64 ]
include: # Override default arch's for install-qt-action and msvc-dev-cmd.
- { generator: 'MinGW Makefiles', qt: '6.6.0', qtArch: win64_mingw }
- { generator: 'NMake Makefiles', arch: x86-64, msvcArch: amd64 }
# Define the toolchain and dll names per generator (for artifact naming mostly).
- { generator: 'NMake Makefiles', tool: msvc, dll: QtPokit.dll }
- { generator: 'MinGW Makefiles', tool: mingw, dll: libQtPokit.dll }
steps:
- uses: actions/checkout@v4
- name: Install host Qt for cross-compilation
if: matrix.arch == 'arm64'
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt }}
arch: win64_msvc2019_64
set-env: false
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt }}
modules: ${{ startsWith(matrix.qt, '6') && 'qtconnectivity' || '' }}
arch: ${{ matrix.qtArch }}
- name: Configure cross-compilation
if: matrix.arch == 'arm64'
shell: bash
run: |
echo "CMAKE_TOOLCHAIN_FILE=${Qt6_DIR/_64/_arm64/}\lib\cmake\Qt6\qt.toolchain.cmake" >> $GITHUB_ENV
echo "qtHostPath=${Qt6_DIR/_arm64/_64}" >> $GITHUB_ENV
- name: Configure MSVC
if: ${{ contains(matrix.generator, 'nmake') }}
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.msvcArch }}
- name: Build
env:
PROJECT_BUILD_ID: ${{ github.run_number }}.win.${{ matrix.arch }}.${{ matrix.tool }}.qt-${{ matrix.qt }}
run: |
cmake -D CMAKE_BUILD_TYPE=Release -D QT_HOST_PATH=%qtHostPath% -G "${{ matrix.generator }}" -S "%GITHUB_WORKSPACE%" -B "%RUNNER_TEMP%"
cmake --build "%RUNNER_TEMP%" --verbose
- name: Install DLL for tests
run: |
copy /v /b src\lib\${{ matrix.dll }} /b test\unit\cli
copy /v /b src\lib\${{ matrix.dll }} /b test\unit\lib
working-directory: ${{ runner.temp }}
- name: Test # We can't execute arm64 binaries on an x86-64 host.
if: matrix.arch != 'arm64'
run: ctest --output-on-failure --test-dir "%RUNNER_TEMP%" --verbose
- name: Upload test results
if: matrix.arch != 'arm64'
uses: actions/upload-artifact@v3
with:
name: test-results-win-${{ matrix.arch }}-${{ matrix.tool }}-${{ matrix.qt }}
path: ${{ runner.temp }}/test/**/*.tap
if-no-files-found: ignore
- name: Make portable
if: matrix.arch != 'arm64'
run: |
mkdir portable
copy /v /b src\lib\${{ matrix.dll }} /b portable
copy /v /b src\cli\dokit.exe /b portable
cd portable
windeployqt --compiler-runtime --release --verbose 2 dokit.exe ${{ matrix.dll }}
:: dokit.exe --version
working-directory: ${{ runner.temp }}
- name: Setup artifacts
shell: bash
run: echo "dokitVersion=$(cat "$RUNNER_TEMP/version.txt")" >> $GITHUB_ENV
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: dokit-${{ env.dokitVersion }}
path: |
${{ runner.temp }}/src/lib/${{ matrix.dll }}
${{ runner.temp }}/src/cli/dokit.exe
if-no-files-found: error
- name: Upload artifacts (portable)
if: matrix.arch != 'arm64'
uses: actions/upload-artifact@v3
with:
name: dokit-${{ env.dokitVersion }}.portable
path: ${{ runner.temp }}/portable
if-no-files-found: error
collate-test-results:
needs: [ linux0, linux, mac, win ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install lcov
run: |
sudo apt-mark hold grub-efi-amd64-signed
sudo apt update
sudo apt upgrade
sudo apt install lcov
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: ${{ runner.temp }}/artifacts
- name: Generate test summary
uses: pcolby/tap-summary@v1
with:
path: ${{ runner.temp }}/artifacts/**/*.tap
- name: Generate HTML coverage report
run: |
shopt -s globstar
# Update source code paths from macOS tracefiles to match Linux.
sed -i -Ee 's|^SF:/Users|SF:/home|' artifacts/**/coverage.info
# Combine all tracefiles into one.
lcov $(find artifacts -name '*.info' -type f -printf '-a %p\n') -o coverage.info
# Generate the HTML report.
echo 'genhtml_sort = 0' >> ~/.lcovrc
genhtml --output-directory coverage coverage.info
/usr/bin/env bash ./artifacts/test-results-linux-gcc/removeHtmlDates.sh
working-directory: ${{ runner.temp }}
- name: Upload HTML coverage report
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: "${{ runner.temp }}/coverage"
if-no-files-found: error
- name: Report partial-finished to Codacy
if: 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) final
- name: Report parallel-finished to Coveralls
if: github.event_name == 'push' && github.actor != 'dependabot[bot]'
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
update-tests-on-doc-branch:
runs-on: ubuntu-latest
if: success() && (github.ref == 'refs/heads/main')
needs: collate-test-results
steps:
- uses: actions/checkout@v4
with: { ref: doc }
- name: Clear previous coverage report
run: rm -rf main/cov
- name: Download HTML report
uses: actions/download-artifact@v3
with:
name: coverage-report
path: main/cov
- name: Remove build numbers from pre-releases
run: |
shopt -s globstar
sed -i -Ee 's/(headerValue">([0-9]+\.){2}[0-9]+-pre\+)[0-9]+\.?/\1/' main/cov/**/*.html
- name: Inspect changes # for diagnostics only.
run: git status && git diff
- name: Push updates
run: |
[[ -z $(git status --porcelain) ]] || {
git config user.name github-actions
git config user.email [email protected]
git pull
git add .
git commit -m "Update coverage report for ${GITHUB_SHA}"
git push
}