forked from wasmCloud/wasmCloud
-
Notifications
You must be signed in to change notification settings - Fork 0
212 lines (191 loc) · 7.43 KB
/
secrets-nats-kv.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
203
204
205
206
207
208
209
210
211
212
name: secrets-nats-kv
on:
merge_group:
push:
branches: [main]
tags:
- 'secrets-nats-kv-v[0-9].[0-9]+.[0-9]+'
- 'secrets-nats-kv-v[0-9].[0-9]+.[0-9]+-*'
pull_request:
branches: [main]
paths:
- .github/workflows/secrets-nats-kv.yml
- Cargo.lock
- Cargo.toml
- crates/secrets-nats-kv/**
- crates/secrets-client/**
- crates/secrets-types/**
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
integration_tests:
name: Integration Tests
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- run: rustup show
- uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab
with:
shared-key: "ubuntu-22.04-shared-cache"
- name: Launch integration test services
uses: sudo-bot/action-docker-compose@ef4c4da08a9673f93d4eb8a5da1e942bf24a37ea
with:
cli-args: "-f ./crates/secrets-nats-kv/tools/docker-compose.yml up --detach"
- name: Install nextest
uses: taiki-e/install-action@2c3c8dfabf5933531aca0613c6b0c173fa51745e
with:
tool: nextest
- name: Run integration tests
run: make test-integration-ci
working-directory: ./crates/secrets-nats-kv
release-build:
if: ${{ startsWith(github.ref, 'refs/tags/secrets-nats-kv-v') }}
runs-on: ${{ matrix.build.runs-on }}
permissions:
contents: write
strategy:
matrix:
build:
- os: linux
arch: amd64
abi: gnu
runs-on: ubuntu-22.04
rust-target: x86_64-unknown-linux-gnu
- os: linux
arch: amd64
abi: musl
runs-on: ubuntu-22.04
rust-target: x86_64-unknown-linux-musl
- os: darwin
arch: amd64
runs-on: macos-13
rust-target: x86_64-apple-darwin
- os: darwin
arch: aarch64
runs-on: macos-14
rust-target: aarch64-apple-darwin
- os: windows
arch: amd64
abi: msvc
runs-on: windows-2022
rust-target: x86_64-pc-windows-msvc
- os: linux
arch: aarch64
abi: gnu
runs-on: ubuntu-22.04
rust-target: aarch64-unknown-linux-gnu
skip-test: true # No runner on GH for this yet
- os: linux
arch: aarch64
abi: musl
runs-on: ubuntu-22.04
rust-target: aarch64-unknown-linux-musl
skip-test: true # No runner on GH for this yet
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- run: rustup target add ${{ matrix.build.rust-target }}
- uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab
with:
shared-key: "ubuntu-22.04-shared-cache"
- name: Extract tag context
id: ctx
shell: bash
run: |
sha_short=$(git rev-parse --short HEAD)
echo "sha_short=${sha_short}" >> "$GITHUB_OUTPUT"
version=$(cargo metadata --manifest-path "./crates/secrets-nats-kv/Cargo.toml" --no-deps --format-version 1 | jq -r '.packages[] | select(.name == "wasmcloud-nats-kv-secrets") | .version')
echo "untagged version is ${version}"
echo "untagged version ${version} is a pre-release"
echo "version=${version}" >> "$GITHUB_OUTPUT"
if [[ $version == *"-"* ]]; then
echo "tagged version ${version} is a pre-release"
echo "prerelease=true" >> "$GITHUB_OUTPUT"
fi
- name: Install musl toolchain
if: ${{ matrix.build.abi == 'musl' }}
run: |
sudo apt-get install -y musl-tools clang llvm
- name: Install aarch64 toolchain
if: ${{ matrix.build.abi == 'gnu' && matrix.build.arch == 'aarch64' }}
run: |
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Build
shell: bash
run: |
export PLATFORM="${{ matrix.build.arch }}-${{ matrix.build.os }}-${{ matrix.build.abi }}";
if [ "aarch64-linux-gnu" == "$PLATFORM" ]; then
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/aarch64-linux-gnu-gcc
elif [ "aarch64-linux-musl" == "$PLATFORM" ]; then
export CC_aarch64_unknown_linux_musl=clang;
export AR_aarch64_unknown_linux_musl=llvm-ar;
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-Clink-self-contained=yes -Clinker=rust-lld";
fi
cargo build --release -p secrets-nats-kv --target ${{ matrix.build.rust-target }}
- name: Determine binary name
id: bin-name
shell: bash
run: |
if [ "" == "${{ matrix.build.abi }}" ]; then
export BIN_NAME=secrets-nats-kv-${{ matrix.build.arch }}-${{ matrix.build.os }};
else
export BIN_NAME=secrets-nats-kv-${{ matrix.build.arch }}-${{ matrix.build.os }}-${{ matrix.build.abi }};
fi
echo "bin-name=$BIN_NAME" >> $GITHUB_OUTPUT;
- name: Basic binary test
if: ${{ !matrix.build.skip-test }}
run: |
./target/${{ matrix.build.rust-target}}/release/secrets-nats-kv --version
- name: Copy binary
shell: bash
run: |
mkdir artifacts;
cp ./target/${{ matrix.build.rust-target}}/release/secrets-nats-kv artifacts/${{ steps.bin-name.outputs.bin-name }}
- uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b
with:
name: ${{ steps.bin-name.outputs.bin-name }}
path:
artifacts/*
release:
if: ${{ startsWith(github.ref, 'refs/tags/secrets-nats-kv-v') }}
needs: [ release-build ]
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Extract tag context
id: ctx
shell: bash
run: |
sha_short=$(git rev-parse --short HEAD)
echo "sha_short=${sha_short}" >> "$GITHUB_OUTPUT"
version=$(cargo metadata --manifest-path "./crates/secrets-nats-kv/Cargo.toml" --no-deps --format-version 1 | jq -r '.packages[] | select(.name == "wasmcloud-nats-kv-secrets") | .version')
echo "untagged version is ${version}"
echo "untagged version ${version} is a pre-release"
echo "version=${version}" >> "$GITHUB_OUTPUT"
if [[ $version == *"-"* ]]; then
echo "tagged version ${version} is a pre-release"
echo "prerelease=true" >> "$GITHUB_OUTPUT"
fi
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
with:
pattern: secrets-nats-kv-*
merge-multiple: true
path: artifacts
- name: Add musl versions as default linux binaries
run: |
cp artifacts/secrets-nats-kv-amd64-linux-musl artifacts/secrets-nats-kv-amd64-linux
cp artifacts/secrets-nats-kv-aarch64-linux-musl artifacts/secrets-nats-kv-aarch64-linux
- name: Release
uses: softprops/action-gh-release@01570a1f39cb168c169c802c3bceb9e93fb10974
with:
draft: true
prerelease: ${{ steps.ctx.outputs.prerelease != '' }}
generate_release_notes: true
files: |
./artifacts/*