-
Notifications
You must be signed in to change notification settings - Fork 2
195 lines (160 loc) · 6.02 KB
/
main.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
name: CMake
on:
push:
branches: [ "main" ]
tags:
- 'v*'
pull_request:
branches: [ "main" ]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
build-host:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
arch-name: linuxx86-64
runs-on: ${{ matrix.os }}
name: "mrcal-jni - Build - ${{ matrix.arch-name }}"
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
fetch-depth: 0
- name: Fetch tags
run: git fetch --tags --force
- run: git describe --tags
- name: Install Java 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
- name: Setup cmake
uses: jwlawson/[email protected]
- name: Install deps
run: |
sudo bash -c "echo 'deb [trusted=yes] http://mrcal.secretsauce.net/packages/jammy/public/ jammy main' >> /etc/apt/sources.list"
sudo apt update
sudo apt-get install -y cmake gcc g++ mrbuild libsuitesparse-dev liblist-moreutils-perl
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/cmake_build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DOPENCV_ARCH=${{ matrix.arch-name }}
- name: Build shared mrcal_jni
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/cmake_build --config ${{env.BUILD_TYPE}} ${{ (startsWith(matrix.arch-name, 'windowx86-64') && '--config Release') || '' }} -j --target mrcal_jni
- name: Gradle build
# Build your program with the given configuration
run: ./gradlew build
- run: ./gradlew publish
name: Publish
env:
ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }}
if: github.event_name == 'push'
- uses: actions/upload-artifact@v4
with:
name: libmrcal-jar-${{ matrix.arch-name }}
path: |
${{ github.workspace }}/build/libs/*.jar
build-raspi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
fetch-depth: 0
- name: Fetch tags
run: git fetch --tags --force
- run: git describe --tags
- uses: pguyot/arm-runner-action@v2
with:
base_image: raspios_lite_arm64:latest
cpu: cortex-a7
image_additional_mb: 2500
bind_mount_repository: true
commands: |
sudo bash -c "echo 'deb [trusted=yes] http://mrcal.secretsauce.net/packages/jammy/public/ jammy main' >> /etc/apt/sources.list"
sudo apt update
sudo apt install cmake default-jdk default-jre git gcc g++ libmrcal-dev mrbuild libsuitesparse-dev liblist-moreutils-perl -y
cmake -B cmake_build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DOPENCV_ARCH=linuxarm64
cmake --build cmake_build --config ${{env.BUILD_TYPE}} -j --target mrcal_jni
- run: |
./gradlew build ${{ (startsWith(github.event_name, 'push') && 'publish') || '' }} -PArchOverride=linuxarm64
env:
ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }}
- uses: actions/upload-artifact@v4
name: Upload jar
with:
name: libmrcal-jar-pi
path: ${{ github.workspace }}/build/libs/*.jar
build-windows:
runs-on: windows-latest
name: "mrcal-jni - Build - Windows"
env:
BUILD_TYPE: "Release"
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
fetch-depth: 0
- name: Fetch tags
run: git fetch --tags --force
- run: git describe --tags
- name: Install Java 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
- name: Setup cmake
uses: jwlawson/[email protected]
- name: Setup anew (or from cache) vcpkg (and does not build any package)
uses: lukka/run-vcpkg@v11 # Always specify the specific _version_ of the
# action you need, `v10` in this case to stay up
# to date with fixes on the v11 branch.
with:
runVcpkgInstall: true
- name: Configure CMake
run: cmake -B ${{github.workspace}}/cmake_build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DOPENCV_ARCH=windowsx86-64 -T ClangCl -A x64 -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE="vcpkg/scripts/buildsystems/vcpkg.cmake"
- name: Build shared mrcal_jni
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/cmake_build --config ${{env.BUILD_TYPE}} -j --target mrcal_jni
- name: Gradle build
# Build your program with the given configuration
run: ./gradlew build
- run: ./gradlew publish
name: Publish
env:
ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }}
if: github.event_name == 'push'
- uses: actions/upload-artifact@v4
with:
name: libmrcal-jar-windowsx64
path: ${{ github.workspace }}/build/libs/*.jar
release:
needs: [build-host, build-raspi]
runs-on: ubuntu-22.04
steps:
# Download literally every single artifact. This also downloads client and docs,
# but the filtering below won't pick these up (I hope)
- uses: actions/download-artifact@v4
- run: find
# Push to dev release on pushes to master
- uses: pyTooling/Actions/releaser@r0
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: 'Dev'
rm: true
files: |
**/*
if: github.event_name == 'push'
# Push to actual release, if tagged
- uses: softprops/action-gh-release@v2
with:
files: |
**/*
if: startsWith(github.ref, 'refs/tags/v')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}