This repository was archived by the owner on Aug 15, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
199 lines (190 loc) · 7.08 KB
/
Copy pathci.yaml
File metadata and controls
199 lines (190 loc) · 7.08 KB
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
name: CI
on:
push:
tags:
- "v*.*.*"
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
checks: write
pull-requests: write
env:
BUILD_TARGET: "x86_64-unknown-linux-gnu"
jobs:
build-and-test:
runs-on: blacksmith-16vcpu-ubuntu-2204
env:
CARGO_BUILD_JOBS: 10
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: recursive
- name: Fetch tag
run: git fetch origin --deepen=1
- name: Setup Rust
run: rustup update stable --no-self-update && rustup default stable
- uses: davidB/rust-cargo-make@v1
- uses: cargo-bins/cargo-binstall@main
- name: Install cargo-component
run: cargo install cargo-component@0.21.1
- name: Install wasm-tools
run: cargo binstall --force --locked wasm-tools@1.227.1
- name: Install wit-bindgen
run: cargo binstall --force --locked wit-bindgen-cli@0.40.0
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install uv
run: pip install uv==0.6.17
- name: Install WASI SDK
run: |
WASI_VERSION=25
WASI_SDK_PATH=/opt/wasi-sdk
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION}.0-x86_64-linux.tar.gz
tar -xvf wasi-sdk-${WASI_VERSION}.0-x86_64-linux.tar.gz
sudo mv wasi-sdk-${WASI_VERSION}.0-x86_64-linux ${WASI_SDK_PATH}
echo "WASI_SDK_PATH=${WASI_SDK_PATH}" >> $GITHUB_ENV
- uses: mlugg/setup-zig@v2
- uses: actions/setup-go@v5.3.0
- uses: acifani/setup-tinygo@v2.0.0
with:
tinygo-version: "0.37.0"
- uses: sbt/setup-sbt@v1.1.7
- name: Install moonbit
run: |
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash
echo "$HOME/.moon/bin" >> $GITHUB_PATH
- uses: useblacksmith/rust-cache@v3
with:
prefix-key: "v0-rust"
shared-key: debug
cache-all-crates: true
save-if: true
- name: Build all targets
run: cargo make --profile ci build
- name: Unit tests
run: cargo make --profile ci unit-tests
- name: Integration tests
run: cargo make --profile ci integration-tests
- name: Check formatting and clippy rules
run: cargo make --profile ci check
- name: Publish Test Report
uses: mikepenz/action-junit-report@v5
if: always()
with:
report_paths: "**/target/report-*.xml"
detailed_summary: true
include_passed: true
publish-crates:
needs: build-and-test
if: "startsWith(github.ref, 'refs/tags/v')"
runs-on: blacksmith-16vcpu-ubuntu-2204
env:
CARGO_BUILD_JOBS: 10
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: recursive
- name: Fetch tag
run: git fetch origin --deepen=1
- name: Setup Rust
run: rustup update stable --no-self-update && rustup default stable
- uses: davidB/rust-cargo-make@v1
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: useblacksmith/rust-cache@v3
with:
prefix-key: "v0-rust"
shared-key: release
cache-all-crates: true
save-if: true
- id: get_version
uses: battila7/get-version-action@v2
- name: Publish all packages
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
VERSION: ${{ steps.get_version.outputs.version-without-v }}
run: cargo make --profile ci publish
publish-binaries:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.repository == 'golemcloud/golem-cli'
strategy:
fail-fast: false
matrix:
project:
- golem-cli
- golem
cfg:
- rust-target: x86_64-unknown-linux-gnu
os: blacksmith-16vcpu-ubuntu-2204
- rust-target: aarch64-unknown-linux-gnu
os: blacksmith-16vcpu-ubuntu-2204
cross: true
- rust-target: x86_64-apple-darwin
os: macos-latest
- rust-target: aarch64-apple-darwin
os: macos-latest
- rust-target: x86_64-pc-windows-gnu
os: windows-latest
name: Publish binaries of ${{ matrix.project }}
runs-on: ${{ matrix.cfg.os }}
permissions:
contents: write
env:
CARGO_BUILD_JOBS: 10
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: recursive
- name: Fetch tag
run: git fetch origin --deepen=1
- name: Setup Rust
run: rustup update stable --no-self-update && rustup default stable && rustup target add ${{ matrix.cfg.rust-target }}
- uses: davidB/rust-cargo-make@v1
- uses: useblacksmith/rust-cache@v3
with:
prefix-key: "v0-rust"
shared-key: release-${{ matrix.cfg.rust-target }}
cache-all-crates: true
save-if: true
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- id: get_version
uses: battila7/get-version-action@v2
- name: Set version for all packages
env:
VERSION: ${{ steps.get_version.outputs.version-without-v }}
run: cargo make --profile ci set-version
- run: cargo install cross
if: ${{ matrix.cfg.cross }}
- uses: ilammy/setup-nasm@v1
- run: cargo build -p ${{ matrix.project }} --release --target ${{ matrix.cfg.rust-target }}
if: ${{ ! matrix.cfg.cross }}
- run: cross build -p ${{ matrix.project }} --release --target ${{ matrix.cfg.rust-target }}
if: ${{ matrix.cfg.cross }}
- run: mv ./target/${{ matrix.cfg.rust-target }}/release/${{ matrix.project }}.exe ./target/${{ matrix.cfg.rust-target }}/release/${{ matrix.project }}-${{ matrix.cfg.rust-target }}.exe
if: matrix.cfg.os == 'windows-latest'
- run: mv ./target/${{ matrix.cfg.rust-target }}/release/${{ matrix.project }} ./target/${{ matrix.cfg.rust-target }}/release/${{ matrix.project }}-${{ matrix.cfg.rust-target }}
if: matrix.cfg.os != 'windows-latest'
- name: Login GH CLI
shell: bash
run: gh auth login --with-token < <(echo ${{ secrets.GITHUB_TOKEN }})
- run: gh release upload -R golemcloud/golem-cli --clobber ${{ github.ref_name }} target/${{ matrix.cfg.rust-target }}/release/${{ matrix.project }}-${{ matrix.cfg.rust-target }}.exe
if: matrix.cfg.os == 'windows-latest'
- run: gh release upload -R golemcloud/golem-cli --clobber ${{ github.ref_name }} target/${{ matrix.cfg.rust-target }}/release/${{ matrix.project }}-${{ matrix.cfg.rust-target }}
if: matrix.cfg.os != 'windows-latest'