-
Notifications
You must be signed in to change notification settings - Fork 278
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
JulianGro
wants to merge
2
commits into
OtterBrowser:master
Choose a base branch
from
JulianGro:gha_ci_builds
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+138
−0
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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 | ||
|
||
- name: Output system stats | ||
if: ${{ always() }} | ||
working-directory: ${{runner.workspace}}/build | ||
shell: bash | ||
run: | | ||
echo "Disk usage:" | ||
df -h |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?)
There was a problem hiding this comment.
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.