Skip to content

ensuring user role is cached/updated each time we open a project #4713

ensuring user role is cached/updated each time we open a project

ensuring user role is cached/updated each time we open a project #4713

Workflow file for this run

name: macOS Build
on:
push:
paths:
- 'app/**'
- 'core/**'
- 'scripts/**'
- 'cmake/**'
- 'cmake_templates/**'
- 'test/**'
- 'CMakeLists.txt'
- '.github/workflows/macos.yml'
release:
types:
- published
env:
QT_VERSION: '6.6.3' # use scripts/update_qt_version.bash to change
INPUT_SDK_VERSION: x64-osx-20240517-205
CCACHE_DIR: /Users/runner/work/ccache
CACHE_VERSION: 0
CMAKE_VERSION: '3.29.0'
XC_VERSION: ${{ '15.2' }}
concurrency:
group: ci-${{github.ref}}-macos
cancel-in-progress: true
jobs:
macos_build:
if: ( github.repository == 'MerginMaps/mobile' ) && (!contains(github.event.head_commit.message, 'Translate '))
runs-on: macos-13
steps:
- name: Checkout Input
uses: actions/checkout@v3
with:
path: input
- name: Select latest Xcode
run: "sudo xcode-select -s /Applications/Xcode_$XC_VERSION.app"
- name: install brew deps
run: |
brew install lcov
brew install ccache
brew install ninja
- name: Install CMake and Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: ${{ env.CMAKE_VERSION }}
- name: Extract Mergin API_KEY
env:
MERGINSECRETS_DECRYPT_KEY: ${{ secrets.MERGINSECRETS_DECRYPT_KEY }}
run: |
cd input/core/
/usr/local/opt/openssl@1.1/bin/openssl \
aes-256-cbc -d \
-in merginsecrets.cpp.enc \
-out merginsecrets.cpp \
-k "$MERGINSECRETS_DECRYPT_KEY" \
-md md5
# CCache
- name: Prepare build cache for pull request
uses: pat-s/always-upload-cache@v3.0.11
if: github.event_name == 'pull_request'
with:
path: ${{ env.CCACHE_DIR }}
key: build-mac-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-mac-ccache-${{ github.actor }}-${{ github.head_ref }}-
build-mac-ccache-refs/heads/${{ github.base_ref }}-
build-mac-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/always-upload-cache@v3.0.11
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-mac-ccache-${{ github.ref }}-${{ github.sha }}
restore-keys: |
build-mac-ccache-${{ github.ref }}-
build-mac-ccache-refs/heads/master-
- name: Install ccache
run: |
mkdir -p ${CCACHE_DIR}
ccache --set-config=max_size=2.0G
ccache -s
# Qt
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.QT_VERSION }}
target: desktop
dir: ${{ github.workspace }}
modules: 'qtsensors qtconnectivity qt5compat qtmultimedia qtpositioning qtshadertools'
cache: true
cache-key-prefix: ${{ runner.os }}-QtCache-v0-${{ env.QT_VERSION }}-mac
# Input SDK
- name: Cache Input-SDK
id: cache-input-sdk
uses: pat-s/always-upload-cache@v3.0.11
with:
path: ${{ github.workspace }}/input-sdk
key: ${{ runner.os }}-input-sdk-v0-${{ env.INPUT_SDK_VERSION }}-${{ env.CACHE_VERSION }}
- name: Install Input-SDK
if: steps.cache-input-sdk.outputs.cache-hit != 'true'
run: |
wget -O \
${{ github.workspace }}/input-sdk.tar.gz \
https://github.com/MerginMaps/mobile-sdk/releases/download/${{ env.INPUT_SDK_VERSION }}/mergin-maps-input-sdk-qt-${{ env.QT_VERSION }}-${{ env.INPUT_SDK_VERSION }}.tar.gz
mkdir -p ${{ github.workspace }}/input-sdk/x64-osx
cd ${{ github.workspace }}/input-sdk/x64-osx
tar -xvzf ${{ github.workspace }}/input-sdk.tar.gz
# Build Input App
- name: Calculate build number
run: |
BUILD_NUM=$GITHUB_RUN_NUMBER$GITHUB_RUN_ATTEMPT
echo "INPUT_VERSION_CODE=${BUILD_NUM}" >> $GITHUB_ENV
echo "Version code: ${BUILD_NUM}"
# Do Tests
- name: build Input (Debug)
run: |
mkdir -p build-Input-db
cd build-Input-db
cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/Qt/${{ env.QT_VERSION }}/macos \
-DUSE_SERVER_API_KEY=TRUE \
-DINPUT_SDK_PATH=${{ github.workspace }}/input-sdk/x64-osx \
-DQGIS_QUICK_DATA_PATH=${{ github.workspace }}/input/app/android/assets/qgis-data \
-DCOVERAGE=TRUE \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DENABLE_TESTS=TRUE \
-GNinja \
-S ../input
ninja
- name: run tests
env:
TEST_MERGIN_URL: https://app.dev.merginmaps.com/
TEST_API_USERNAME: test_mobileapp2
TEST_API_PASSWORD: ${{ secrets.TEST_API_PASSWORD }}
run: |
cd build-Input-db/
ctest --output-on-failure
# Package
- name: build Input (Release)
run: |
mkdir -p install-Input
mkdir -p build-Input-rel
cd build-Input-rel
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/Qt/${QT_VERSION}/macos \
-DCMAKE_INSTALL_PREFIX:PATH=../install-Input \
-DUSE_SERVER_API_KEY=TRUE \
-DUSE_MM_SERVER_API_KEY=TRUE \
-DINPUT_SDK_PATH=${{ github.workspace }}/input-sdk/x64-osx \
-DQGIS_QUICK_DATA_PATH=${{ github.workspace }}/input/app/android/assets/qgis-data \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-GNinja \
-S ../input
ninja
ninja install
- name: Get TimeStamp
id: time
uses: josStorer/get-current-time@v2.0.2
with:
format: 'YYYYMMDD'
- name: package Input.app
run: |
INPUT_TAR=input-${{ env.INPUT_SDK_VERSION }}-${{ steps.time.outputs.formattedTime }}-${{ github.run_number }}.tar.gz
echo "INPUT_TAR=${INPUT_TAR}" >> $GITHUB_ENV
cd ${{ github.workspace }}/install-Input
find .
tar -c -z -f ${{ github.workspace }}/${INPUT_TAR} "./Input.app"
- name: Upload Sdk in Artifacts
uses: actions/upload-artifact@v3
with:
path: ${{ github.workspace }}/${{ env.INPUT_TAR }}