-
Notifications
You must be signed in to change notification settings - Fork 0
201 lines (172 loc) · 5.36 KB
/
ci.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
name: "ci"
permissions:
pull-requests: write
contents: write
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
lint:
timeout-minutes: 25
runs-on: ubuntu-24.04
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: setup
uses: ./.github/actions/devenv
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
nix-cache: /tmp/nixcache
- name: lint ecmascript
run: lint:es
shell: bash
- name: lint formatting
run: lint:format
shell: bash
- uses: clechasseur/rs-clippy-check@v3
with:
args: --all-features
docs:
timeout-minutes: 25
runs-on: ubuntu-24.04
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: setup
uses: ./.github/actions/devenv
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
nix-cache: /tmp/nixcache
- name: build docs
run: build:docs
shell: bash
test:
timeout-minutes: 25
runs-on: ubuntu-24.04
strategy:
matrix:
version: ["1.75.0", stable, nightly]
env:
RUSTUP_TOOLCHAIN: ${{ matrix.version }}
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: setup
uses: ./.github/actions/devenv
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
nix-cache: /tmp/nixcache
- name: test `wallet_standard_wallets` with `ssr`
run: test:wallet_standard_wallets:ssr
shell: bash
- name: test `wallet_standard_wallets` with `docs`
run: test:wallet_standard_wallets:docs
shell: bash
- name: test `wasm_client_solana` with `ssr`
run: test:wasm_client_solana:ssr
shell: bash
- name: test `wasm_client_solana` with `docs`
run: test:wasm_client_solana:docs
shell: bash
coverage:
timeout-minutes: 25
runs-on: ubuntu-24.04
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: setup
uses: ./.github/actions/devenv
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
nix-cache: /tmp/nixcache
- name: test coverage
run: coverage:all
shell: bash
- name: upload coverage
uses: codecov/codecov-action@v4
with:
files: codecov.json
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
build:
timeout-minutes: 25
runs-on: ubuntu-24.04
strategy:
matrix:
version: ["1.75.0", stable, nightly]
env:
RUSTUP_TOOLCHAIN: ${{ matrix.version }}
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: setup
uses: ./.github/actions/devenv
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
nix-cache: /tmp/nixcache
- name: build
run: cargo build
shell: bash
- name: build all features
run: build:all
shell: bash
release:
if: github.event_name == 'push'
runs-on: ubuntu-latest
needs: [test, lint, build]
steps:
- name: generate token
uses: actions/create-github-app-token@v1
id: generate-token
with:
app-id: ${{ secrets.APP_ID }} # <-- GitHub App ID secret name
private-key: ${{ secrets.APP_PRIVATE_KEY }} # <-- GitHub App private key secret name
- name: setup rust
uses: dtolnay/rust-toolchain@stable
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.generate-token.outputs.token }}
- name: release
uses: MarcoIeni/[email protected]
id: release-plz
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: tag released prs
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
RELEASES: ${{ steps.release-plz.outputs.releases }}
run: |
set -e
# Iterate over released packages and add a label to the PRs
# shipped with the release.
for release in $(echo "$RELEASES" | jq -r -c '.[]'); do
package_name=$(echo "$release" | jq -r '.package_name')
version=$(echo "$release" | jq -r '.version')
prs_length=$(echo "$release" | jq '.prs | length')
if [ "$prs_length" -gt 0 ]; then
# Create label.
# Use `--force` to overwrite the label,
# so that the command does not fail if the label already exists.
label="released:$package_name-$version"
echo "Creating label $label"
gh label create $label --color BFD4F2 --force
for pr in $(echo "$release" | jq -r -c '.prs[]'); do
pr_number=$(echo "$pr" | jq -r '.number')
echo "Adding label $label to PR #$pr_number"
gh pr edit $pr_number --add-label $label
done
else
echo "No PRs found for package $package_name"
fi
done
shell: bash