generated from matrix-org/.github
-
Notifications
You must be signed in to change notification settings - Fork 7
185 lines (154 loc) · 5.41 KB
/
release_sdk_parallel.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
name: Release SDK Library (parallel)
on:
workflow_dispatch:
inputs:
rust-checkout-ref:
description: 'The branch, tag or SHA to checkout on the rust sdk.'
required: true
default: 'main'
sdk-version:
description: 'The new version for the sdk library.'
required: true
jobs:
build_targets:
strategy:
matrix:
target: [ "aarch64-linux-android", "armv7-linux-androideabi", "i686-linux-android", "x86_64-linux-android" ]
# fail-fast: true
name: "Build Rust target: ${{ matrix.target }}"
runs-on: ubuntu-latest
concurrency:
group: ${{ github.ref }}-${{ github.job }}-${{ matrix.target }}
cancel-in-progress: true
steps:
- name: Checkout this repo
uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' || github.ref == 'main' }}
cache-on-failure: true
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Install android sdk
uses: malinskiy/action-android/install-sdk@release/0.1.2
- name: Install android ndk
uses: nttld/setup-ndk@v1
id: install-ndk
with:
ndk-version: r25c
- name: Install Rust
uses: dtolnay/rust-toolchain@nightly
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Add Rust targets
run: |
rustup target add x86_64-linux-android
rustup target add aarch64-linux-android
rustup target add armv7-linux-androideabi
rustup target add i686-linux-android
- name: Install cargo-ndk
continue-on-error: true
run: cargo install cargo-ndk
- name: Set up Python 3
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install argparse
pip install requests
- name: Run build script
run: |
python3 ./scripts/build-rust-for-target.py --module SDK --version ${{ github.event.inputs.sdk-version }} --ref ${{ github.event.inputs.rust-checkout-ref }} --target ${{ matrix.target }}
- name: Set linkable git ref
run: |
pushd ../matrix-rust-sdk
echo LINKABLE_REF=$(git show-ref --verify refs/heads/${{ github.event.inputs.rust-checkout-ref }}) >> $GITHUB_OUTPUT
popd
- name: Upload target artifacts
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: targets
if-no-files-found: error
path: ./sdk/sdk-android/src/main/jniLibs/*/libmatrix_sdk_ffi.so
retention-days: 1
- name: Upload FFI bindings
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: ffi-bindings
if-no-files-found: error
path: ./sdk/sdk-android/src/main/kotlin/
retention-days: 1
release_library:
name: "Release SDK Library"
needs: build_targets
runs-on: ubuntu-latest
concurrency:
group: ${{ github.ref }}-${{ github.job }}
cancel-in-progress: true
steps:
- name: Checkout this repo
uses: actions/checkout@v3
- name: Download target artifacts
uses: actions/download-artifact@v3
with:
name: targets
path: targets
- name: Copy artifacts to their right folders
run: |
pushd targets
cp -R . ../sdk/sdk-android/src/main/jniLibs/
popd
- name: Download FFI bindings
uses: actions/download-artifact@v3
with:
name: ffi-bindings
path: ffi-bindings
- name: Copy FFI bindings to their package
run: |
pushd ffi-bindings
cp -R . ../sdk/sdk-android/src/main/kotlin/
popd
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Install android sdk
uses: malinskiy/action-android/install-sdk@release/0.1.2
- name: Set up Python 3
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install argparse
pip install requests
- name: Run release script
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python3 ./scripts/release_sdk.py --module SDK --version ${{ github.event.inputs.sdk-version }} --linkable-ref ${{ needs.build_targets.outputs.LINKABLE_REF }}
- name: Upload results # TODO: delete this
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: results
if-no-files-found: error
path: ./sdk/sdk-android/src/main/*
retention-days: 1