Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub Action CI builds #1685

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 138 additions & 0 deletions .github/workflows/ci_build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
name: CI Build

on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- master

jobs:
build:
name: "${{matrix.os}}, ${{matrix.qt_version}}, ${{matrix.build_type}} "
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
build_type: qtwebengine with hunspell
qt_version: 5.15.2
- os: windows-latest
build_type: qtwebengine without hunspell
qt_version: 5.15.2

- os: ubuntu-18.04
build_type: qtwebkit with hunspell
qt_version: repository
apt-dependencies: git build-essential cmake qtbase5-dev libqt5core5a libqt5gui5 libqt5multimedia5 qtmultimedia5-dev libqt5network5 libqt5printsupport5 libqt5qml5 qtdeclarative5-dev libqt5svg5 libqt5svg5-dev libqt5widgets5 libhunspell-dev libqt5webkit5 libqt5webkit5-dev
- os: ubuntu-18.04
build_type: qtwebkit without hunspell
qt_version: repository
apt-dependencies: git build-essential cmake qtbase5-dev libqt5core5a libqt5gui5 libqt5multimedia5 qtmultimedia5-dev libqt5network5 libqt5printsupport5 libqt5qml5 qtdeclarative5-dev libqt5svg5 libqt5svg5-dev libqt5widgets5 libqt5webkit5 libqt5webkit5-dev
- os: ubuntu-18.04
build_type: qtwebengine with hunspell
qt_version: 5.15.2
apt-dependencies: git build-essential cmake libhunspell-dev
- os: ubuntu-20.04
build_type: qtwebkit with hunspell
qt_version: repository
apt-dependencies: git build-essential cmake qtbase5-dev libqt5core5a libqt5gui5 libqt5multimedia5 qtmultimedia5-dev libqt5network5 libqt5printsupport5 libqt5qml5 qtdeclarative5-dev libqt5svg5 libqt5svg5-dev libqt5widgets5 libhunspell-dev libqt5webkit5 libqt5webkit5-dev

- os: macOS-latest
build_type: qtwebengine with hunspell
qt_version: 5.15.2
- os: macOS-latest
build_type: qtwebengine without hunspell
qt_version: 5.15.2

steps:
- name: Get Otter Browser source
uses: actions/checkout@v1
with:
submodules: false
fetch-depth: 1

- name: Cache Qt
if: !startsWith(matrix.qt_version, 'repository')
id: cache-qt
uses: actions/cache@v2
with:
path: ${{runner.workspace}}/Qt
key: ${{runner.os}}-QtCache

- name: Install Qt ${{matrix.qt_version}} with QtWebEngine
if: startsWith(matrix.os, 'windows') && startsWith(matrix.build_type, 'qtwebengine') || startsWith(matrix.os, 'macos') && startsWith(matrix.build_type, 'qtwebengine') || startsWith(matrix.os, 'ubuntu') && !startsWith(matrix.qt_version, 'repository') && startsWith(matrix.build_type, 'qtwebengine')
uses: jurplel/install-qt-action@v2
with:
version: ${{matrix.qt_version}}
modules: qtwebengine
cached: ${{steps.cache-qt.outputs.cache-hit}}

- name: Install Qt ${{matrix.qt_version}} without QtWebEngine
if: startsWith(matrix.os, 'windows') && startsWith(matrix.build_type, 'qtwebkit') || startsWith(matrix.os, 'macos') && startsWith(matrix.build_type, 'qtwebkit') || startsWith(matrix.os, 'ubuntu') && !startsWith(matrix.qt_version, 'repository') && startsWith(matrix.build_type, 'qtwebkit')
uses: jurplel/install-qt-action@v2
with:
version: ${{matrix.qt_version}}
cached: ${{steps.cache-qt.outputs.cache-hit}}

- name: Install hunspell dependencies on Windows
if: startsWith(matrix.os, 'windows') && endsWith(matrix.build_type, 'with hunspell')
uses: msys2/setup-msys2@v2
with:
install: >-
base-devel
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-libtool

- name: Install hunspell on Windows
if: startsWith(matrix.os, 'windows') && endsWith(matrix.build_type, 'with hunspell')
shell: msys2 {0}
run: |
curl -Ls https://github.com/hunspell/hunspell/files/2573619/hunspell-1.7.0.tar.gz -o hunspell.tar.gz
tar -xf hunspell.tar.gz
cd hunspell-1.7.0
autoreconf -vfi
./configure
make -j2
echo "CMAKE_BUILD_EXTRA=-DHunspell_INCLUDE_DIR=$RUNNER_WORKSPACE\hunspell-1.7.0\src\ -DHunspell_LIBRARIES=hunspell-1.7" >> $GITHUB_ENV

- name: Install dependencies
shell: bash
run: |

# Install APT dependencies on Ubuntu
if [[ "${{ matrix.os }}" = "ubuntu"* ]]; then
echo "Updating apt repository index"
sudo apt update
echo "Installing apt packages"
sudo apt install -y ${{ matrix.apt-dependencies }}
fi

# Install Hunspell on MacOS
if [[ "${{ matrix.os }}" = "macOS"* && "${{ matrix.build_type }}" != *"without"* ]]; then
echo "Installing Hunspell"
brew install hunspell
fi

- name: Create Build Environment
shell: bash
run: cmake -E make_directory "${{runner.workspace}}/build"

- name: Configure CMake
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake $GITHUB_WORKSPACE $CMAKE_BUILD_EXTRA

- name: Build Otter Browser
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --parallel 3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you based this on something, but I also assume GHA has a proper variable for it instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you mean the thread count? Yes: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
I don't think there is a GHA specific variable for the thread count, but my reasoning for that assumption is that you could just get the thread count from the system instead. We have 3 threads hardcoded on the Vircadia GHA which I adopted here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It just doesn't seem very forward thinking. I'd rather see for example $(nproc) or something along those lines. (Presumably this is nproc + 1; is that better somehow?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that you talk about $(nproc) I understand why you were talking about a GHA variable and why we have it hardcoded on the Vircadia actions. I forgot that $(nproc) will only work on Linux (and maybe macOS).
GHA doesn't have a variable for the available threads.


- name: Output system stats
if: ${{ always() }}
working-directory: ${{runner.workspace}}/build
shell: bash
run: |
echo "Disk usage:"
df -h