-
Notifications
You must be signed in to change notification settings - Fork 12
177 lines (171 loc) · 7.32 KB
/
release-kotlin.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
name: Release kotlin
on:
workflow_dispatch:
inputs:
retVersion:
required: true
jobs:
build:
runs-on: ${{ matrix.build-target.runner }}
continue-on-error: false
strategy:
matrix:
build-target:
# Linux Targets
- crate: radix-engine-toolkit-uniffi
target-triple: x86_64-unknown-linux-gnu
runner: ubuntu-20.04
- crate: radix-engine-toolkit-uniffi
target-triple: aarch64-apple-darwin
runner: macos-latest
- crate: radix-engine-toolkit-uniffi
target-triple: x86_64-apple-darwin
runner: macos-latest
- crate: radix-engine-toolkit-uniffi
target-triple: aarch64-unknown-linux-gnu
runner: ubuntu-latest
- crate: radix-engine-toolkit-uniffi
target-triple: x86_64-pc-windows-gnu
runner: ubuntu-latest
steps:
- name: Checkout
uses: RDXWorks-actions/checkout@main
- name: Install Rust Target
run: |
# Install nightly-2024-02-01
rustup toolchain install nightly-2024-02-01
# Update both toolchains
rustup update nightly-2024-07-30
rustup update nightly-2024-02-01
# Add target
rustup target install ${{ matrix.build-target.target-triple }}
rustup +nightly-2024-02-01 target install ${{ matrix.build-target.target-triple }}
# Install the nightly-2024-02-01 toolchain of the target of this machine.
DEFAULT_TARGET=$(rustc -vV | sed -n 's|host: ||p')
rustup component add rust-src --toolchain nightly-2024-02-01-$DEFAULT_TARGET
- name: Build dependencies (x86_64-pc-windows-gnu)
if: ${{ matrix.build-target.target-triple == 'x86_64-pc-windows-gnu' }}
run: |
sudo apt-get install -y mingw-w64
echo "CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=x86_64-w64-mingw32-gcc" >> $GITHUB_ENV
echo "CC=x86_64-w64-mingw32-gcc" >> $GITHUB_ENV
echo "AR=x86_64-w64-mingw32-gcc-ar" >> $GITHUB_ENV
- name: Build Dependencies (aarch64 linux)
if: ${{ matrix.build-target.target-triple == 'aarch64-unknown-linux-gnu' }}
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
echo "CC=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
echo "AR=aarch64-linux-gnu-gcc-ar" >> $GITHUB_ENV
- name: Build
working-directory: ${{ matrix.build-target.crate }}
run: |
cargo build \
--target ${{ matrix.build-target.target-triple }} \
--release
- name: Clean Build Artifacts
run: find "./${{ matrix.build-target.crate }}/target/${{ matrix.build-target.target-triple }}/release" -mindepth 1 -maxdepth 1 -type d -exec rm -r {} \;
- name: Upload Artifacts
uses: RDXWorks-actions/upload-artifact@main
with:
name: ${{ matrix.build-target.crate }}-${{ matrix.build-target.target-triple }}
path: "./${{ matrix.build-target.crate }}/target/${{ matrix.build-target.target-triple }}/release"
generate-uniffi-bindings:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: RDXWorks-actions/checkout@main
- name: Clone uniffi-bindgen-cs
uses: RDXWorks-actions/checkout@main
with:
repository: radixdlt/uniffi-bindgen-cs
path: uniffi-bindgen-cs
submodules: 'recursive'
ref: f1a6ef67449b47028fd5c3d8e5c6d3b80ddefd2b
- uses: RDXWorks-actions/download-artifact@main
with:
path: artifacts
- name: Generate the Bindings
run: |
# Generating the path of the dynamic library
DYNAMIC_LIBRARY_PATH="./artifacts/radix-engine-toolkit-uniffi-x86_64-unknown-linux-gnu/libradix_engine_toolkit_uniffi.so"
OUTPUT_DIRECTORY="./uniffi-bindings"
for LANGUAGE in "kotlin"
do
cargo run \
--manifest-path="./uniffi-bindgen/Cargo.toml" -- \
generate ./radix-engine-toolkit-uniffi/src/radix_engine_toolkit_uniffi.udl \
--language $LANGUAGE \
--out-dir $OUTPUT_DIRECTORY \
--lib-file $DYNAMIC_LIBRARY_PATH
done
cargo run \
--manifest-path="./uniffi-bindgen-cs/bindgen/Cargo.toml" -- \
./radix-engine-toolkit-uniffi/src/radix_engine_toolkit_uniffi.udl \
--out-dir $OUTPUT_DIRECTORY \
--lib-file $DYNAMIC_LIBRARY_PATH
- name: Upload Artifacts
uses: RDXWorks-actions/upload-artifact@main
with:
name: uniffi-bindings
path: uniffi-bindings
publish-kotlin-maven-central:
needs: [generate-uniffi-bindings]
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Install AWS CLI
uses: RDXWorks-actions/install-aws-cli-action@master
with:
version: 2
- name: Checkout actions-oidc-debugger
uses: RDXWorks-actions/checkout@main
with:
repository: github/actions-oidc-debugger
ref: main
token: ${{ github.token }}
path: ./.github/actions/actions-oidc-debugger
- name: Debug OIDC Claims
uses: ./.github/actions/actions-oidc-debugger
with:
audience: 'https://github.com/github'
- name: Configure AWS credentials to fetch secrets
uses: RDXWorks-actions/configure-aws-credentials@main
with:
role-to-assume: ${{ secrets.AWS_RET_ROLE_NAME }}
aws-region: eu-west-2
role-session-name: ret-${{ github.run_id }}-${{ github.run_attempt }}
- name: Fetch AWS secrets
uses: RDXWorks-actions/aws-secretsmanager-get-secrets@main
with:
parse-json-secrets: true
secret-ids: |
MAVEN_CENTRAL,${{ secrets.MAVEN_CENTRAL_SECRET_ID }},
GPG_PASSPHRASE,${{ secrets.GPG_PASSPHRASE_SECRET_ID }}
- uses: RDXWorks-actions/checkout@main
- uses: RDXWorks-actions/download-artifact@main
with:
path: artifacts
- name: Create Kotlin Library
working-directory: interop/kotlin
run: |
./bootstrap.sh
- name: Setup Gradle
uses: RDXWorks-actions/gradle-build-action@main
with:
gradle-version: 8.4
arguments: wrapper -p interop/kotlin/ret-kotlin
- name: Get GPG key to sign
working-directory: interop/kotlin/ret-kotlin
run: |
aws secretsmanager get-secret-value --secret-id ${{ secrets.GPG_BINARY_SECRET_ID }} --query SecretBinary --output text | base64 --decode > rdx-secring.gpg
cp rdx-secring.gpg lib/rdx-secring.gpg
- name: Build and publish Kotlin
uses: RDXWorks-actions/gradle-build-action@main
with:
arguments: build javadoc publishMavenCentralPublicationToMavenCentralRepository -Pret-version=${{ inputs.retVersion }} -Psigning.secretKeyRingFile=rdx-secring.gpg -Psigning.password=${{ env.GPG_PASSPHRASE_GPG_PASSPHRASE }} -Psigning.keyId=${{ secrets.GPG_KEY_ID }} -PossrhUsername=${{ env.MAVEN_CENTRAL_MAVEN_CENTRAL_USERNAME }} -PossrhPassword=${{ env.MAVEN_CENTRAL_MAVEN_CENTRAL_PASSWORD }}
build-root-directory: interop/kotlin/ret-kotlin