Skip to content

Merge pull request #2788 from MerginMaps/master_multilineFix #1529

Merge pull request #2788 from MerginMaps/master_multilineFix

Merge pull request #2788 from MerginMaps/master_multilineFix #1529

Workflow file for this run

name: Build win64
on:
push:
paths:
- 'app/**'
- 'core/**'
- 'scripts/**'
- 'cmake/**'
- 'cmake_templates/**'
- 'CMakeLists.txt'
- '.github/workflows/win.yml'
release:
types:
- published
concurrency:
group: ci-${{github.ref}}-windows
cancel-in-progress: true
jobs:
win64_build:
if: ( github.repository == 'MerginMaps/input' ) && (!contains(github.event.head_commit.message, 'Translate '))
runs-on: windows-2019
env:
QT_VERSION: '6.5.2'
INPUT_SDK_VERSION: x64-windows-20230824-209
CCACHE_DIR: C:/ccache-cache # https://linux.die.net/man/1/ccache
CACHE_VERSION: 3
VS_VERSION: "2019"
QT_ARCH: "win64_msvc2019_64"
steps:
- name: Checkout Input
uses: actions/checkout@v3
with:
path: input
- name: Prepare vars
id: vars
shell: bash
run: |
WORKSPACE_DIR=$(cygpath -m "${{ github.workspace }}")
echo "WORKSPACE_DIR=$WORKSPACE_DIR" >> $GITHUB_OUTPUT
echo "WORKSPACE_DIR: $WORKSPACE_DIR"
- name: Install ccache
shell: cmd
run: |
choco install ccache
choco install nsis
where ccache
where openssl
where makensis
- name: Extract Mergin API_KEY
shell: cmd
env:
MERGINSECRETS_DECRYPT_KEY: ${{ secrets.MERGINSECRETS_DECRYPT_KEY }}
run: |
cd input/core/
openssl aes-256-cbc -d -in merginsecrets.cpp.enc -out merginsecrets.cpp -k "%MERGINSECRETS_DECRYPT_KEY%" -md md5
- name: Prepare build cache for pull request
uses: pat-s/[email protected]
if: github.event_name == 'pull_request'
with:
path: ${{ env.CCACHE_DIR }}
key: build-win64-ccache-${{ github.actor }}-${{ github.head_ref }}-${{ github.sha }}
# The head_ref or source branch of the pull request in a workflow run.
# The base_ref or target branch of the pull request in a workflow run.
restore-keys: |
build-win64-ccache-${{ github.actor }}-${{ github.head_ref }}-
build-win64-ccache-refs/heads/${{ github.base_ref }}-
build-win64-ccache-refs/heads/master-
- name: Prepare build cache for branch/tag
# use a fork of actions/cache@v2 to upload cache even when the build or test failed
uses: pat-s/[email protected]
if: github.event_name != 'pull_request'
with:
path: ${{ env.CCACHE_DIR }}
# The branch or tag ref that triggered the workflow run. For branches this in the format refs/heads/<branch_name>, and for tags it is refs/tags/<tag_name>
key: build-win64-ccache-${{ github.ref }}-${{ github.sha }}
restore-keys: |
build-win64-ccache-${{ github.ref }}-
build-win64-ccache-refs/heads/master-
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.QT_VERSION }}
target: desktop
arch: ${{ env.QT_ARCH }}
dir: ${{ github.workspace }}
modules: 'qtsensors qtconnectivity qt5compat qtmultimedia qtpositioning qtshadertools'
cache: true
cache-key-prefix: ${{ runner.os }}-QtCache-v0-${{ env.QT_VERSION }}-win
# Input SDK
- name: Cache Input-SDK
id: cache-input-sdk
uses: pat-s/[email protected]
with:
path: ${{ github.workspace }}/input-sdk
key: ${{ runner.os }}-input-sdk-v0-${{ env.INPUT_SDK_VERSION }}-${{ env.CACHE_VERSION }}
- name: Install Input-SDK
shell: bash
if: steps.cache-input-sdk.outputs.cache-hit != 'true'
run: |
URL="https://github.com/MerginMaps/input-sdk/releases/download/${{ env.INPUT_SDK_VERSION }}/mergin-maps-input-sdk-qt-${{ env.QT_VERSION }}-${{ env.INPUT_SDK_VERSION }}.zip"
echo "downloading: $URL"
curl -fsSL --connect-timeout 60 -o \
input-sdk.tar.gz \
${URL}
mkdir -p input-sdk/x64-windows
cd input-sdk/x64-windows
unzip ${{ steps.vars.outputs.WORKSPACE_DIR }}/input-sdk.tar.gz -d .
# Build Input App
- name: Calculate build number
shell: bash
run: |
BUILD_NUM=$GITHUB_RUN_NUMBER$GITHUB_RUN_ATTEMPT
echo "INPUT_VERSION_CODE=${BUILD_NUM}" >> $GITHUB_ENV
echo "Version code: ${BUILD_NUM}"
- name: Developer Command Prompt for Microsoft Visual C++
uses: ilammy/msvc-dev-cmd@v1
with:
vsversion: ${{ env.VS_VERSION }}
- name: Configure Input
shell: cmd
run: |
mkdir install-Input -ea 0
mkdir build-Input -ea 0
cd build-Input
cmake ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_PREFIX_PATH:PATH=${{ env.Qt6_Dir }} ^
-DCMAKE_INSTALL_PREFIX:PATH=${{ steps.vars.outputs.WORKSPACE_DIR }}/install-Input ^
-DINPUT_SDK_PATH:PATH=${{ steps.vars.outputs.WORKSPACE_DIR }}/input-sdk/x64-windows ^
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache ^
-G "NMake Makefiles" ^
-S ${{ steps.vars.outputs.WORKSPACE_DIR }}/input ^
-B .
- name: Build Input
shell: cmd
run: |
cd build-Input
nmake
IF NOT EXIST Input.exe (echo err_INPUT_BUILD & exit /b 1)
- name: Install Input
shell: cmd
run: |
cd build-Input
nmake install
mkdir C:\input-package
mkdir C:\input-package\stage
robocopy ${{ steps.vars.outputs.WORKSPACE_DIR }}/install-Input C:\input-package\stage /E /NFL
dir C:\input-package\stage
- name: Downloading redist
shell: bash
run: |
URL="https://aka.ms/vs/17/release/vc_redist.x64.exe"
echo "downloading: $URL"
curl -fsSL --connect-timeout 60 -o \
/c/input-package/stage/vc_redist.x64.exe \
${URL}
- name: Get TimeStamp
id: time
uses: josStorer/[email protected]
with:
format: 'YYYYMMDD'
- name: create package
shell: cmd
run: |
makensis.exe input\scripts\input_win.nsi
xcopy C:\input-package\inputapp-win-x86_64.exe mergin-maps-input-win64-${{ steps.time.outputs.formattedTime }}-${{ github.run_number }}.exe* /Y
- name: Upload Sdk in Artifacts
uses: actions/upload-artifact@v3
with:
path: mergin-maps-input-win64-${{ steps.time.outputs.formattedTime }}-${{ github.run_number }}.exe
if-no-files-found: error