This repository has been archived by the owner on Dec 12, 2024. It is now read-only.
generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 3
202 lines (194 loc) · 6.99 KB
/
gh-mvn-2.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
196
197
198
199
200
201
202
name: Build Shared Libraries
on:
push:
branches:
- main
- kendall/github-mvn-repo
jobs:
build_aarch64_apple_darwin:
runs-on: macos-latest
name: Build aarch64-apple-darwin target
steps:
- uses: actions/checkout@v2
# - name: Install Rust
# run: rustup toolchain install stable
# - name: Run Build Script
# run: |
# cd bindings/tbdex_uniffi/libtargets/aarch64_apple_darwin
# ./build
- name: Upload .dylib
uses: actions/upload-artifact@v3
with:
name: aarch64-apple-darwin-dylib
path: bound/kt/src/main/resources/libtbdex_uniffi_aarch64_apple_darwin.dylib
build_x86_64_apple_darwin:
runs-on: macos-12
name: Build x86_64-apple-darwin target
steps:
- uses: actions/checkout@v2
# - name: Install Rust
# run: rustup toolchain install stable
# - name: Run Build Script
# run: |
# cd bindings/tbdex_uniffi/libtargets/x86_64_apple_darwin
# ./build
- name: Upload .dylib
uses: actions/upload-artifact@v3
with:
name: x86_64-apple-darwin-dylib
path: bound/kt/src/main/resources/libtbdex_uniffi_x86_64_apple_darwin.dylib
build_x86_64_unknown_linux_gnu:
runs-on: ubuntu-latest
name: Build x86_64-unknown-linux-gnu target
steps:
- uses: actions/checkout@v2
# - name: Run Build Script
# run: |
# cd bindings/tbdex_uniffi/libtargets/x86_64_unknown_linux_gnu
# ./build
- name: Upload .so
uses: actions/upload-artifact@v3
with:
name: x86_64-unknown-linux-gnu-so
path: bound/kt/src/main/resources/libtbdex_uniffi_x86_64_unknown_linux_gnu.so
build_x86_64_unknown_linux_musl:
runs-on: ubuntu-latest
name: Build x86_64-unknown-linux-musl target
steps:
- uses: actions/checkout@v2
# - name: Run Build Script
# run: |
# cd bindings/tbdex_uniffi/libtargets/x86_64_unknown_linux_musl
# ./build
- name: Upload .so
uses: actions/upload-artifact@v3
with:
name: x86_64-unknown-linux-musl-so
path: bound/kt/src/main/resources/libtbdex_uniffi_x86_64_unknown_linux_musl.so
package_artifact:
runs-on: ubuntu-latest
needs:
- build_aarch64_apple_darwin
- build_x86_64_apple_darwin
- build_x86_64_unknown_linux_gnu
- build_x86_64_unknown_linux_musl
name: Package Maven Artifact
steps:
- uses: actions/checkout@v2
- name: Download aarch64-apple-darwin binary
uses: actions/download-artifact@v3
with:
name: aarch64-apple-darwin-dylib
path: bound/kt/src/main/resources/
- name: Download x86_64-apple-darwin binary
uses: actions/download-artifact@v3
with:
name: x86_64-apple-darwin-dylib
path: bound/kt/src/main/resources/
- name: Download x86_64-unknown-linux-gnu binary
uses: actions/download-artifact@v3
with:
name: x86_64-unknown-linux-gnu-so
path: bound/kt/src/main/resources/
- name: Download x86_64-unknown-linux-musl binary
uses: actions/download-artifact@v3
with:
name: x86_64-unknown-linux-musl-so
path: bound/kt/src/main/resources/
- name: Package Maven Artifact
run: |
cd bound/kt
mvn install -DskipTests=true
- name: Upload Maven artifact
uses: actions/upload-artifact@v3
with:
name: maven-artifact
path: bound/kt/target/
# test_shared_libraries:
# needs: package_artifact
# strategy:
# matrix:
# include:
# - target: aarch64_apple_darwin
# os: macos-latest
# - target: x86_64_apple_darwin
# os: macos-12
# - target: x86_64_unknown_linux_gnu
# os: ubuntu-latest
# - target: x86_64_unknown_linux_musl
# os: ubuntu-latest
# name: Test on ${{ matrix.target }}
# runs-on: ${{ matrix.os }}
# steps:
# - uses: actions/checkout@v2
# - name: Download Maven artifact
# uses: actions/download-artifact@v3
# with:
# name: maven-artifact
# path: bound/kt/target/
# - name: Set up JDK 11
# uses: actions/setup-java@v3
# with:
# distribution: "adopt"
# java-version: "11"
# - name: Run tests on macOS and Ubuntu
# if: ${{ matrix.target != 'x86_64_unknown_linux_musl' }}
# run: |
# cd bound/kt
# mvn '-Dtest=SystemArchitectureTest#can load shared library' test
# - name: Run tests on Alpine for x86_64_unknown_linux_musl
# if: ${{ matrix.target == 'x86_64_unknown_linux_musl' }}
# run: |
# sudo apt-get update
# sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
# sudo apt-get update
# sudo apt-get install -y docker-ce docker-ce-cli containerd.io
# docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace \
# alpine:latest /bin/sh -c "\
# apk update && apk add openjdk11 && apk add maven && \
# cd bound/kt && \
# mvn '-Dtest=SystemArchitectureTest#can load shared library' test"
publish_artifact:
runs-on: ubuntu-latest
# needs: test_shared_libraries
needs: package_artifact
name: Publish Maven Artifact
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- name: Download Maven artifact
uses: actions/download-artifact@v3
with:
name: maven-artifact
path: bound/kt/target/
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: "adopt"
java-version: "11"
- name: Set up Maven settings
run: |
mkdir -p ~/.m2
echo "<settings xmlns=\"http://maven.apache.org/SETTINGS/1.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd\">
<servers>
<server>
<id>github</id>
<username>${{ github.actor }}</username>
<password>${{ secrets.GITHUB_TOKEN }}</password>
</server>
</servers>
</settings>" > ~/.m2/settings.xml
- name: Deploy artifact
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
cd bound/kt
mvn deploy:deploy-file \
-Dfile=target/tbdex-core-${VERSION}.jar \
-DpomFile=pom.xml \
-DrepositoryId=github \
-Durl=https://maven.pkg.github.com/TBD54566975/tbdex-rs