generated from matrix-org/.github
-
Notifications
You must be signed in to change notification settings - Fork 8
159 lines (135 loc) · 5.7 KB
/
release_crypto.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
name: Release Crypto Library
on:
workflow_dispatch:
inputs:
rust-checkout-ref:
description: 'The branch, tag or SHA to checkout on the rust sdk.'
required: true
default: 'main'
crypto-sdk-version:
description: 'The new version for the rust-crypto library.'
required: true
jobs:
build_native:
name: Build and generate crypto native libs
runs-on: macos-latest
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 }}
concurrency:
group: ${{ github.ref }}-${{ github.job }}
cancel-in-progress: true
steps:
- name: Checkout this repo
uses: actions/checkout@v4
with:
path: main
- name: Configure git user
run: |
git config user.name github-actions
git config user.email github-actions@github.com
- name: Checkout matrix rust sdk repo
uses: actions/checkout@v4
with:
repository: matrix-org/matrix-rust-sdk
path: rust-sdk
ref: '${{ github.event.inputs.rust-checkout-ref }}'
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin' # See 'Supported distributions' for available options
- name: Install android sdk
uses: malinskiy/action-android/install-sdk@release/0.1.4
- name: Install android ndk
uses: nttld/setup-ndk@v1
id: install-ndk
with:
ndk-version: r25c
- name: Create symlinks for buildchain
run: |
export PATH="${{ steps.install-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/darwin-x86_64/bin:$PATH"
echo $PATH
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
# - name: Create cargo config
# run: |
# echo [target.aarch64-linux-android] > $HOME/.cargo/config.toml
# echo ar = \"${{ steps.install-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/darwin-x86_64/bin/ar\" >> $HOME/.cargo/config.toml
# echo linker = \"${{ steps.install-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android30-clang\" >> $HOME/.cargo/config.toml
#
# echo [target.i686-linux-android] >> $HOME/.cargo/config.toml
# echo ar = \"${{ steps.install-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/darwin-x86_64/bin/ar\" >> $HOME/.cargo/config.toml
# echo linker = \"${{ steps.install-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android30-clang\" >> $HOME/.cargo/config.toml
#
# echo [target.armv7-linux-androideabi] >> $HOME/.cargo/config.toml
# echo ar = \"${{ steps.install-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/darwin-x86_64/bin/ar\" >> $HOME/.cargo/config.toml
# echo linker = \"${{ steps.install-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi30-clang\" >> $HOME/.cargo/config.toml
#
# cat $HOME/.cargo/config.toml
- 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: Configure gradle
uses: gradle/actions/setup-gradle@v3
- name: Run build script
env:
ANDROID_NDK: ${{ steps.install-ndk.outputs.ndk-path }}
run: ./main/scripts/build.sh -r -m crypto -p rust-sdk
- name: Find all .aar files
run: find . -name "*.aar"
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install argparse
pip install requests
- name: Run publish script
env:
CRYPTO_SDK_VERSION: ${{ github.event.inputs.crypto-sdk-version }}
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python3 ./main/scripts/release_crypto.py --version ${{ github.event.inputs.crypto-sdk-version }} --sdk_path ./rust-sdk
# - name: Run test python
# run: |
# python3 ./main/scripts/hello_world.py
#
# - name: Run test python 2
# env:
# ANDROID_NDK: ${{ steps.install-ndk.outputs.ndk-path }}
# CRYPTO_SDK_VERSION: ${{ github.event.inputs.crypto-sdk-version }}
# GITHUB_API_TOKEN: ${{ secrets.API_TOKEN }}
# RUST_LOG: "trace"
# run: |
# python3 ./main/scripts/hello_world.py
#
# - name: Run publish script
# env:
# ANDROID_NDK: ${{ steps.install-ndk.outputs.ndk-path }}
# CRYPTO_SDK_VERSION: ${{ github.event.inputs.crypto-sdk-version }}
# GITHUB_API_TOKEN: ${{ secrets.API_TOKEN }}
# RUST_LOG: "trace"
# run: |
# python3 ./main/scripts/release.py --version ${{ github.event.inputs.crypto-sdk-version }} --sdk_path ./rust-sdk --module CRYPTO