1
0
2021-06-21 04:29:29 +08:00

114 lines
4.0 KiB
YAML

name: Build & Package
on:
push:
branches: [ main, develop ]
paths-ignore:
- '**/README.md'
- 'resource/ts/**'
- 'docs/**'
pull_request:
branches: [ develop ]
paths-ignore:
- '**/README.md'
- 'resource/ts/**'
- 'docs/**'
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
EXECUTABLE_OUTPUT_PATH: ./
jobs:
build:
strategy:
matrix:
os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
runs-on: ${{ matrix.os }}
timeout-minutes: 18
steps:
- uses: actions/checkout@v2
- name: Install Dependence (Linux)
run: |
sudo apt-get update
sudo apt-get -y install build-essential binutils git autoconf automake
sudo apt-get -y install gcc g++
sudo apt-get -y install libgpgme-dev gpg
if: matrix.os == 'ubuntu-latest'
- name: Install Dependence (macOS)
run: |
brew install cmake git autoconf automake qt@5
if: matrix.os == 'macos-latest'
- name: Install Qt
uses: jurplel/install-qt-action@v2
if: matrix.os == 'ubuntu-latest'
- name: Set up MinGW (Windows)
uses: msys2/setup-msys2@v2
with:
install: git msys2-devel base-devel binutils pactoys-git mercurial cvs wget p7zip perl ruby mingw-w64-x86_64-toolchain
update: true
if: matrix.os == 'windows-latest'
- name: Set up Dependence (Windows)
shell: msys2 {0}
run: |
pacman --noconfirm -Syu mingw-w64-x86_64-gcc mingw-w64-x86_64-make mingw-w64-x86_64-cmake autoconf automake mingw-w64-x86_64-qt-creator mingw-w64-x86_64-gpgme
if: matrix.os == 'windows-latest'
- name: Build GpgME
run: |
git clone https://github.com/gpg/gpgme
cd gpgme
./autogen.sh
./configure && make -j2
sudo make install
cd ..
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DEXECUTABLE_OUTPUT_PATH=${{env.EXECUTABLE_OUTPUT_PATH}}
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
- name: Build GpgFrontend
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config $env.BUILD_TYPE}} -- -j 2
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
- name: Configure CMake & Build Binary(Windows)
shell: msys2 {0}
run: |
cd $(echo "/${{github.workspace}}" | sed 's/\\/\//g' | sed 's/://')
mkdir build && cd build
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DEXECUTABLE_OUTPUT_PATH=${{env.EXECUTABLE_OUTPUT_PATH}} ..
# Build your program with the given configuration
cmake --build . --config ${{env.BUILD_TYPE}} -- -j 2
if: matrix.os == 'windows-latest'
- name: Upload Artifact(Linux)
uses: actions/upload-artifact@master
with:
name: gpgfrontend-linux-release-${{github.sha}}
path: ${{github.workspace}}/build/release/*
if: matrix.os == 'ubuntu-latest'
- name: Upload Artifact(macOS)
uses: actions/upload-artifact@master
with:
name: gpgfrontend-macos-release-${{github.sha}}
path: ${{github.workspace}}/build/release/*
if: matrix.os == 'macos-latest'
- name: Upload Artifact(Windows)
uses: actions/upload-artifact@master
with:
name: gpgfrontend-windows-release-${{github.sha}}
path: ${{github.workspace}}/build/release/*
if: matrix.os == 'windows-latest'