This repository has been archived by the owner on Jan 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
187 lines (155 loc) · 5.5 KB
/
build.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
name: Build
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
metadata:
name: Generate Matrix
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Make matrix
id: generate
run: |
python .github-deps/generate-matrix.py rust/rust-toolchain.toml
outputs:
matrix: ${{ steps.generate.outputs.matrix }}
build:
name: Build
runs-on: windows-latest
needs: metadata
strategy:
matrix: ${{ fromJson(needs.metadata.outputs.matrix) }}
steps:
- name: Checkout Android ImageMagick
uses: actions/checkout@v2
with:
repository: molotovcherry/Android-ImageMagick7
- name: Checkout KMagick
uses: actions/checkout@v2
with:
path: kmagick-rs
- name: Get latest release tag
id: tag
run: |
$dir = Get-ChildItem -Directory -Path "ImageMagick-*" | Select-Object -Last 1
$tag = ($dir | Split-Path -Leaf).Substring(12)
Write-Host "::set-output name=TAG::$tag"
- name: Get toolchain version
uses: SebRollen/toml-action@v1.0.0
id: toolchain
with:
file: kmagick-rs/rust/rust-toolchain.toml
field: toolchain.channel
- name: Fetch latest Android shared libs
if: matrix.android
uses: i3h/download-release-asset@v1
with:
tag: latest
owner: molotovcherry
repo: Android-ImageMagick7
file: imagemagick-7-android-shared.zip
path: jniLibs/
token: ${{ secrets.GITHUB_TOKEN }}
- name: Extract archives
if: matrix.android
run: |
Expand-Archive -Path jniLibs/imagemagick-7-android-shared.zip -DestinationPath jniLibs/
- name: Cache ImageMagick Setup
if: matrix.windows
id: cache-imagemagick
uses: actions/cache@v2
with:
path: app
key: imagemagick-${{ steps.tag.outputs.TAG }}-${{ matrix.im_arch }}
- name: Download ImageMagick Windows DLL release
if: steps.cache-imagemagick.outputs.cache-hit != 'true' && matrix.windows
uses: carlosperate/download-file-action@v1.0.3
with:
file-url: 'https://imagemagick.org/archive/binaries/ImageMagick-${{ steps.tag.outputs.TAG }}-Q16-HDRI-${{ matrix.im_arch }}-dll.exe'
file-name: 'ImageMagick.exe'
- name: Fetch latest Innoextract
if: steps.cache-imagemagick.outputs.cache-hit != 'true' && matrix.windows
uses: i3h/download-release-asset@v1
with:
tag: latest
owner: dscharrer
repo: innoextract
file: /innoextract-.*-windows\.zip/
token: ${{ secrets.GITHUB_TOKEN }}
# running the installer does not work in the runner
- name: Install ImageMagick Windows
if: steps.cache-imagemagick.outputs.cache-hit != 'true' && matrix.windows
run: |
$inno = Resolve-Path -Path innoextract-*-windows.zip
Expand-Archive -Path $inno -DestinationPath inno/
inno/innoextract.exe ImageMagick.exe
- name: Cache LLVM and Clang
id: cache-llvm
uses: actions/cache@v2
with:
path: ${{ runner.temp }}/llvm
key: llvm-12
- name: Install LLVM and Clang # required for bindgen to work, see https://github.com/rust-lang/rust-bindgen/issues/1797
uses: KyleMayes/install-llvm-action@v1
with:
version: "12.0"
directory: ${{ runner.temp }}/llvm
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
- name: Set LIBCLANG_PATH
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV
- uses: actions-rs/toolchain@v1
with:
profile: ${{ matrix.profile }}
toolchain: ${{ steps.toolchain.outputs.value }}
target: ${{ matrix.target }}
default: true
- name: Cache Cargo
uses: Swatinem/rust-cache@v1
with:
key: ${{ matrix.target }}
working-directory: kmagick-rs/rust
- name: Get NDK
if: matrix.android
uses: nttld/setup-ndk@v1
with:
ndk-version: r22b
- name: Fix LLVM NDK Paths
if: matrix.android
run: |
$ndkRoot = Resolve-Path -Path "${{ runner.temp }}/*/android-ndk-r22b"
echo "ANDROID_NDK_HOME=$ndkRoot" >> $env:GITHUB_ENV
echo "NDK_HOME=$ndkRoot" >> $env:GITHUB_ENV
echo "$ndkRoot" >> $env:GITHUB_PATH
echo "CLANG_PATH=$ndkRoot\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe" >> $env:GITHUB_ENV
echo "$ndkRoot\toolchains\llvm\prebuilt\windows-x86_64\bin\" >> $env:GITHUB_PATH
- name: Build
working-directory: kmagick-rs/rust
run: ./${{ matrix.debug.tool }}
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: build-${{ matrix.target }}
path: kmagick-rs/rust/target/${{ matrix.target }}/debug/${{ matrix.output }}
build-kmagick:
name: Build KMagick Jar
runs-on: windows-latest
steps:
- name: Checkout KMagick
uses: actions/checkout@v2
with:
path: kmagick-rs
- name: Compile Jar
working-directory: kmagick-rs
run: |
./gradlew kmagick:build
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: build-kmagick
path: kmagick-rs/kmagick/build/libs/kmagick*.jar