Skip to content

Commit

Permalink
Add Github runner (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrido committed Apr 20, 2020
1 parent 14f9a27 commit c895212
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 2 deletions.
101 changes: 101 additions & 0 deletions .github/workflows/main.yml
@@ -0,0 +1,101 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
name: ${{ matrix.config.name }}-${{ matrix.type }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows x32",
os: windows-latest,
cpack_install_generator: -G WIX,
generator: "-G'Visual Studio 16 2019' -A Win32",
qt_arch: 'win32_msvc2017'
}
- {
name: "Windows x64",
os: windows-latest,
cpack_install_generator: -G WIX,
generator: "-G'Visual Studio 16 2019' -A x64",
qt_arch: 'win64_msvc2017_64'
}
- {
name: "Ubuntu",
os: ubuntu-latest,
cpack_install_generator: -G DEB
}
- {
name: "MacOS",
os: macos-latest,
cpack_install_generator: -G DragNDrop
}
type: [portable, installer]

steps:
- name: 🐞Fixup chocolately
run: Remove-Item -Path $env:ChocolateyInstall\\bin\\cpack.exe -Force
shell: pwsh
if: "contains(matrix.config.os, 'windows')"

- name: Checkout
uses: actions/checkout@v1
with:
submodules: true
- name: Cache Qt
id: cache-qt
uses: actions/cache@v1
with:
path: ../Qt
key: ${{ runner.os }}-QtCache-${{matrix.config.qt_arch}}
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: 5.12.8
arch: ${{matrix.config.qt_arch}}
cached: ${{ steps.cache-qt.outputs.cache-hit }}

- name: CMake
run: |
echo -DBUILD_PORTABLE=$PORTABLE
cmake ${{matrix.config.generator}} -DCMAKE_BUILD_TYPE=Release . -DBUILD_PORTABLE=$PORTABLE
shell: bash
env:
PORTABLE: ${{contains(matrix.type, 'portable')}}

- name: Build
run: cmake --build . --config Release

- name: Package Install
run: cpack ${{matrix.config.cpack_install_generator}} -B "$GITHUB_WORKSPACE/Package"
if: "!contains(matrix.type, 'portable')"
shell: bash

- name: Package Portable
run: |
cpack -G ZIP -B "$GITHUB_WORKSPACE/Package"
ls $GITHUB_WORKSPACE/Package
if: "contains(matrix.type, 'portable')"
shell: bash

- name: Package Clean
run: rm -r $GITHUB_WORKSPACE/Package/_CPack_Packages
shell: bash

- uses: actions/upload-artifact@v1
with:
name: ${{ matrix.config.name }}-${{ matrix.type }}
path: ./Package/

8 changes: 6 additions & 2 deletions CMakeLists.txt
Expand Up @@ -141,7 +141,7 @@ if(WIN32)
set(INSTALL_RUNTIME_DIR ".")
endif()

if(UNIX)
if(UNIX AND NOT APPLE)
set(ICON_DIR "/usr/local/share/icons/hicolor/scalable/apps")
if(BUILD_PORTABLE)
set(ICON_DIR ".")
Expand All @@ -158,6 +158,7 @@ install(TARGETS MinetestMapperGUI
RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR}
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
BUNDLE DESTINATION .
)

install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/translations/
Expand Down Expand Up @@ -189,7 +190,7 @@ if(WIN32)
DESTINATION ${INSTALL_RUNTIME_DIR}
CONFIGURATIONS RelWithDebInfo
FILES_MATCHING PATTERN "*.dll")
elseif(UNIX)
elseif(UNIX AND NOT APPLE)
install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/mtmapperenv.sh
DESTINATION ${INSTALL_RUNTIME_DIR})
if(BUILD_PORTABLE)
Expand All @@ -200,4 +201,7 @@ elseif(UNIX)
endif()
endif()


set(CPACK_PACKAGE_CONTACT "https://github.com/adrido")

include(CPack)

0 comments on commit c895212

Please sign in to comment.