add build and release workflow #31
Workflow file for this run
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
name: Build and Release PlatypusGui | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
build: | |
name: Build and Upload Artifacts | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
# Get dependencies | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Get Ninja | |
uses: seanmiddleditch/gha-setup-ninja@master | |
- name: Set up CMake | |
uses: jwlawson/actions-setup-cmake@v1 | |
with: | |
cmake-version: '3.16' | |
- name: Install Qt | |
if : matrix.os != 'macos-latest' | |
uses: jurplel/install-qt-action@v4 | |
with: | |
cache: true | |
## Windows Build ## | |
- name: run-vcpkg | |
if: matrix.os == 'windows-latest' | |
uses: lukka/run-vcpkg@v11.5 | |
with: | |
vcpkgJsonGlob: 'vcpkg.json' | |
vcpkgGitCommitId: 'c82f74667287d3dc386bce81e44964370c91a289' | |
# Install OpenCV via vcpkg | |
- name: Install OpenCV via vcpkg | |
if: matrix.os == 'windows-latest' | |
run: | | |
.\vcpkg\vcpkg.exe install | |
# Set up MSVC environment | |
- name: Set up MSVC environment | |
if: matrix.os == 'windows-latest' | |
shell: cmd | |
run: | | |
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath`) do set InstallDir=%%i | |
call "%InstallDir%\VC\Auxiliary\Build\vcvarsall.bat" x64 | |
# Configure CMake (Windows) | |
- name: Configure CMake (Windows) | |
if: matrix.os == 'windows-latest' | |
shell: cmd | |
run: | | |
cmake -B build -S . -G Ninja ^ | |
-DCMAKE_TOOLCHAIN_FILE=%cd%\vcpkg\scripts\buildsystems\vcpkg.cmake ^ | |
-DCMAKE_BUILD_TYPE=Release | |
## End Windows Build ## | |
## Linux setup ## | |
- name: Install dependencies on Linux | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libopencv-dev libxcb1-dev | |
# 3. Configure CMake | |
- name: Configure CMake | |
if : matrix.os == 'ubuntu-latest' | |
run: cmake -B build -S . -G Ninja -DCMAKE_BUILD_TYPE=Release | |
## End Linux setup ## | |
## macOS setup ## | |
- name: Install dependencies on macOS | |
if: matrix.os == 'macos-latest' | |
run: | | |
brew install opencv qt@5 | |
# Configure CMake for macOS | |
- name: Configure CMake (macOS) | |
if: matrix.os == 'macos-latest' | |
run: cmake -B build -S . -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=arm64 | |
## End macOS setup ## | |
# 4. Build the project | |
- name: Build PlatypusGui | |
run: cmake --build build --config Release --target PlatypusGui | |
# 5. Archive the build output3 | |
- name: Archive build output | |
if: matrix.os == 'ubuntu-latest' | |
run: zip -r PlatypusGui-linux.zip build/PlatypusGui | |
- name: Archive build output | |
if: matrix.os == 'macos-latest' | |
run: zip -r PlatypusGui-mac.zip build/PlatypusGui | |
- name: Archive build output | |
if: matrix.os == 'windows-latest' | |
run: Compress-Archive -Path build\Release\PlatypusGui.exe -DestinationPath PlatypusGui-windows.zip | |
# 6. Upload artifacts for release | |
- name: Upload Release Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.os }}-platypus | |
path: | | |
PlatypusGui-linux.zip | |
PlatypusGui-mac.zip | |
PlatypusGui-windows.zip | |