Qt6 GHA #49
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CMake Build Matrix | |
on: | |
push: | |
branches: | |
- '*' | |
pull_request: | |
branches: | |
- master | |
env: | |
QT_VERSION: 6.6.1 | |
CCACHE_VERSION: 3.7.7 | |
CACHE_PARTITION: dev | |
HOST_N_CORES: 2 | |
NINJA_STATUS: "[%f/%t %o/sec] " | |
CCACHE_COMPRESS: "true" | |
CCACHE_COMPRESSLEVEL: "6" | |
CCACHE_MAXSIZE: "250M" | |
CCACHE_SLOPPINESS: "pch_defines,time_macros" | |
CCACHE_HARDLINK: "true" | |
QT_MODULES: "qtbase qtdeclarative qtlocation qtmultimedia qtsensors qtwebchannel" | |
jobs: | |
build: | |
name: ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
name: "Ubuntu Release", artifact: "Linux", | |
os: ubuntu-latest, | |
build_type: Release, | |
} | |
#- { | |
# name: "macOS Release", artifact: "macOS", | |
# os: macos-latest, | |
# build_type: Release, | |
# } | |
#- { | |
# name: "Windows MSVC Conan Release", artifact: "Windows-MSVC", | |
# os: windows-latest, | |
# build_type: Release, | |
# environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat" | |
# } | |
steps: | |
- name: Sparse checkout | |
shell: bash --noprofile --norc -eo pipefail -x {0} | |
run: | | |
REPO="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" | |
BRANCH="${GITHUB_REF/#refs\/heads\//}" | |
# Following code is based on logs of actions/checkout@v2, with sparseCheckout stuff inserted in the middle | |
echo "Syncing repository: $GITHUB_REPOSITORY" | |
echo "Working directory is '$(pwd)' GITHUB_WORKSPACE=$GITHUB_WORKSPACE BRANCH=$BRANCH" | |
git version | |
git init $GITHUB_WORKSPACE | |
git remote add origin https://github.com/$GITHUB_REPOSITORY | |
git config --local gc.auto 0 | |
# Now interesting part | |
git config core.sparseCheckout true | |
# FIXME: hardcode! Cannot use .travis-sparse-checkout yet | |
echo "/*" >> .git/info/sparse-checkout | |
echo "!LayoutTests" >> .git/info/sparse-checkout | |
git -c protocol.version=2 fetch --no-tags --prune --progress --depth=10 origin +${GITHUB_SHA}:refs/remotes/origin/${BRANCH} | |
git checkout --progress --force -B $BRANCH refs/remotes/origin/$BRANCH | |
- name: Download Qt Windows | |
id: qt_win | |
if: runner.os == 'Windows' | |
env: | |
TOOLCHAIN: "win64_msvc2019_64" | |
DIR: "msvc2019_64" | |
shell: bash --noprofile --norc -eo pipefail -x {0} | |
run: | | |
py -m pip install -r Tools/qt/qt-downloader-requirements.txt | |
QT_INSTALL_DIR="/c/Qt" | |
py Tools/qt/qt-downloader windows desktop ${QT_VERSION} ${TOOLCHAIN} --output=${QT_INSTALL_DIR} --qt_modules="${QT_MODULES}" | |
export QTDIR="${QT_INSTALL_DIR}/${QT_VERSION}/${DIR}" | |
ls $QTDIR | |
Tools/qt/license_writer.sh | |
QTWINDIR="C:\\Qt\\${QT_VERSION}\\${DIR}" | |
echo "::set-output name=qt_dir::${QTWINDIR}" | |
- name: Download Qt Mac | |
id: qt_mac | |
if: runner.os == 'macOS' | |
shell: bash --noprofile --norc -eo pipefail -x {0} | |
env: | |
TOOLCHAIN: "clang_64" | |
run: | | |
pip3 install -r Tools/qt/qt-downloader-requirements.txt | |
QT_INSTALL_DIR="${PWD}/Qt" | |
Tools/qt/qt-downloader macos desktop ${QT_VERSION} ${TOOLCHAIN} --output=${QT_INSTALL_DIR} --qt_modules="${QT_MODULES}" | |
export QTDIR="${QT_INSTALL_DIR}/${QT_VERSION}/${TOOLCHAIN}" | |
ls $QTDIR | |
Tools/qt/license_writer.sh | |
echo "::set-output name=qt_dir::${QTDIR}" | |
- name: Download ccache | |
id: ccache | |
shell: cmake -P {0} | |
run: | | |
set(ccache_url "https://github.com/cristianadam/ccache/releases/download/v$ENV{CCACHE_VERSION}/${{ runner.os }}.tar.xz") | |
file(DOWNLOAD "${ccache_url}" ./ccache.tar.xz SHOW_PROGRESS) | |
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./ccache.tar.xz) | |
- name: Prepare ccache timestamp | |
id: ccache_cache_timestamp | |
shell: cmake -P {0} | |
run: | | |
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC) | |
message("::set-output name=timestamp::${current_date}") | |
- name: ccache cache files | |
uses: annulen/cache-action@v2.1.1-custom | |
with: | |
path: .ccache | |
key: ${{ matrix.config.name }}-ccache-${{ env.CACHE_PARTITION }}-${{ steps.ccache_cache_timestamp.outputs.timestamp }} | |
restore-keys: | | |
${{ matrix.config.name }}-ccache-${{ env.CACHE_PARTITION }}- | |
# For Conan | |
- uses: actions/setup-python@v1 | |
if: runner.os == 'Windows' || runner.os == 'macOS' | |
with: | |
python-version: '3.7' | |
- name: Install dependencies (Conan) | |
if: runner.os == 'Windows' || runner.os == 'macOS' | |
shell: bash --noprofile --norc -eo pipefail -x {0} | |
run: | | |
pip3 install conan | |
- name: Install dependencies (Ubuntu) | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update && sudo apt-get install \ | |
ninja-build build-essential bison flex gperf libfontconfig1-dev libgl1-mesa-dev libglib2.0-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev libhyphen-dev libicu-dev libjpeg-dev libpng-dev libqt6opengl6-dev libqt6sensors6-dev libqt6webchannel6-dev libsqlite3-dev libwebp-dev libwoff-dev libxcomposite-dev libxml2-dev libxrender-dev libxslt1-dev mesa-common-dev pkg-config python3 qt6-base-dev qt6-base-private-dev qt6-declarative-private-dev qt6-positioning-dev ruby libqt6sql6-sqlite qt6-base-dev-tools \ | |
libtasn1-6-dev libgcrypt20-dev libunwind-dev libharfbuzz-dev | |
- name: CMake version | |
id: cmake_version | |
shell: bash --noprofile --norc -eo pipefail -x {0} | |
run: | | |
cmake --version | |
- name: CMake environment | |
shell: bash --noprofile --norc -eo pipefail -x {0} | |
run: | | |
echo "$GITHUB_WORKSPACE" >> $GITHUB_PATH | |
echo "CCACHE_BASEDIR=$GITHUB_WORKSPACE" >> $GITHUB_ENV | |
echo "CCACHE_DIR=$GITHUB_WORKSPACE/.ccache" >> $GITHUB_ENV | |
echo "cmake_args='-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DENABLE_PCH=OFF'" >> $GITHUB_ENV | |
- name: Configure (Linux) | |
if: runner.os == 'Linux' | |
shell: bash --noprofile --norc -eo pipefail -x {0} | |
run: cmake $cmake_args -H. -Bbuild -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} | |
- name: Configure (MSVC) | |
if: runner.os == 'Windows' && matrix.config.environment_script != '' | |
shell: cmd | |
run: py Tools\qt\build-qtwebkit-conan.py --configure --cmakeargs="%cmake_args%" --qt="${{ steps.qt_win.outputs.qt_dir }}" || exit /b 1 | |
- name: Configure (macOS/Conan) | |
if: runner.os == 'macOS' | |
shell: bash --noprofile --norc -eo pipefail -x {0} | |
run: Tools/qt/build-qtwebkit-conan.py --configure --cmakeargs="$cmake_args" --qt="${{ steps.qt_mac.outputs.qt_dir }}" | |
# - uses: actions/upload-artifact@v1 | |
# with: | |
# path: build/CMakeCache.txt | |
# name: CMakeCache.txt | |
# | |
# - uses: actions/upload-artifact@v1 | |
# with: | |
# path: build/build.ninja | |
# name: build.ninja | |
# | |
# - uses: actions/upload-artifact@v1 | |
# if: runner.os == 'Windows' || runner.os == 'macOS' | |
# with: | |
# path: build/conanbuildinfo.cmake | |
# name: conanbuildinfo.cmake | |
- name: ccache configuration | |
shell: bash --noprofile --norc -eo pipefail -x {0} | |
run: | | |
ccache -p | |
ccache -z | |
- name: Build (Linux) | |
if: runner.os == 'Linux' | |
shell: bash --noprofile --norc -eo pipefail -x {0} | |
run: ninja -C build -j $HOST_N_CORES -v | |
- name: Build (MSVC/Conan) | |
if: runner.os == 'Windows' && matrix.config.environment_script != '' | |
shell: cmd | |
run: py Tools\qt\build-qtwebkit-conan.py --build --install --ninjaargs="-j %HOST_N_CORES% -v" || exit /b 1 | |
- name: Build (macOS/Conan) | |
if: runner.os == 'macOS' | |
shell: bash --noprofile --norc -eo pipefail -x {0} | |
run: Tools/qt/build-qtwebkit-conan.py --build --install --ninjaargs="-j $HOST_N_CORES -v" | |
# - name: Verify (Linux) | |
# if: runner.os == 'Linux' | |
# shell: bash --noprofile --norc -eo pipefail -x {0} | |
# run: pip3 install jinja2 && Tools/qt/installed-files-checker.py --version 5.212.0 --os linux --template=Tools/qt/QtBinaryChecklist.txt --release --verbose | |
# - name: Verify (Mac) | |
# if: runner.os == 'macOS' | |
# shell: bash --noprofile --norc -eo pipefail -x {0} | |
# run: pip3 install jinja2 && Tools/qt/installed-files-checker.py --version=5.212.0 --os=macos --install_prefix="${{ steps.qt_mac.outputs.qt_dir }}" --template=Tools/qt/QtBinaryChecklist.txt --release --verbose | |
# | |
# - name: Verify (Windows) | |
# if: runner.os == 'Windows' | |
# shell: cmd | |
# run: py -m pip install jinja2 && py Tools\qt\installed-files-checker.py --version=5.212.0 --os=windows --install_prefix="${{ steps.qt_win.outputs.qt_dir }}" --icu_version=65 --toolchain=msvc --template=Tools\qt\QtBinaryChecklist.txt --release --verbose | |
- name: ccache stats | |
if: always() | |
shell: bash --noprofile --norc -eo pipefail -x {0} | |
run: ccache -s |