Make color sliders adhere to chosen color space #849
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: Build and Test | |
on: | |
pull_request: | |
push: | |
branches: | |
- '**' | |
tags-ignore: | |
# This tag is (re)created when a build on main succeeds, it'd be | |
# pointless to trigger yet another build in response to it. | |
- continuous | |
schedule: | |
# Every Monday and Thursday at 11:18 AM. | |
- cron: '18 11 * * 1,4' | |
env: | |
CARGO_TERM_COLOR: always | |
CMAKE_COLOR_DIAGNOSTICS: ON | |
CLICOLOR_FORCE: 1 | |
jobs: | |
test: | |
name: Qt ${{ matrix.qt }} on ${{ matrix.os }}${{ matrix.cross_os && format(' ({0})', matrix.cross_os) }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-20.04 | |
- macos-latest | |
- windows-latest | |
qt: [ 5.15.8, 6.4.2 ] | |
cross_os: [ '', Android ] | |
exclude: | |
- os: windows-latest | |
cross_os: Android | |
- os: macos-latest | |
cross_os: Android | |
include: | |
# Linux common | |
- os: ubuntu-20.04 | |
sccache_triplet: x86_64-unknown-linux-musl | |
# The runner has multiple clang versions installed and CMake/Qt gets | |
# confused about which one to pick for some reason, so this also | |
# sets Clang_ROOT during the Qt build | |
qt_pre_build: > | |
sudo apt-get update && | |
sudo apt-get install --no-install-recommends | |
libatspi2.0-dev libmtdev-dev libts-dev libgtk-3-dev | |
libgl1-mesa-dev libglu1-mesa-dev libxi-dev libdrm-dev | |
libgbm-dev libgl-dev libgles-dev libegl-dev libegl1-mesa-dev | |
libxext-dev libxfixes-dev libxrender-dev libx11-dev | |
libxcb1-dev libx11-xcb-dev libxcb-glx0-dev libxcb-util0-dev | |
libxkbcommon-dev libxkbcommon-x11-dev libxcb-keysyms1-dev | |
libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev | |
libxcb-sync-dev libxcb-xfixes0-dev libxcb-shape0-dev | |
libxcb-randr0-dev libxcb-render0-dev libxcb-render-util0-dev | |
libxcb-util-dev libinput-dev libvulkan-dev | |
libxcb-xinerama0-dev libxcb-xkb-dev libxcb-xinput-dev libclang-12-dev | |
libasound2-dev libpulse-dev libcups2-dev libssl-dev | |
libfontconfig1-dev && | |
echo "Clang_ROOT=/usr/lib/llvm-12" >> $GITHUB_ENV | |
other_pre_build: > | |
sudo apt-get update && | |
sudo apt-get install --no-install-recommends | |
libsecret-1-dev | |
# Linux non-cross-compile | |
- os: ubuntu-20.04 | |
cross_os: | |
build_flags: -DINITSYS=systemd | |
# Linux Qt 5 (release) | |
- os: ubuntu-20.04 | |
cross_os: | |
qt: 5.15.8 | |
# This causes the AppImage to be generated, instead of just creating | |
# the portable tree, because there seems to be no way to separate | |
# these steps with linuxdeploy | |
# Even though the svg component is linked explicitly, | |
# linuxdeploy-plugin-qt does not seem to notice and so does not | |
# export the iconengine if it is not told that we really, really | |
# want svg plugins please | |
packager: >- | |
EXTRA_QT_PLUGINS="svg;" | |
VERSION="${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || '$(git describe)' }}" | |
cmake --install build --config Release | |
# Android common | |
- os: ubuntu-20.04 | |
cross_os: Android | |
cross_qt_args: >- | |
"-DANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" | |
"-DANDROID_NDK_ROOT=$ANDROID_NDK_ROOT" | |
"-DANDROID_HOST_PATH=$GITHUB_WORKSPACE/.github/deps/qt" | |
# Android Qt 6 | |
- os: ubuntu-20.04 | |
cross_os: Android | |
qt: 6.4.2 | |
cross_other_args: >- | |
"-DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/.github/cross-deps/qt/lib/cmake/Qt6/qt.toolchain.cmake" | |
build_flags: >- | |
"-DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/.github/cross-deps/qt/lib/cmake/Qt6/qt.toolchain.cmake" | |
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=on | |
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH | |
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH | |
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=BOTH | |
# Android Qt 5 (release) | |
- os: ubuntu-20.04 | |
cross_os: Android | |
qt: 5.15.8 | |
cross_other_args: >- | |
"-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake" | |
-DANDROID_PLATFORM=android-23 | |
-DANDROID_ABI=arm64-v8a | |
build_flags: >- | |
"-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake" | |
-DANDROID_PLATFORM=android-23 | |
-DANDROID_ABI=arm64-v8a | |
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=on | |
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH | |
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH | |
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=BOTH | |
packager: cmake --install build --config Release --prefix . | |
# macOS common | |
- os: macos-latest | |
sccache_triplet: x86_64-apple-darwin | |
# macOS Qt 5 (release) | |
- os: macos-latest | |
qt: 5.15.8 | |
packager: cpack --verbose --config build/CPackConfig.cmake -C Release | |
# Windows common | |
- os: windows-latest | |
sccache_triplet: x86_64-pc-windows-msvc | |
other_args: >- | |
"-DCMAKE_VS_MSBUILD_COMMAND=$( | |
vswhere -latest -requires Microsoft.Component.MSBuild | |
-find MSBuild\\**\\Bin\\amd64\\MSBuild.exe | select-object -first 1 | |
)" | |
build_flags: -G Ninja | |
# Windows Qt 5 (release) | |
- os: windows-latest | |
qt: 5.15.8 | |
qt_pre_build: > | |
choco install gperf jom winflexbison3 && | |
New-Item -Path C:\ProgramData\Chocolatey\bin\flex.exe -ItemType SymbolicLink -Value C:\ProgramData\Chocolatey\bin\win_flex.exe && | |
New-Item -Path C:\ProgramData\Chocolatey\bin\bison.exe -ItemType SymbolicLink -Value C:\ProgramData\Chocolatey\bin\win_bison.exe | |
# Copying files is a disgusting hack because windeployqt does not | |
# search PATH to find DLLs and it gets confused by QtKeychain having | |
# a Qt prefix and thinks it is part of Qt and tries to process it | |
# and fails if it is not in the Qt bin directory with the rest of | |
# them | |
packager: > | |
cp .github/deps/other/bin/qt*.dll .github/deps/qt/bin && | |
cpack --verbose --config build/CPackConfig.cmake -C Release | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # for git-describe | |
submodules: true | |
- name: Activate MSVC | |
uses: ilammy/msvc-dev-cmd@v1 | |
if: runner.os == 'Windows' | |
- name: Work around QTBUG-112465 | |
run: | | |
# Moving directories is faster than deleting everything inside them | |
mv ${ANDROID_SDK_ROOT}/platforms/{android-*-*,..} | |
ls "${ANDROID_SDK_ROOT}/platforms" | |
shell: bash | |
if: matrix.cross_os == 'Android' | |
- name: Configure Linux system dependencies | |
uses: ./.github/actions/restore-linux | |
if: runner.os == 'Linux' | |
# This is intended to allow the cross-compile and non-cross-compile | |
# workers to reuse the same host build dependencies, since Qt6 needs these | |
- name: Build dependencies | |
uses: ./.github/actions/build-deps | |
id: deps | |
with: | |
path: .github/deps | |
qt: ${{ matrix.qt }} | |
qt_pre_build: ${{ matrix.qt_pre_build }} | |
qt_args: ${{ matrix.qt_args }} | |
other_pre_build: ${{ matrix.other_pre_build }} | |
other_args: ${{ matrix.other_args }} | |
- name: Build cross-compiler dependencies | |
uses: ./.github/actions/build-deps | |
id: cross-deps | |
with: | |
cache_key: ${{ runner.os }}+${{ matrix.cross_os }} | |
path: .github/cross-deps | |
qt: ${{ matrix.qt }} | |
qt_pre_build: ${{ matrix.cross_qt_pre_build }} | |
qt_args: ${{ matrix.cross_qt_args }} | |
other_pre_build: ${{ matrix.cross_other_pre_build }} | |
other_args: ${{ matrix.cross_other_args }} | |
if: matrix.cross_os | |
- name: Set up compiler cache | |
uses: ./.github/actions/pre-sccache | |
id: sccache | |
with: | |
triplet: ${{ matrix.sccache_triplet }} | |
cache_key: ${{ runner.os }}${{ matrix.cross_os && format('+{0}', matrix.cross_os) }}-${{ matrix.qt }} | |
- name: Cache gradle | |
uses: actions/cache@v3 | |
with: | |
# The zip file is unnecessary but the .zip.ok file is needed or it | |
# will blow away the installation and redownload everything | |
path: |- | |
~/.gradle/wrapper/dists/gradle-*/*/gradle-* | |
!~/.gradle/wrapper/dists/gradle-*/*/gradle-*.zip | |
key: gradle-${{ runner.os }}+${{ matrix.cross_os }}-${{ matrix.qt }} | |
if: matrix.cross_os == 'Android' | |
- name: Generate project | |
run: > | |
cmake -S . -B build --log-level=VERBOSE | |
-DCMAKE_BUILD_TYPE=Release | |
-DCMAKE_C_COMPILER_LAUNCHER=sccache | |
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache | |
-DCMAKE_OBJC_COMPILER_LAUNCHER=sccache | |
-DCMAKE_OBJCXX_COMPILER_LAUNCHER=sccache | |
-DCLIENT=on | |
-DSERVER=on | |
-DSERVERGUI=on | |
-DTOOLS=on | |
-DTESTS=on | |
-DUSE_GENERATORS=off | |
"-DCMAKE_PREFIX_PATH=${{ matrix.cross_os && format('{0};', steps.cross-deps.outputs.path) }}${{ steps.deps.outputs.path }}" | |
-DCMAKE_INSTALL_PREFIX=out | |
-DCLANG_TIDY=${{ github.event_name != 'push' && 'on' || 'off' }} | |
-DDIST_BUILD=${{ matrix.packager && 'on' }} | |
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=${{ | |
matrix.packager | |
&& startsWith(github.ref, 'refs/tags/') | |
&& 'on' | |
}} | |
-DBUILD_VERSION='${{ | |
matrix.packager | |
&& startsWith(github.ref, 'refs/tags/') | |
&& github.ref_name | |
}}' | |
${{ matrix.build_flags }} | |
- name: Prepare APK signing | |
run: | | |
if [ -n "$ANDROID_KEYSTORE" ] && [ -n "$ANDROID_KEYSTORE_PASS" ]; then | |
keystore_path="$GITHUB_WORKSPACE/drawpile.keystore" | |
echo "$ANDROID_KEYSTORE" | base64 -d > "$keystore_path" | |
echo QT_ANDROID_KEYSTORE_PATH="$keystore_path" >> "$GITHUB_ENV" | |
fi | |
env: | |
ANDROID_KEYSTORE: ${{ secrets.ANDROID_KEYSTORE }} | |
ANDROID_KEYSTORE_PASS: ${{ secrets.ANDROID_KEYSTORE_PASS }} | |
if: matrix.cross_os == 'Android' && matrix.packager | |
- name: Build project | |
run: cmake --build build --parallel $(nproc || sysctl -n hw.ncpu || echo 2) --config Release | |
env: | |
RUSTC_WRAPPER: sccache | |
SCCACHE_CACHE_SIZE: 200M | |
SCCACHE_DIR: ${{ steps.sccache.outputs.path }}/cache | |
QT_ANDROID_KEYSTORE_ALIAS: drawpile | |
QT_ANDROID_KEYSTORE_STORE_PASS: ${{ secrets.ANDROID_KEYSTORE_PASS }} | |
- name: Run C++ tests | |
run: ctest -C Release --output-on-failure | |
working-directory: build | |
if: '!matrix.cross_os' | |
- name: Run packaging | |
run: ${{ matrix.packager }} | |
if: matrix.packager | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
if: matrix.packager | |
with: | |
name: Drawpile-${{ matrix.cross_os || runner.os }}-Qt${{ matrix.qt }} | |
path: | | |
Drawpile-*.AppImage | |
Drawpile-*.apk | |
Drawpile-*.dmg | |
Drawpile-*.msi | |
Drawpile-*.zip | |
- name: Upload error logs and artefacts | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: ${{ matrix.cross_os || runner.os }} error logs and artefacts | |
path: | | |
**/*.log | |
**/*.wxs | |
- name: Save sccache | |
uses: ./.github/actions/post-sccache | |
with: | |
cache-hit: ${{ steps.sccache.outputs.cache-hit }} | |
cache_key: ${{ steps.sccache.outputs.cache_key }} | |
if: success() || failure() | |
continue-on-error: true | |
- name: sccache stats | |
run: sccache --show-stats | |
if: success() || failure() | |
continue-on-error: true | |
release: | |
needs: test | |
runs-on: ubuntu-20.04 | |
if: > | |
success() && ( | |
github.ref == format('refs/heads/{0}', github.event.repository.default_branch) | |
|| startsWith(github.ref, 'refs/tags/')) | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
- name: Dump directory contents | |
run: ls -alFR | |
- name: Check out code | |
uses: actions/checkout@v3 | |
with: | |
path: checkout | |
- name: Collect release notes | |
if: startsWith(github.ref, 'refs/tags/') | |
run: awk -v RS='' '/^[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2} Version ${{ github.ref_name }}/,/^[[:digit:]]/' checkout/ChangeLog | tail '+2' > release-description | |
- name: Write continuous release description | |
if: "!startsWith(github.ref, 'refs/tags/')" | |
env: | |
RELEASE_DESCRIPTION: > | |
This release is an automatically generated snapshot of the current | |
state of development. It is continuously updated with | |
work-in-progress changes that may be broken, incomplete, or | |
incompatible with other versions of Drawpile. For downloads, take a | |
look at the Assets below. | |
run: | |
echo "$RELEASE_DESCRIPTION" > release-description | |
- name: Create release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TARGET_COMMIT: ${{ github.sha }} | |
RELEASE_DESCRIPTION_FILE: release-description | |
RELEASE_NAME: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'continuous' }} | |
CLOBBER_EXISTING: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
PRERELEASE: ${{ !startsWith(github.ref, 'refs/tags/') || contains(github.ref, '-') }} | |
run: | | |
checkout/pkg/make-github-release.sh \ | |
'Drawpile-Android-Qt5.15.8;Drawpile-*.apk;Android APK' \ | |
'Drawpile-Linux-Qt5.15.8;Drawpile-*.AppImage;Linux AppImage' \ | |
'Drawpile-macOS-Qt5.15.8;Drawpile-*.dmg;macOS Disk Image' \ | |
'Drawpile-Windows-Qt5.15.8;Drawpile-*.msi;Windows Installer' \ | |
'Drawpile-Windows-Qt5.15.8;Drawpile-*.zip;Windows Portable ZIP' |