mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
300 lines
9.4 KiB
YAML
300 lines
9.4 KiB
YAML
---
|
|
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
paths-ignore:
|
|
- 'docs/**'
|
|
- '*.md'
|
|
pull_request:
|
|
paths-ignore:
|
|
- 'docs/**'
|
|
- '*.md'
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [windows-latest, ubuntu-latest, macos-latest]
|
|
qt-version: [5.15.2, 5.12.10]
|
|
build-system: [qmake, cmake]
|
|
fail-fast: false
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2.3.4
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Cache Qt
|
|
id: cache-qt
|
|
uses: actions/cache@v2.1.4
|
|
with:
|
|
path: ../Qt
|
|
key: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}-20210109
|
|
|
|
- name: Cache conan
|
|
if: matrix.build-system == 'cmake'
|
|
uses: actions/cache@v2.1.4
|
|
with:
|
|
key: ${{ runner.os }}-conan-${{ matrix.qt-version }}-${{ hashFiles('**/conanfile.txt') }}
|
|
path: ~/.conan
|
|
|
|
# LINUX
|
|
- name: Install p7zip (Ubuntu)
|
|
if: startsWith(matrix.os, 'ubuntu')
|
|
run: sudo apt-get update && sudo apt-get -y install p7zip-full
|
|
|
|
- name: Install Qt
|
|
uses: jurplel/install-qt-action@v2
|
|
with:
|
|
aqtversion: '==1.1.1'
|
|
cached: ${{ steps.cache-qt.outputs.cache-hit }}
|
|
extra: --external 7z
|
|
version: ${{ matrix.qt-version }}
|
|
|
|
# WINDOWS
|
|
|
|
- name: Cache conan packages
|
|
if: startsWith(matrix.os, 'windows')
|
|
uses: actions/cache@v2.1.4
|
|
with:
|
|
key: ${{ runner.os }}-conan-pkg-${{ hashFiles('**/conanfile.txt') }}
|
|
path: C:/.conan/
|
|
|
|
- name: Install dependencies (Windows)
|
|
if: startsWith(matrix.os, 'windows')
|
|
run: choco install conan -y
|
|
shell: cmd
|
|
|
|
- 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
|
|
|
|
- name: Build (Windows)
|
|
if: startsWith(matrix.os, 'windows') && matrix.build-system == 'qmake'
|
|
run: |
|
|
call "%programfiles(x86)%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
|
|
mkdir build
|
|
cd build
|
|
conan install ..\conanfile-qmake.txt
|
|
qmake ..
|
|
set cl=/MP
|
|
nmake /S /NOLOGO
|
|
windeployqt release/chatterino.exe --release --no-compiler-runtime --no-translations --no-opengl-sw --dir Chatterino2/
|
|
cp release/chatterino.exe Chatterino2/
|
|
echo nightly > Chatterino2/modes
|
|
7z a chatterino-windows-x86-64.zip Chatterino2/
|
|
shell: cmd
|
|
|
|
- name: Build with CMake (Windows)
|
|
if: startsWith(matrix.os, 'windows') && matrix.build-system == 'cmake'
|
|
run: |
|
|
call "%programfiles(x86)%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
|
|
mkdir build
|
|
cd build
|
|
cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DUSE_PACKAGE_MANAGER=ON ..
|
|
set cl=/MP
|
|
nmake /S /NOLOGO
|
|
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/
|
|
shell: cmd
|
|
|
|
- name: Upload artifact (Windows)
|
|
if: startsWith(matrix.os, 'windows')
|
|
uses: actions/upload-artifact@v2.2.2
|
|
with:
|
|
name: chatterino-windows-x86-64-${{ matrix.qt-version }}-${{ matrix.build-system }}.zip
|
|
path: build/chatterino-windows-x86-64.zip
|
|
|
|
# LINUX
|
|
- name: Install dependencies (Ubuntu)
|
|
if: startsWith(matrix.os, 'ubuntu')
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get -y install \
|
|
cmake \
|
|
virtualenv \
|
|
rapidjson-dev \
|
|
libssl-dev \
|
|
libboost-dev \
|
|
libxcb-randr0-dev \
|
|
libboost-system-dev \
|
|
libboost-filesystem-dev \
|
|
libpulse-dev \
|
|
libxkbcommon-x11-0 \
|
|
libgstreamer-plugins-base1.0-0 \
|
|
build-essential \
|
|
libgl1-mesa-dev \
|
|
libxcb-icccm4 \
|
|
libxcb-image0 \
|
|
libxcb-keysyms1 \
|
|
libxcb-render-util0 \
|
|
libxcb-xinerama0
|
|
|
|
- name: Build (Ubuntu)
|
|
if: startsWith(matrix.os, 'ubuntu') && matrix.build-system == 'qmake'
|
|
run: |
|
|
mkdir build
|
|
cd build
|
|
qmake PREFIX=/usr ..
|
|
make -j8
|
|
shell: bash
|
|
|
|
- name: Build with CMake (Ubuntu)
|
|
if: startsWith(matrix.os, 'ubuntu') && matrix.build-system == 'cmake'
|
|
run: |
|
|
mkdir build
|
|
cd build
|
|
cmake -DCMAKE_INSTALL_PREFIX=appdir/usr/ -DCMAKE_BUILD_TYPE=Release -DUSE_BOOST_FILESYSTEM=On ..
|
|
make -j8
|
|
shell: bash
|
|
|
|
- name: Package (Ubuntu)
|
|
if: startsWith(matrix.os, 'ubuntu')
|
|
run: |
|
|
cd build
|
|
sh ./../.CI/CreateAppImage.sh
|
|
shell: bash
|
|
|
|
- name: Upload artifact (Ubuntu)
|
|
if: startsWith(matrix.os, 'ubuntu')
|
|
uses: actions/upload-artifact@v2.2.2
|
|
with:
|
|
name: Chatterino-x86_64-${{ matrix.qt-version }}-${{ matrix.build-system }}.AppImage
|
|
path: build/Chatterino-x86_64.AppImage
|
|
|
|
# MACOS
|
|
- name: Install dependencies (MacOS)
|
|
if: startsWith(matrix.os, 'macos')
|
|
run: |
|
|
brew install boost openssl rapidjson p7zip create-dmg cmake
|
|
shell: bash
|
|
|
|
- name: Build (MacOS)
|
|
if: startsWith(matrix.os, 'macos') && matrix.build-system == 'qmake'
|
|
run: |
|
|
mkdir build
|
|
cd build
|
|
$Qt5_DIR/bin/qmake .. DEFINES+=$dateOfBuild
|
|
make -j8
|
|
shell: bash
|
|
|
|
- name: Build with CMake (MacOS)
|
|
if: startsWith(matrix.os, 'macos') && matrix.build-system == 'cmake'
|
|
run: |
|
|
mkdir build
|
|
cd build
|
|
cmake \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl \
|
|
..
|
|
make -j8
|
|
shell: bash
|
|
|
|
- name: Package (MacOS)
|
|
if: startsWith(matrix.os, 'macos') && matrix.build-system == 'qmake'
|
|
run: |
|
|
ls -la
|
|
pwd
|
|
ls -la build || true
|
|
cd build
|
|
sh ./../.CI/CreateDMG.sh
|
|
shell: bash
|
|
|
|
- name: Package (MacOS)
|
|
if: startsWith(matrix.os, 'macos') && matrix.build-system == 'cmake'
|
|
run: |
|
|
ls -la
|
|
pwd
|
|
ls -la build || true
|
|
cd build
|
|
sh ./../.CI/CreateDMG.sh
|
|
shell: bash
|
|
|
|
- name: Upload artifact (MacOS)
|
|
if: startsWith(matrix.os, 'macos')
|
|
uses: actions/upload-artifact@v2.2.2
|
|
with:
|
|
name: chatterino-osx-${{ matrix.qt-version }}-${{ matrix.build-system }}.dmg
|
|
path: build/chatterino-osx.dmg
|
|
|
|
- name: Clean conan packages
|
|
if: matrix.build-system == 'cmake'
|
|
run: cmake -P cmake/pmm.cmake /Conan /Clean
|
|
|
|
create-release:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
if: (github.event_name == 'push' && github.ref == 'refs/heads/master')
|
|
|
|
steps:
|
|
- name: Create release
|
|
id: create_release
|
|
uses: pajlada/create-release@v2.0.3
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: nightly-build
|
|
backup_tag_name: backup-nightly-build
|
|
release_name: Nightly Release
|
|
body: |
|
|
Nightly Build
|
|
prerelease: true
|
|
|
|
- uses: actions/download-artifact@v2.0.8
|
|
with:
|
|
name: chatterino-windows-x86-64-5.15.2-qmake.zip
|
|
path: windows/
|
|
|
|
- uses: actions/download-artifact@v2.0.8
|
|
with:
|
|
name: Chatterino-x86_64-5.15.2-qmake.AppImage
|
|
path: linux/
|
|
|
|
- uses: actions/download-artifact@v2.0.8
|
|
with:
|
|
name: chatterino-osx-5.15.2-qmake.dmg
|
|
path: macos/
|
|
|
|
# TODO: Extract dmg and appimage
|
|
|
|
# - name: Read upload URL into output
|
|
# id: upload_url
|
|
# run: |
|
|
# echo "::set-output name=upload_url::$(cat release-upload-url.txt/release-upload-url.txt)"
|
|
|
|
- name: Upload release asset (Windows)
|
|
uses: actions/upload-release-asset@v1.0.2
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ./windows/chatterino-windows-x86-64.zip
|
|
asset_name: chatterino-windows-x86-64.zip
|
|
asset_content_type: application/zip
|
|
|
|
- name: Upload release asset (Ubuntu)
|
|
uses: actions/upload-release-asset@v1.0.2
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ./linux/Chatterino-x86_64.AppImage
|
|
asset_name: Chatterino-x86_64.AppImage
|
|
asset_content_type: application/x-executable
|
|
|
|
- name: Upload release asset (MacOS)
|
|
uses: actions/upload-release-asset@v1.0.2
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ./macos/chatterino-osx.dmg
|
|
asset_name: chatterino-osx.dmg
|
|
asset_content_type: application/x-bzip2
|