Build #22
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 | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main] | |
env: | |
# Customize the CMake build type here (Release, MinSizeRel, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: MinSizeRel | |
QT_VERSION: 5.15.2 | |
jobs: | |
Build: | |
strategy: | |
matrix: | |
config: | |
[ | |
{ os: macos-latest, arch: clang_64 }, | |
{ os: windows-latest, arch: win64_msvc2019_64 }, | |
] | |
runs-on: ${{ matrix.config.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v3 | |
with: | |
version: ${{ env.QT_VERSION }} | |
arch: ${{ matrix.config.arch }} | |
dir: ${{ github.workspace }} | |
cache: true | |
cache-key-prefix: ${{ runner.os }}-Install-Qt-${{ env.QT_VERSION }}-Action | |
# - name: Cache Qt5 | |
# id: cache-qt5-brew | |
# uses: actions/cache@v3 | |
# with: | |
# path: /usr/local/Cellar/qt@5/ | |
# key: qt5-brew | |
# - name: Install Qt5 | |
# if: ${{ steps.cache-qt5-brew.outputs.cache-hit != true }} | |
# run: brew install qt@5 | |
# - name: Add Qt5 to GITHUB_PATH | |
# run: echo "/usr/local/opt/qt@5/bin" >> $GITHUB_PATH | |
- name: Configure CMake | |
# Already append Qt bin path to PATH, so no need to add -DCMAKE_PREFIX_PATH | |
run: cmake -B ${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} | |
- name: Build | |
# Build your program with the given configuration | |
run: cmake --build ${{ github.workspace }}/build --config ${{ env.BUILD_TYPE }} | |
# - name: Test | |
# working-directory: ${{ github.workspace }}/build | |
# Execute tests defined by the CMake configuration. | |
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | |
# run: ctest -C ${{ env.BUILD_TYPE }} | |
- name: macOS deploy | |
if: runner.os == 'macOS' | |
run: macdeployqt ${{ github.workspace }}/build/CopyPlusPlus.app | |
- name: Create DMG | |
if: runner.os == 'macOS' | |
continue-on-error: true | |
shell: bash | |
run: | | |
pwd | |
cd ${{ github.workspace }}/build | |
echo "Installing create-dmg" | |
npm install --global create-dmg | |
echo "Creating DMG" | |
create-dmg CopyPlusPlus.app | |
- name: Upload macOS Artifact | |
if: runner.os == 'macOS' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: CopyPlusPlus-macOS | |
path: ${{ github.workspace }}/build/CopyPlusPlus*.dmg | |
- name: Download macOS Artifact | |
if: runner.os == 'macOS' | |
uses: actions/download-artifact@v3 | |
with: | |
# Artifact name | |
name: CopyPlusPlus-macOS | |
- name: Windows deploy | |
if: runner.os == 'Windows' | |
run: | | |
mkdir ${{ github.workspace }}/CopyPlusPlus | |
mv ${{ github.workspace }}/build/${{ env.BUILD_TYPE }}/CopyPlusPlus.exe ${{ github.workspace }}/CopyPlusPlus/CopyPlusPlus.exe | |
cd ${{ github.workspace }}/CopyPlusPlus | |
windeployqt CopyPlusPlus.exe | |
- name: Upload Windows Artifact | |
if: runner.os == 'Windows' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: CopyPlusPlus-win | |
path: ${{ github.workspace }}/CopyPlusPlus/ | |
- name: Download Windows Artifact | |
if: runner.os == 'Windows' | |
uses: actions/download-artifact@v3 | |
with: | |
# Artifact name | |
name: CopyPlusPlus-win |