Luca D'Amico c8fc9006f2
Add Windows CI (via GitHub Actions) (#11)
* Create GUI executable if building on Windows
* Enable Windows CI (via GitHub Actions)
2021-03-01 16:50:12 +01:00

145 lines
3.7 KiB
YAML

name: NDSFactory-Builds
on:
push:
branches: master
env:
BUILD_TYPE: Release
jobs:
clean-old-autorelease:
runs-on: ubuntu-latest
steps:
- uses: dev-drprasad/delete-tag-and-release@v0.1.3
with:
delete_release: true
tag_name: autobuild
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Create Build Environment
run: |
sudo apt-get update
sudo apt-get install -y build-essential qt5-default cmake
mkdir build
- name: Configure CMake
working-directory: ${{github.workspace}}/build
shell: bash
run: |
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE ..
- name: Build
working-directory: ${{github.workspace}}/build
shell: bash
run: |
make -j4
- name: Archive Artifact
working-directory: ${{github.workspace}}
shell: bash
run: |
git_hash=$(git rev-parse --short "$GITHUB_SHA")
cd build
tar -czvf NDSFactory_${git_hash}__Linux_x86_64.tar.gz NDSFactory ../README.md ../LICENSE
- name: Release on GitHub
uses: ncipollo/release-action@v1
with:
artifacts: "build/NDSFactory_*__Linux_x86_64.tar.gz"
allowUpdates: true
tag: "autobuild"
token: ${{ secrets.GITHUB_TOKEN }}
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Install Qt
uses: jurplel/install-qt-action@v2
- name: Install CMake
uses: lukka/get-cmake@latest
- name: Create Build Environment
run: |
mkdir build
- name: Configure CMake
working-directory: ${{github.workspace}}/build
shell: bash
run: |
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE ..
- name: Build
working-directory: ${{github.workspace}}/build
shell: bash
run: |
make -j4
macdeployqt NDSFactory.app
- name: Archive Artifact
working-directory: ${{github.workspace}}
shell: bash
run: |
git_hash=$(git rev-parse --short "$GITHUB_SHA")
cd build
zip -r NDSFactory_${git_hash}__macOS_x86_64.zip NDSFactory.app ../README.md ../LICENSE
- name: Release on GitHub
uses: ncipollo/release-action@v1
with:
artifacts: "build/NDSFactory_*__macOS_x86_64.zip"
allowUpdates: true
tag: "autobuild"
token: ${{ secrets.GITHUB_TOKEN }}
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Install Qt
uses: jurplel/install-qt-action@v2
- name: Install CMake
uses: lukka/get-cmake@latest
- name: Create Build Environment
run: |
mkdir build
- name: Configure CMake
working-directory: ${{github.workspace}}/build
run: |
cmake ..
- name: Build
working-directory: ${{github.workspace}}/build
run: |
cmake --build . -j4 --config Release
mkdir .\Release\prod
move .\Release\NDSFactory.exe .\Release\prod
windeployqt .\Release\prod\NDSFactory.exe
- name: Archive Artifact
working-directory: ${{github.workspace}}/build/Release
run: |
xcopy ..\..\README.md .\prod
xcopy ..\..\LICENSE .\prod
powershell "Compress-Archive -Path .\prod\* -DestinationPath .\NDSFactory_AUTOBUILD__Windows_x86_64.zip"
- name: Release on GitHub
uses: ncipollo/release-action@v1
with:
artifacts: "build/Release/NDSFactory_*__Windows_x86_64.zip"
allowUpdates: true
tag: "autobuild"
token: ${{ secrets.GITHUB_TOKEN }}