1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-18 17:40:48 +02:00
vcmi/.github/workflows/github.yml

182 lines
5.6 KiB
YAML
Raw Normal View History

2021-07-27 20:26:17 +02:00
name: VCMI
2021-07-05 19:04:17 +02:00
2021-07-27 20:26:17 +02:00
on:
push:
branches:
- features/*
- develop
2022-09-06 10:08:22 +02:00
- cpp-map-editor
2021-07-27 20:26:17 +02:00
pull_request:
2021-07-05 19:04:17 +02:00
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
2022-05-27 09:11:44 +02:00
BUILD_TYPE: Release
2021-07-05 19:04:17 +02:00
jobs:
build:
strategy:
matrix:
include:
- platform: linux
os: ubuntu-20.04
test: 0
preset: linux-clang-release
2021-07-05 19:04:17 +02:00
- platform: linux
os: ubuntu-20.04
test: 0
preset: linux-gcc-release
- platform: mac-intel
os: macos-12
test: 0
pack: 1
extension: dmg
preset: macos-conan-ninja-release
conan_profile: macos-intel
artifact_platform: intel
- platform: mac-arm
os: macos-12
test: 0
pack: 1
extension: dmg
preset: macos-arm-conan-ninja-release
conan_profile: macos-arm
artifact_platform: arm
2021-07-05 19:04:17 +02:00
- platform: mxe
os: ubuntu-20.04
mxe: i686-w64-mingw32.shared
test: 0
pack: 1
2021-07-20 09:41:04 +02:00
cpack_args: -D CPACK_NSIS_EXECUTABLE=`which makensis`
extension: exe
2022-09-06 16:56:43 +02:00
cmake_args: -G Ninja -DENABLE_EDITOR=0
2021-07-27 20:26:17 +02:00
- platform: msvc
os: windows-latest
test: 0
pack: 1
extension: exe
preset: windows-msvc-release
2021-07-05 19:04:17 +02:00
runs-on: ${{ matrix.os }}
2021-07-27 20:26:17 +02:00
defaults:
run:
shell: bash
2021-07-05 19:04:17 +02:00
steps:
- uses: actions/checkout@v3
2021-07-05 19:04:17 +02:00
with:
submodules: recursive
- name: Dependencies
2021-07-27 20:26:17 +02:00
run: source '${{github.workspace}}/CI/${{matrix.platform}}/before_install.sh'
2021-07-05 19:04:17 +02:00
env:
MXE_TARGET: ${{ matrix.mxe }}
2021-07-27 20:26:17 +02:00
VCMI_BUILD_PLATFORM: x64
- name: Conan setup
if: "${{ matrix.conan_profile != '' }}"
run: |
pip3 install conan
conan profile new default --detect
conan install . \
--install-folder=conan-generated \
--no-imports \
--build=never \
--profile:build=default \
--profile:host=CI/conan/${{ matrix.conan_profile }}
2021-07-05 19:04:17 +02:00
- name: Git branch name
id: git-branch-name
uses: EthanSK/git-branch-name-action@v1
- name: Build Number
run: |
2021-07-27 20:26:17 +02:00
source '${{github.workspace}}/CI/get_package_name.sh'
if [ '${{ matrix.artifact_platform }}' ]; then
VCMI_PACKAGE_FILE_NAME+="-${{ matrix.artifact_platform }}"
fi
2021-07-05 19:04:17 +02:00
echo VCMI_PACKAGE_FILE_NAME="$VCMI_PACKAGE_FILE_NAME" >> $GITHUB_ENV
echo VCMI_PACKAGE_NAME_SUFFIX="$VCMI_PACKAGE_NAME_SUFFIX" >> $GITHUB_ENV
env:
PULL_REQUEST: ${{ github.event.pull_request.number }}
- name: Configure CMake
if: "${{ matrix.preset == '' }}"
2021-07-05 19:04:17 +02:00
run: |
mkdir -p '${{github.workspace}}/out/build/${{matrix.preset}}'
cd '${{github.workspace}}/out/build/${{matrix.preset}}'
cmake \
../.. -GNinja \
${{matrix.cmake_args}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
2021-07-05 19:04:17 +02:00
-DENABLE_TEST=${{matrix.test}} \
-DPACKAGE_NAME_SUFFIX:STRING="$VCMI_PACKAGE_NAME_SUFFIX" \
-DPACKAGE_FILE_NAME:STRING="$VCMI_PACKAGE_FILE_NAME"
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
- name: CMake Preset
if: "${{ matrix.preset != '' }}"
run: |
cmake --preset ${{ matrix.preset }}
2021-07-05 19:04:17 +02:00
- name: Build
if: "${{ matrix.preset == '' }}"
2021-07-05 19:04:17 +02:00
run: |
cmake --build '${{github.workspace}}/out/build/${{matrix.preset}}'
- name: Build Preset
if: "${{ matrix.preset != '' }}"
2021-07-27 20:26:17 +02:00
run: |
cmake --build --preset ${{matrix.preset}}
2021-07-05 19:04:17 +02:00
- name: Test
if: ${{ matrix.test == 1 && matrix.preset != ''}}
2021-07-05 19:04:17 +02:00
run: |
ctest --preset ${{matrix.preset}}
- name: Pack
2021-07-05 19:04:17 +02:00
id: cpack
if: ${{ matrix.pack == 1 }}
2021-07-05 19:04:17 +02:00
run: |
cd '${{github.workspace}}/out/build/${{matrix.preset}}'
CPACK_PATH=`which -a cpack | grep -m1 -v -i chocolatey`
"$CPACK_PATH" -C ${{env.BUILD_TYPE}} ${{ matrix.cpack_args }}
rm -rf _CPack_Packages
2021-07-05 19:04:17 +02:00
- name: Additional logs
if: ${{ failure() && steps.cpack.outcome == 'failure' && matrix.platform == 'mxe' }}
run: |
cat '${{github.workspace}}/out/build/${{matrix.preset}}/_CPack_Packages/win32/NSIS/project.nsi'
cat '${{github.workspace}}/out/build/${{matrix.preset}}/_CPack_Packages/win32/NSIS/NSISOutput.log'
- name: Artifacts
if: ${{ matrix.pack == 1 }}
uses: actions/upload-artifact@v3
with:
name: ${{ env.VCMI_PACKAGE_FILE_NAME }} - ${{ matrix.platform }}
path: |
${{github.workspace}}/**/${{ env.VCMI_PACKAGE_FILE_NAME }}.${{ matrix.extension }}
- name: Upload build
if: ${{ matrix.pack == 1 && (github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/features/')) && matrix.platform != 'msvc' }}
run: |
cd '${{github.workspace}}/out/build/${{matrix.preset}}'
2021-07-27 20:26:17 +02:00
source '${{github.workspace}}/CI/upload_package.sh'
env:
DEPLOY_RSA: ${{ secrets.DEPLOY_RSA }}
PACKAGE_EXTENSION: ${{ matrix.extension }}
2021-07-05 19:04:17 +02:00
- uses: act10ns/slack@v1
with:
status: ${{ job.status }}
channel: '#notifications'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()
2021-11-15 08:38:34 +02:00
- name: Trigger Android
uses: peter-evans/repository-dispatch@v1
if: ${{ github.ref == 'refs/heads/develop' && matrix.platform == 'mxe' }}
with:
token: ${{ secrets.VCMI_ANDROID_ACCESS_TOKEN }}
repository: vcmi/vcmi-android
event-type: vcmi