72 lines (64 loc) · 2.12 KB
/
build-native.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Build native
on:
workflow_call:
inputs:
runner:
description: Platforms to execute on.
required: true
type: string
binary:
description: Binary to build.
required: true
type: string
build:
description: Build for devices, in format of a string JSON array
required: true
type: string
jobs:
build-native:
runs-on: ${{ inputs.runner }}
defaults:
run:
working-directory: packages/realm_dart
name: Build native
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
build: ${{ fromJSON(inputs.build) }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Check cache
id: check-cache
uses: actions/cache@v4
with:
path: ./packages/realm_dart/binary/**
key: binaries-${{ matrix.build }}-${{ inputs.runner }}-${{hashFiles('./packages/realm_dart/src/**')}}
- name: Setup Ninja
if: steps.check-cache.outputs.cache-hit != 'true' && (startsWith(matrix.build, 'android') || startsWith(matrix.build, 'linux'))
run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build
- name: Setup Android NDK
if: startsWith(matrix.build, 'android')
run: echo "ANDROID_NDK=$ANDROID_NDK_LATEST_HOME" >> $GITHUB_ENV
- name: Select XCode for MacOS
if: matrix.build == 'macos'
run: |
xcodes installed
xcodes select 15.2
- name: Build
if: steps.check-cache.outputs.cache-hit != 'true'
run: |
cmake --preset ${{ startsWith(matrix.build, 'ios-') && 'ios' || matrix.build }}
cmake --build --preset ${{ matrix.build }} --config Release ${{ startsWith(matrix.build, 'android-') && '--target strip' || '' }}
- name: Store artifacts
uses: actions/upload-artifact@v4
with:
name: librealm-${{ matrix.build }}
path: packages/realm_dart/binary/${{ inputs.binary }}/**
retention-days: 1
if-no-files-found: error