mirror-chatterino2/.github/workflows/build.yml

355 lines
11 KiB
YAML
Raw Normal View History

2019-12-28 14:54:03 +01:00
---
name: Build
on:
push:
branches:
- master
2019-12-28 14:54:03 +01:00
pull_request:
workflow_dispatch:
2019-12-28 14:54:03 +01:00
2022-12-02 20:30:28 +01:00
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
env:
C2_ENABLE_LTO: ${{ github.ref == 'refs/heads/master' }}
2019-12-28 14:54:03 +01:00
jobs:
build:
name: "Build ${{ matrix.os }}, Qt ${{ matrix.qt-version }} (PCH:${{ matrix.pch }}, LTO:${{ matrix.force-lto }})"
2019-12-28 14:54:03 +01:00
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, macos-latest]
qt-version: [5.15.2, 5.12.12]
pch: [true]
force-lto: [false]
skip_artifact: ["no"]
crashpad: [true]
include:
# Ubuntu 20.04, Qt 5.12
- os: ubuntu-20.04
qt-version: 5.12.12
pch: true
force-lto: false
# Ubuntu 22.04, Qt 5.15
- os: ubuntu-22.04
qt-version: 5.15.2
pch: true
force-lto: false
# Test for disabling Precompiled Headers & enabling link-time optimization
- os: ubuntu-22.04
qt-version: 5.15.2
pch: false
force-lto: true
skip_artifact: "yes"
# Test for disabling crashpad on Windows
- os: windows-latest
qt-version: 5.15.2
pch: false
force-lto: true
skip_artifact: "yes"
crashpad: false
2019-12-28 14:54:03 +01:00
fail-fast: false
steps:
- name: Force LTO
if: matrix.force-lto == true
run: |
echo "C2_ENABLE_LTO=ON" >> "$GITHUB_ENV"
shell: bash
- name: Set Crashpad
if: matrix.crashpad == true
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
- uses: actions/checkout@v3
2019-12-28 14:54:03 +01:00
with:
submodules: recursive
fetch-depth: 0 # allows for tags access
2019-12-28 14:54:03 +01:00
- name: Install Qt
uses: jurplel/install-qt-action@v3.0.0
with:
cache: true
cache-key-prefix: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}
version: ${{ matrix.qt-version }}
dir: "${{ github.workspace }}/qt/"
2019-12-28 14:54:03 +01:00
# WINDOWS
- name: Cache conan packages part 1
if: startsWith(matrix.os, 'windows')
uses: actions/cache@v3
with:
key: ${{ runner.os }}-${{ matrix.crashpad }}-conan-user-${{ hashFiles('**/conanfile.txt') }}
path: ~/.conan/
- name: Cache conan packages part 2
if: startsWith(matrix.os, 'windows')
uses: actions/cache@v3
with:
key: ${{ runner.os }}-${{ matrix.crashpad }}-conan-root-${{ hashFiles('**/conanfile.txt') }}
path: C:/.conan/
- name: Add Conan to path
if: startsWith(matrix.os, 'windows')
run: echo "C:\Program Files\Conan\conan\" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
2022-12-02 20:30:28 +01:00
2019-12-28 14:54:03 +01:00
- name: Install dependencies (Windows)
if: startsWith(matrix.os, 'windows')
run: |
choco install conan -y
2022-12-02 20:30:28 +01:00
- name: Enable Developer Command Prompt
if: startsWith(matrix.os, 'windows')
uses: ilammy/msvc-dev-cmd@v1.12.1
2019-12-28 14:54:03 +01:00
- name: Setup Conan (Windows)
if: startsWith(matrix.os, 'windows')
run: |
conan profile new --detect --force default
conan profile update conf.tools.cmake.cmaketoolchain:generator="NMake Makefiles" default
2019-12-28 14:54:03 +01:00
- name: Build (Windows)
if: startsWith(matrix.os, 'windows')
run: |
mkdir build
cd build
conan install .. -s build_type=RelWithDebInfo -b missing -pr:b=default
cmake `
-G"NMake Makefiles" `
-DCMAKE_BUILD_TYPE=RelWithDebInfo `
-DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" `
-DBUILD_WITH_CRASHPAD="$Env:C2_ENABLE_CRASHPAD" `
-DCHATTERINO_LTO="$Env:C2_ENABLE_LTO" `
..
set cl=/MP
nmake /S /NOLOGO
- name: Build crashpad (Windows)
if: startsWith(matrix.os, 'windows') && matrix.crashpad
run: |
cd build
set cl=/MP
nmake /S /NOLOGO crashpad_handler
mkdir Chatterino2/crashpad
cp bin/crashpad/crashpad_handler.exe Chatterino2/crashpad/crashpad_handler.exe
7z a bin/chatterino.pdb.7z bin/chatterino.pdb
- name: Package (windows)
if: startsWith(matrix.os, 'windows')
run: |
cd build
windeployqt bin/chatterino.exe --release --no-compiler-runtime --no-translations --no-opengl-sw --dir Chatterino2/
cp bin/chatterino.exe Chatterino2/
echo nightly > Chatterino2/modes
7z a chatterino-windows-x86-64.zip Chatterino2/
- name: Upload artifact (Windows - binary)
if: startsWith(matrix.os, 'windows') && matrix.skip_artifact != 'yes'
uses: actions/upload-artifact@v3
2019-12-28 14:54:03 +01:00
with:
name: chatterino-windows-x86-64-${{ matrix.qt-version }}.zip
2019-12-28 14:54:03 +01:00
path: build/chatterino-windows-x86-64.zip
- name: Upload artifact (Windows - symbols)
if: startsWith(matrix.os, 'windows') && matrix.skip_artifact != 'yes'
uses: actions/upload-artifact@v3
with:
name: chatterino-windows-x86-64-${{ matrix.qt-version }}-symbols.pdb.7z
path: build/bin/chatterino.pdb.7z
- name: Clean Conan pkgs
if: startsWith(matrix.os, 'windows')
run: conan remove "*" -fsb
shell: bash
2022-12-02 20:30:28 +01:00
2019-12-28 14:54:03 +01:00
# 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 \
libxkbcommon-x11-0 \
build-essential \
libgl1-mesa-dev \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-render-util0 \
libxcb-xinerama0
2019-12-28 14:54:03 +01:00
- 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
2019-12-28 14:54:03 +01:00
- name: Build (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
run: |
mkdir build
cd build
CXXFLAGS=-fno-sized-deallocation cmake \
-DCMAKE_INSTALL_PREFIX=appdir/usr/ \
-DCMAKE_BUILD_TYPE=Release \
-DPAJLADA_SETTINGS_USE_BOOST_FILESYSTEM=On \
-DUSE_PRECOMPILED_HEADERS=${{ matrix.pch }} \
-DCMAKE_EXPORT_COMPILE_COMMANDS=On \
-DCHATTERINO_LTO="$C2_ENABLE_LTO" \
..
make -j"$(nproc)"
shell: bash
- name: clang-tidy review
if: (startsWith(matrix.os, 'ubuntu') && matrix.pch == false && matrix.qt-version == '5.15.2' && github.event_name == 'pull_request')
uses: ZedThree/clang-tidy-review@v0.10.1
id: review
with:
build_dir: build
config_file: ".clang-tidy"
split_workflow: true
exclude: "tests/*,lib/*"
- uses: actions/upload-artifact@v3
if: (startsWith(matrix.os, 'ubuntu') && matrix.pch == false && matrix.qt-version == '5.15.2' && github.event_name == 'pull_request')
with:
name: clang-tidy-review
path: |
clang-tidy-review-output.json
clang-tidy-review-metadata.json
2021-07-17 13:28:45 +02:00
- name: Package - AppImage (Ubuntu)
if: startsWith(matrix.os, 'ubuntu') && matrix.skip_artifact != 'yes'
2019-12-28 14:54:03 +01:00
run: |
cd build
sh ./../.CI/CreateAppImage.sh
2019-12-28 14:54:03 +01:00
shell: bash
2021-07-17 13:28:45 +02:00
- name: Package - .deb (Ubuntu)
if: startsWith(matrix.os, 'ubuntu') && matrix.skip_artifact != 'yes'
2021-07-17 13:28:45 +02:00
run: |
cd build
sh ./../.CI/CreateUbuntuDeb.sh
2021-07-17 13:28:45 +02:00
shell: bash
- name: Upload artifact - AppImage (Ubuntu)
if: startsWith(matrix.os, 'ubuntu') && matrix.skip_artifact != 'yes'
uses: actions/upload-artifact@v3
2019-12-28 14:54:03 +01:00
with:
name: Chatterino-x86_64-${{ matrix.qt-version }}.AppImage
2019-12-28 14:54:03 +01:00
path: build/Chatterino-x86_64.AppImage
2021-07-17 13:28:45 +02:00
- name: Upload artifact - .deb (Ubuntu)
if: startsWith(matrix.os, 'ubuntu') && matrix.skip_artifact != 'yes'
uses: actions/upload-artifact@v3
2021-07-17 13:28:45 +02:00
with:
name: Chatterino-${{ matrix.os }}-Qt-${{ matrix.qt-version }}.deb
path: build/Chatterino-${{ matrix.os }}-x86_64.deb
2021-07-17 13:28:45 +02:00
2019-12-28 14:54:03 +01:00
# MACOS
- name: Install dependencies (MacOS)
if: startsWith(matrix.os, 'macos')
run: |
brew install boost openssl rapidjson p7zip create-dmg cmake tree
2019-12-28 14:54:03 +01:00
shell: bash
- name: Build (MacOS)
if: startsWith(matrix.os, 'macos')
run: |
mkdir build
cd build
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 \
-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl \
-DUSE_PRECOMPILED_HEADERS=${{ matrix.pch }} \
-DCHATTERINO_LTO="$C2_ENABLE_LTO" \
..
make -j"$(sysctl -n hw.logicalcpu)"
shell: bash
2019-12-28 14:54:03 +01:00
- name: Package (MacOS)
if: startsWith(matrix.os, 'macos')
run: |
ls -la
pwd
ls -la build || true
cd build
sh ./../.CI/CreateDMG.sh
2019-12-28 14:54:03 +01:00
shell: bash
- name: Upload artifact (MacOS)
if: startsWith(matrix.os, 'macos')
uses: actions/upload-artifact@v3
2019-12-28 14:54:03 +01:00
with:
name: chatterino-osx-${{ matrix.qt-version }}.dmg
2019-12-28 14:54:03 +01:00
path: build/chatterino-osx.dmg
create-release:
needs: build
runs-on: ubuntu-latest
if: (github.event_name == 'push' && github.ref == 'refs/heads/master')
steps:
- uses: actions/download-artifact@v3
2019-12-28 14:54:03 +01:00
with:
name: chatterino-windows-x86-64-5.15.2.zip
path: release-artifacts/
2019-12-28 14:54:03 +01:00
- uses: actions/download-artifact@v3
with:
name: chatterino-windows-x86-64-5.15.2-symbols.pdb.zip
path: release-artifacts/
- uses: actions/download-artifact@v3
2019-12-28 14:54:03 +01:00
with:
name: Chatterino-x86_64-5.15.2.AppImage
path: release-artifacts/
2019-12-28 14:54:03 +01:00
- uses: actions/download-artifact@v3
2019-12-28 14:54:03 +01:00
with:
name: Chatterino-ubuntu-20.04-Qt-5.12.12.deb
path: release-artifacts/
- uses: actions/download-artifact@v3
with:
name: Chatterino-ubuntu-22.04-Qt-5.15.2.deb
path: release-artifacts/
2021-07-17 13:28:45 +02:00
- uses: actions/download-artifact@v3
2021-07-17 13:28:45 +02:00
with:
name: chatterino-osx-5.15.2.dmg
path: release-artifacts/
2019-12-28 14:54:03 +01:00
- name: Create release
uses: ncipollo/release-action@v1.12.0
2019-12-28 14:54:03 +01:00
with:
removeArtifacts: true
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: "release-artifacts/*"
body: ${{ github.event.head_commit.message }}
prerelease: true
name: Nightly Release
tag: nightly-build