Merge branch 'SevenTV:chatterino7' into chatterino7 #10
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 | |
on: | |
push: | |
branches: | |
- chatterino7 | |
- "bugfix-release/**" | |
- "release/*" | |
pull_request: | |
workflow_dispatch: | |
merge_group: | |
concurrency: | |
group: build-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
C2_ENABLE_LTO: ${{ github.ref == 'refs/heads/chatterino7' || startsWith(github.ref, 'refs/heads/bugfix-release') || startsWith(github.ref, 'refs/heads/release/')}} | |
CHATTERINO_REQUIRE_CLEAN_GIT: On | |
C2_BUILD_WITH_QT6: Off | |
# Last known good conan version | |
# 2.0.3 has a bug on Windows (conan-io/conan#13606) | |
CONAN_VERSION: 2.0.2 | |
OPENSSL_1_1_1_VERSION: 1.1.1w | |
OPENSSL_1_1_1_SHA256: "cf3098950cb4d853ad95c0841f1f9c6d3dc102dccfcacd521d93925208b76ac8" | |
OPENSSL_1_1_1_DIR: /usr/local/ssl | |
jobs: | |
build: | |
name: "Build ${{ matrix.os }}${{ matrix.arch && format(' ({0})', matrix.arch) || ''}}, Qt ${{ matrix.qt-version }} (LTO:${{ matrix.force-lto }}, crashpad:${{ matrix.skip-crashpad && 'off' || 'on' }})" | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
# Windows Latest - tests Plugins | |
- os: windows-latest | |
qt-version: 6.5.0 | |
force-lto: false | |
plugins: true | |
skip-artifact: false | |
skip-crashpad: false | |
# Ubuntu 22.04, Qt 5.15 | |
- os: ubuntu-22.04 | |
qt-version: 5.15.2 | |
force-lto: false | |
plugins: false | |
skip-artifact: false | |
skip-crashpad: false | |
# Ubuntu 22.04, Qt 6.2.4 - tests LTO & plugins | |
- os: ubuntu-22.04 | |
qt-version: 6.2.4 | |
force-lto: true | |
plugins: true | |
skip-artifact: false | |
skip-crashpad: false | |
# macOS (ARM) | |
- os: macos-12 | |
qt-version: 6.5.0 | |
arch: arm64 | |
force-lto: false | |
plugins: false | |
skip-artifact: false | |
skip-crashpad: false | |
# macOS (x86) | |
- os: macos-12 | |
qt-version: 6.5.0 | |
arch: x86_64 | |
force-lto: false | |
plugins: false | |
skip-artifact: false | |
skip-crashpad: false | |
fail-fast: false | |
steps: | |
- name: Force LTO | |
if: matrix.force-lto | |
run: | | |
echo "C2_ENABLE_LTO=ON" >> "$GITHUB_ENV" | |
shell: bash | |
- name: Enable plugin support | |
if: matrix.plugins | |
run: | | |
echo "C2_PLUGINS=ON" >> "$GITHUB_ENV" | |
shell: bash | |
- name: Set Crashpad | |
if: matrix.skip-crashpad == false | |
run: | | |
echo "C2_ENABLE_CRASHPAD=ON" >> "$GITHUB_ENV" | |
shell: bash | |
- name: Set environment variables for windows-latest | |
if: matrix.os == 'windows-latest' | |
run: | | |
echo "vs_version=2022" >> "$GITHUB_ENV" | |
shell: bash | |
- name: Set BUILD_WITH_QT6 | |
if: startsWith(matrix.qt-version, '6.') | |
run: | | |
echo "C2_BUILD_WITH_QT6=ON" >> "$GITHUB_ENV" | |
shell: bash | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 0 # allows for tags access | |
- name: Install Qt5 | |
if: startsWith(matrix.qt-version, '5.') | |
uses: jurplel/[email protected] | |
with: | |
cache: true | |
cache-key-prefix: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}-v2 | |
version: ${{ matrix.qt-version }} | |
- name: Install Qt 6.5.3 imageformats | |
if: startsWith(matrix.qt-version, '6.') | |
uses: jurplel/[email protected] | |
with: | |
cache: false | |
modules: qtimageformats | |
set-env: false | |
version: 6.5.3 | |
extra: --noarchives | |
- name: Find Qt 6.5.3 Path | |
if: startsWith(matrix.qt-version, '6.') && startsWith(matrix.os, 'windows') | |
shell: pwsh | |
id: find-good-imageformats | |
run: | | |
cd "$Env:RUNNER_WORKSPACE/Qt/6.5.3" | |
cd (Get-ChildItem)[0].Name | |
cd plugins/imageformats | |
echo "PLUGIN_PATH=$(pwd)" | Out-File -Path "$Env:GITHUB_OUTPUT" -Encoding ASCII | |
- name: Install Qt6 | |
if: startsWith(matrix.qt-version, '6.') | |
uses: jurplel/[email protected] | |
with: | |
cache: true | |
cache-key-prefix: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}-v2 | |
modules: qt5compat qtimageformats | |
version: ${{ matrix.qt-version }} | |
# WINDOWS | |
- name: Enable Developer Command Prompt (Windows) | |
if: startsWith(matrix.os, 'windows') | |
uses: ilammy/[email protected] | |
- name: Setup conan variables (Windows) | |
if: startsWith(matrix.os, 'windows') | |
run: | | |
"C2_USE_OPENSSL3=$(if ($Env:C2_BUILD_WITH_QT6 -eq "on") { "True" } else { "False" })" >> "$Env:GITHUB_ENV" | |
"C2_CONAN_CACHE_SUFFIX=$(if ($Env:C2_BUILD_WITH_QT6 -eq "on") { "-QT6" } else { "`" })" >> "$Env:GITHUB_ENV" | |
shell: powershell | |
- name: Setup sccache (Windows) | |
# sccache v0.5.3 | |
uses: nerixyz/ccache-action@9a7e8d00116ede600ee7717350c6594b8af6aaa5 | |
if: startsWith(matrix.os, 'windows') | |
with: | |
variant: sccache | |
# only save on on the default (master) branch | |
save: ${{ github.event_name == 'push' }} | |
key: sccache-build-${{ matrix.os }}-${{ matrix.qt-version }}-${{ matrix.skip-crashpad }} | |
restore-keys: | | |
sccache-build-${{ matrix.os }}-${{ matrix.qt-version }} | |
- name: Cache conan packages (Windows) | |
if: startsWith(matrix.os, 'windows') | |
uses: actions/cache@v3 | |
with: | |
key: ${{ runner.os }}-conan-user-${{ hashFiles('**/conanfile.py') }}${{ env.C2_CONAN_CACHE_SUFFIX }} | |
path: ~/.conan2/ | |
- name: Install Conan (Windows) | |
if: startsWith(matrix.os, 'windows') | |
run: | | |
python3 -c "import site; import sys; print(f'{site.USER_BASE}\\Python{sys.version_info.major}{sys.version_info.minor}\\Scripts')" >> "$GITHUB_PATH" | |
pip3 install --user "conan==${{ env.CONAN_VERSION }}" | |
shell: powershell | |
- name: Setup Conan (Windows) | |
if: startsWith(matrix.os, 'windows') | |
run: | | |
conan --version | |
conan profile detect -f | |
shell: powershell | |
- name: Install dependencies (Windows) | |
if: startsWith(matrix.os, 'windows') | |
run: | | |
mkdir build | |
cd build | |
conan install .. ` | |
-s build_type=RelWithDebInfo ` | |
-c tools.cmake.cmaketoolchain:generator="NMake Makefiles" ` | |
-b missing ` | |
--output-folder=. ` | |
-o with_openssl3="$Env:C2_USE_OPENSSL3" | |
shell: powershell | |
- name: Build (Windows) | |
if: startsWith(matrix.os, 'windows') | |
shell: pwsh | |
run: | | |
cd build | |
cmake ` | |
-G"NMake Makefiles" ` | |
-DCMAKE_BUILD_TYPE=RelWithDebInfo ` | |
-DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" ` | |
-DUSE_PRECOMPILED_HEADERS=ON ` | |
-DBUILD_WITH_CRASHPAD="$Env:C2_ENABLE_CRASHPAD" ` | |
-DCHATTERINO_LTO="$Env:C2_ENABLE_LTO" ` | |
-DCHATTERINO_PLUGINS="$Env:C2_PLUGINS" ` | |
-DBUILD_WITH_QT6="$Env:C2_BUILD_WITH_QT6" ` | |
.. | |
set cl=/MP | |
nmake /S /NOLOGO | |
- name: Build crashpad (Windows) | |
if: startsWith(matrix.os, 'windows') && !matrix.skip-crashpad | |
shell: pwsh | |
run: | | |
cd build | |
set cl=/MP | |
nmake /S /NOLOGO chatterino-crash-handler | |
mkdir Chatterino2/crashpad | |
cp bin/crashpad/crashpad-handler.exe Chatterino2/crashpad/crashpad-handler.exe | |
7z a bin/chatterino-Qt-${{ matrix.qt-version }}.pdb.7z bin/chatterino.pdb | |
- name: Prepare build dir (windows) | |
if: startsWith(matrix.os, 'windows') | |
working-directory: build | |
run: | | |
windeployqt bin/chatterino.exe --release --no-compiler-runtime --no-translations --no-opengl-sw --dir Chatterino2/ | |
cp bin/chatterino.exe Chatterino2/ | |
echo nightly > Chatterino2/modes | |
- name: Fix Qt6 (windows) | |
if: startsWith(matrix.qt-version, '6.') && startsWith(matrix.os, 'windows') | |
working-directory: build | |
run: | | |
cp ${{ steps.find-good-imageformats.outputs.PLUGIN_PATH }}/qwebp.dll Chatterino2/imageformats/qwebp.dll | |
- name: Package (windows) | |
if: startsWith(matrix.os, 'windows') | |
working-directory: build | |
run: | | |
7z a chatterino-windows-x86-64-Qt-${{ matrix.qt-version }}.zip Chatterino2/ | |
- name: Upload artifact (Windows - binary) | |
if: startsWith(matrix.os, 'windows') && !matrix.skip-artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: chatterino-windows-x86-64-Qt-${{ matrix.qt-version }}.zip | |
path: build/chatterino-windows-x86-64-Qt-${{ matrix.qt-version }}.zip | |
- name: Upload artifact (Windows - symbols) | |
if: startsWith(matrix.os, 'windows') && !matrix.skip-artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: chatterino-windows-x86-64-Qt-${{ matrix.qt-version }}-symbols.pdb.7z | |
path: build/bin/chatterino-Qt-${{ matrix.qt-version }}.pdb.7z | |
- name: Clean Conan cache | |
if: startsWith(matrix.os, 'windows') | |
run: conan cache clean --source --build --download "*" | |
shell: bash | |
# LINUX | |
- name: Install dependencies (Ubuntu) | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install \ | |
cmake \ | |
virtualenv \ | |
rapidjson-dev \ | |
libfuse2 \ | |
libssl-dev \ | |
libboost-dev \ | |
libxcb-randr0-dev \ | |
libboost-system-dev \ | |
libboost-filesystem-dev \ | |
libpulse-dev \ | |
libavif-dev \ | |
libxkbcommon-x11-0 \ | |
build-essential \ | |
libgl1-mesa-dev \ | |
libxcb-icccm4 \ | |
libxcb-image0 \ | |
libxcb-keysyms1 \ | |
libxcb-render-util0 \ | |
libxcb-xinerama0 \ | |
wget \ | |
zlib1g-dev | |
- name: Apply Qt patches (Ubuntu) | |
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.qt-version, '5.') | |
run: | | |
patch "$Qt5_DIR/include/QtConcurrent/qtconcurrentthreadengine.h" .patches/qt5-on-newer-gcc.patch | |
shell: bash | |
- name: Build OpenSSL 1.1.1 | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
cd $RUNNER_WORKSPACE | |
wget "https://www.openssl.org/source/openssl-$OPENSSL_1_1_1_VERSION.tar.gz" | |
echo "${{ env.OPENSSL_1_1_1_SHA256 }} openssl-$OPENSSL_1_1_1_VERSION.tar.gz" | sha256sum -c | |
tar xf "openssl-$OPENSSL_1_1_1_VERSION.tar.gz" | |
cd "openssl-$OPENSSL_1_1_1_VERSION" | |
./config --prefix="$OPENSSL_1_1_1_DIR" --openssldir="$OPENSSL_1_1_1_DIR" shared zlib | |
make -j"$(nproc)" | |
sudo make install | |
shell: bash | |
- name: Build (Ubuntu), Qt ${{ matrix.qt-version }} | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
mkdir build | |
cd build | |
OPENSSL_ROOT_DIR="$OPENSSL_1_1_1_DIR" CXXFLAGS=-fno-sized-deallocation cmake \ | |
-DCMAKE_INSTALL_PREFIX=appdir/usr/ \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DPAJLADA_SETTINGS_USE_BOOST_FILESYSTEM=On \ | |
-DUSE_PRECOMPILED_HEADERS=OFF \ | |
-DCMAKE_EXPORT_COMPILE_COMMANDS=On \ | |
-DCHATTERINO_LTO="$C2_ENABLE_LTO" \ | |
-DCHATTERINO_PLUGINS="$C2_PLUGINS" \ | |
-DBUILD_WITH_QT6="$C2_BUILD_WITH_QT6" \ | |
.. | |
make -j"$(nproc)" | |
shell: bash | |
- name: clang-tidy review | |
if: matrix.clang-tidy-review && github.event_name == 'pull_request' | |
timeout-minutes: 10 | |
uses: ZedThree/[email protected] | |
with: | |
build_dir: build-clang-tidy | |
config_file: ".clang-tidy" | |
split_workflow: true | |
exclude: "lib/*" | |
cmake_command: >- | |
cmake -S. -Bbuild-clang-tidy | |
-DCMAKE_BUILD_TYPE=Release | |
-DPAJLADA_SETTINGS_USE_BOOST_FILESYSTEM=On | |
-DUSE_PRECOMPILED_HEADERS=OFF | |
-DCMAKE_EXPORT_COMPILE_COMMANDS=On | |
-DCHATTERINO_LTO=Off | |
-DCHATTERINO_PLUGINS=On | |
-DBUILD_WITH_QT6=Off | |
-DBUILD_TESTS=On | |
-DBUILD_BENCHMARKS=On | |
apt_packages: >- | |
qttools5-dev, qt5-image-formats-plugins, libqt5svg5-dev, | |
libsecret-1-dev, | |
libboost-dev, libboost-system-dev, libboost-filesystem-dev, | |
libssl-dev, | |
rapidjson-dev, | |
libbenchmark-dev, | |
libavif-dev | |
- name: clang-tidy-review upload | |
if: matrix.clang-tidy-review && github.event_name == 'pull_request' | |
uses: ZedThree/clang-tidy-review/[email protected] | |
- name: Package - AppImage (Ubuntu) | |
if: startsWith(matrix.os, 'ubuntu-22.04') && !matrix.skip-artifact | |
run: | | |
cd build | |
sh ./../.CI/CreateAppImage.sh | |
shell: bash | |
- name: Package - .deb (Ubuntu) | |
if: startsWith(matrix.os, 'ubuntu') && !matrix.skip-artifact | |
run: | | |
cd build | |
sh ./../.CI/CreateUbuntuDeb.sh | |
shell: bash | |
- name: Upload artifact - AppImage (Ubuntu) | |
if: startsWith(matrix.os, 'ubuntu-22.04') && !matrix.skip-artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Chatterino-x86_64-${{ matrix.qt-version }}.AppImage | |
path: build/Chatterino-x86_64.AppImage | |
- name: Upload artifact - .deb (Ubuntu) | |
if: startsWith(matrix.os, 'ubuntu') && !matrix.skip-artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Chatterino-${{ matrix.os }}-Qt-${{ matrix.qt-version }}.deb | |
path: build/Chatterino-${{ matrix.os }}-x86_64.deb | |
# MACOS | |
- name: Install dependencies (MacOS) | |
if: startsWith(matrix.os, 'macos') | |
run: | | |
LIBS=(boost openssl rapidjson) | |
for package in "${LIBS[@]}" | |
do | |
brew fetch --force --bottle-tag=${{ matrix.arch }}_monterey $package | |
formula=$(brew --cache --bottle-tag=${{ matrix.arch }}_monterey $package) | |
if [[ $package == "openssl" ]]; then | |
brew reinstall $formula | |
else | |
brew install $formula | |
fi | |
done | |
brew install p7zip create-dmg cmake tree | |
shell: bash | |
- name: Build (MacOS) | |
if: startsWith(matrix.os, 'macos') | |
run: | | |
mkdir build | |
cd build | |
cmake \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 \ | |
-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl \ | |
-DUSE_PRECOMPILED_HEADERS=OFF \ | |
-DCHATTERINO_LTO="$C2_ENABLE_LTO" \ | |
-DCHATTERINO_PLUGINS="$C2_PLUGINS" \ | |
-DBUILD_WITH_QT6="$C2_BUILD_WITH_QT6" \ | |
-DCHATTERINO_NO_AVIF_PLUGIN=On \ | |
-DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} \ | |
.. | |
make -j"$(sysctl -n hw.logicalcpu)" | |
shell: bash | |
- name: Package (MacOS) | |
if: startsWith(matrix.os, 'macos') | |
env: | |
OUTPUT_DMG_PATH: chatterino-macos-Qt-${{ matrix.qt-version}}-${{ matrix.arch }}.dmg | |
run: | | |
ls -la | |
pwd | |
ls -la build || true | |
cd build | |
export MACOS_CODESIGN_CERTIFICATE="-" | |
echo "-> $MACOS_CODESIGN_CERTIFICATE" | |
brew reinstall openssl | |
echo "Downloading kimageformats plugins" | |
curl -SsfLo kimg.zip "https://github.com/nerixyz/kimageformats-binaries/releases/download/cont/kimageformats-macos-latest-${{ matrix.qt-version}}.zip" | |
${{matrix.arch == 'arm64' && 'brew reinstall $(brew --cache --bottle-tag=arm64_monterey openssl)' || ''}} | |
./../.CI/MacDeploy.sh | |
./../.CI/CreateDMG.sh | |
shell: bash | |
- name: Upload artifact (MacOS) | |
if: startsWith(matrix.os, 'macos') | |
uses: actions/upload-artifact@v4 | |
with: | |
name: chatterino-macos-Qt-${{ matrix.qt-version }}-${{ matrix.arch }}.dmg | |
path: build/chatterino-macos-Qt-${{ matrix.qt-version }}-${{ matrix.arch }}.dmg | |
create-release: | |
needs: build | |
runs-on: ubuntu-latest | |
if: (github.event_name == 'push' && github.ref == 'refs/heads/chatterino7') | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # allows for tags access | |
- uses: actions/download-artifact@v4 | |
name: Windows Qt6.5.0 | |
with: | |
name: chatterino-windows-x86-64-Qt-6.5.0.zip | |
path: release-artifacts/ | |
- uses: actions/download-artifact@v4 | |
name: Windows Qt6.5.0 symbols | |
with: | |
name: chatterino-windows-x86-64-Qt-6.5.0-symbols.pdb.7z | |
path: release-artifacts/ | |
- uses: actions/download-artifact@v4 | |
name: Linux Qt5.15.2 AppImage | |
with: | |
name: Chatterino-x86_64-5.15.2.AppImage | |
path: release-artifacts/ | |
- uses: actions/download-artifact@v4 | |
name: Linux Qt6.2.4 AppImage | |
with: | |
name: Chatterino-x86_64-6.2.4.AppImage | |
path: release-artifacts/ | |
- uses: actions/download-artifact@v4 | |
name: Ubuntu 22.04 Qt5.15.2 deb | |
with: | |
name: Chatterino-ubuntu-22.04-Qt-5.15.2.deb | |
path: release-artifacts/ | |
- uses: actions/download-artifact@v4 | |
name: Ubuntu 22.04 Qt6.2.4 deb | |
with: | |
name: Chatterino-ubuntu-22.04-Qt-6.2.4.deb | |
path: release-artifacts/ | |
- uses: actions/download-artifact@v4 | |
name: macOS x86_64 Qt6.5.0 x86 dmg | |
with: | |
name: chatterino-macos-Qt-6.5.0-x86_64.dmg | |
path: release-artifacts/ | |
- uses: actions/download-artifact@v4 | |
name: macOS x86_64 Qt6.5.0 ARM dmg | |
with: | |
name: chatterino-macos-Qt-6.5.0-arm64.dmg | |
path: release-artifacts/ | |
- name: Rename artifacts | |
run: | | |
ls -l | |
# Rename the macos build to indicate that it's for macOS 12.0 users | |
mv chatterino-macos-Qt-6.5.0-x86_64.dmg Chatterino-macOS-12.0-x86_64.dmg | |
mv chatterino-macos-Qt-6.5.0-arm64.dmg Chatterino-macOS-12.0-arm64.dmg | |
working-directory: release-artifacts | |
shell: bash | |
- name: Create release | |
uses: ncipollo/[email protected] | |
with: | |
replacesArtifacts: true | |
allowUpdates: true | |
artifactErrorsFailBuild: true | |
artifacts: "release-artifacts/*" | |
body: ${{ github.event.head_commit.message }} | |
prerelease: true | |
name: Nightly Release | |
tag: nightly-build | |
- name: Update nightly-build tag | |
run: | | |
git tag -f nightly-build | |
git push -f origin nightly-build | |
shell: bash |