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

Create GitHub Action workflow for building project on Windows, Linux and macOS #1127

Open
wants to merge 17 commits into
base: unstable
Choose a base branch
from
112 changes: 112 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Build Release

on:
push:
pull_request:
workflow_dispatch:

jobs:
create_release:
name: Create release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
release_id: ${{ steps.create_release.outputs.id }}
steps:
- uses: actions/checkout@v2
- name: Set Env
run: |
export TAG=v${GITHUB_RUN_ID}.${GITHUB_RUN_NUMBER}
echo "::set-env name=TAG::${TAG}"
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.TAG }}
release_name: Release v${{ env.TAG }}
draft: true
prerelease: false

build:
needs: create_release
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# os: [ubuntu-latest, macos-latest, windows-latest]
os: [macos-latest]
# Linux: https://download.qt.io/online/qtsdkrepository/linux_x64/desktop/
# macOS: https://download.qt.io/online/qtsdkrepository/mac_x64/desktop/
# Windows: https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/
qt-version: ['5.13.2']
steps:
- uses: actions/checkout@v2
with:
submodules: true
- if: contains( matrix.os, 'ubuntu')
name: Install additional packages
run: |
sudo apt install libprocps-dev

#
# Install Qt
#

- name: Cache Qt
id: cache-qt
uses: actions/cache@v1
with:
path: ../Qt
key: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}
# https://github.com/marketplace/actions/install-qt
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: ${{ matrix.qt-version }}
cached: ${{ steps.cache-qt.outputs.cache-hit }}

#
# Build project
#

- if: contains( matrix.os, 'macos')
name: Build for macOS
run: |
brew install imagemagick create-dmg tree
rm -rf build
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make install
tree -dl install
tar cz install > opentrack-mac.tar.gz
#${Qt5_Dir}/bin/macdeployqt $APP.app
#git clone --depth=1 https://github.com/aurelien-rainone/macdeployqtfix.git
#python macdeployqtfix/macdeployqtfix.py $APP.app/Contents/MacOS/$APP /usr/local
env:
APP: OpenTrack

- if: contains( matrix.os, 'macos')
name: Release for macOS
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./build/opentrack-mac.tar.gz
asset_name: opentrack-mac.tar.gz
asset_content_type: application/gzip

publish_release:
name: Publish release
runs-on: ubuntu-latest
needs: [create_release, build]
steps:
- name: Publish draft release
uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ needs.create_release.outputs.release_id }}
54 changes: 54 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build

on:
push:
pull_request:
workflow_dispatch:

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# Linux: https://download.qt.io/online/qtsdkrepository/linux_x64/desktop/
# macOS: https://download.qt.io/online/qtsdkrepository/mac_x64/desktop/
# Windows: https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/
qt-version: ['5.13.2']
steps:
- uses: actions/checkout@v2
with:
submodules: true
- if: contains( matrix.os, 'ubuntu')
name: Install additional packages
run: |
sudo apt install libprocps-dev

#
# Install Qt
#

- name: Cache Qt
id: cache-qt
uses: actions/cache@v1
with:
path: ../Qt
key: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}
# https://github.com/marketplace/actions/install-qt
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: ${{ matrix.qt-version }}
cached: ${{ steps.cache-qt.outputs.cache-hit }}

#
# Build project
#

- name: Run cmake
run: |
cmake CMakeLists.txt
- name: Build OpenTrack
run: |
cmake --build .