Skip to content

Commit eed7fc0

Browse files
committed
Merge branch 'main' into mb/remove_accounts
2 parents 8087bb1 + 988d606 commit eed7fc0

24 files changed

Lines changed: 887 additions & 254 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ jobs:
3030
components: clippy, rustfmt
3131

3232
- name: Install protoc
33-
run: sudo apt-get install protobuf-compiler
33+
run: sudo provisioning/protoc.sh
3434

3535
- name: Setup just
36-
uses: extractions/setup-just@v2
36+
uses: extractions/setup-just@v3
3737
with:
38-
just-version: 1.5.0
38+
just-version: 1.40.0
3939

4040
- name: Check compilation
4141
run: cargo check

.github/workflows/release.yml

Lines changed: 133 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,99 @@ permissions:
1010
packages: write
1111

1212
jobs:
13-
build-binaries:
13+
# Builds the x64 and arm64 binaries for Linux, for all 3 crates, via the Docker builder
14+
build-binaries-linux:
1415
strategy:
1516
matrix:
1617
target:
17-
- x86_64-unknown-linux-gnu
18+
- amd64
19+
- arm64
20+
name:
21+
- commit-boost-cli
22+
- commit-boost-pbs
23+
- commit-boost-signer
24+
include:
25+
- target: amd64
26+
package-suffix: x86-64
27+
- target: arm64
28+
package-suffix: arm64
29+
- name: commit-boost-cli
30+
target-crate: cli
31+
- name: commit-boost-pbs
32+
target-crate: pbs
33+
- name: commit-boost-signer
34+
target-crate: signer
35+
runs-on: ubuntu-latest
36+
steps:
37+
- name: Checkout code
38+
uses: actions/checkout@v4
39+
with:
40+
ref: "stable"
41+
fetch-depth: 0
42+
submodules: true
43+
44+
- name: Log commit hash
45+
run: |
46+
echo "Releasing commit: $(git rev-parse HEAD)"
47+
48+
- name: Set up QEMU
49+
uses: docker/setup-qemu-action@v3
50+
51+
- name: Set up Docker Buildx
52+
uses: docker/setup-buildx-action@v3
53+
54+
- name: Login to GitHub Container Registry
55+
uses: docker/login-action@v3
56+
with:
57+
registry: ghcr.io
58+
username: ${{ github.actor }}
59+
password: ${{ secrets.GITHUB_TOKEN }}
60+
61+
- name: Build binary (Linux)
62+
uses: docker/build-push-action@v6
63+
with:
64+
context: .
65+
push: false
66+
platforms: linux/amd64,linux/arm64
67+
cache-from: type=registry,ref=ghcr.io/commit-boost/buildcache:${{ matrix.target-crate}}
68+
cache-to: type=registry,ref=ghcr.io/commit-boost/buildcache:${{ matrix.target-crate }},mode=max
69+
file: provisioning/build.Dockerfile
70+
outputs: type=local,dest=build
71+
build-args: |
72+
TARGET_CRATE=${{ matrix.name }}
73+
74+
- name: Package binary (Linux)
75+
run: |
76+
cd build/linux_${{ matrix.target }}
77+
tar -czvf ${{ matrix.name }}-${{ github.ref_name }}-linux_${{ matrix.package-suffix }}.tar.gz ${{ matrix.name }}
78+
mv ${{ matrix.name }}-${{ github.ref_name }}-linux_${{ matrix.package-suffix }}.tar.gz ../../
79+
80+
- name: Upload artifact
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: ${{ matrix.name }}-${{ github.ref_name }}-linux_${{ matrix.package-suffix }}
84+
path: |
85+
${{ matrix.name }}-${{ github.ref_name }}-linux_${{ matrix.package-suffix }}.tar.gz
86+
87+
# Builds the arm64 binaries for Darwin, for all 3 crates, natively
88+
build-binaries-darwin:
89+
strategy:
90+
matrix:
91+
target:
92+
# x64 requires macos-latest-large which is not available in the free tier
1893
# - x86_64-apple-darwin
1994
- aarch64-apple-darwin
2095
name:
2196
- commit-boost-cli
2297
- commit-boost-pbs
2398
- commit-boost-signer
2499
include:
25-
- target: x86_64-unknown-linux-gnu
26-
os: ubuntu-latest
27100
# - target: x86_64-apple-darwin
28-
# os: macos-latest
101+
# os: macos-latest-large
102+
# package-suffix: x86-64
29103
- target: aarch64-apple-darwin
30104
os: macos-latest
105+
package-suffix: arm64
31106
runs-on: ${{ matrix.os }}
32107
steps:
33108
- name: Checkout code
@@ -41,6 +116,12 @@ jobs:
41116
run: |
42117
echo "Releasing commit: $(git rev-parse HEAD)"
43118
119+
- name: Install Protoc
120+
run:
121+
# Brew's version is much more up to date than the Linux ones, and installing the latest via script runs into curl issues so for now, brew's easier to use
122+
# provisioning/protoc.sh
123+
brew install protobuf
124+
44125
- name: Cache Cargo registry
45126
uses: actions/cache@v3
46127
with:
@@ -63,48 +144,25 @@ jobs:
63144
${{ runner.os }}-cargo-build-${{ matrix.target }}-
64145
${{ runner.os }}-cargo-build-
65146
66-
- name: Install protoc (Ubuntu)
67-
if: runner.os == 'Linux'
68-
run: sudo apt-get install protobuf-compiler
69-
70-
- name: Install protoc (macOS)
71-
if: runner.os == 'macOS'
72-
run: brew install protobuf
73-
74-
- name: Set up Rust
75-
uses: actions-rs/toolchain@v1
76-
with:
77-
profile: minimal
78-
toolchain: stable
79-
override: true
80-
target: ${{ matrix.target }}
81-
82-
- name: Build binary
147+
- name: Build binary (Darwin)
83148
run: cargo build --release --target ${{ matrix.target }} --bin ${{ matrix.name }}
84-
env:
85-
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER: gcc
86149

87-
- name: Package binary (Unix)
88-
if: runner.os != 'Windows'
150+
- name: Package binary (Darwin)
89151
run: |
90152
cd target/${{ matrix.target }}/release
91-
tar -czvf ${{ matrix.name }}-${{ github.ref_name }}-${{ matrix.target }}.tar.gz ${{ matrix.name }}
92-
mv ${{ matrix.name }}-${{ github.ref_name }}-${{ matrix.target }}.tar.gz ../../../
93-
94-
- name: Package binary (Windows)
95-
if: runner.os == 'Windows'
96-
run: |
97-
7z a ${{ matrix.name }}-${{ github.ref_name }}-${{ matrix.target }}.zip target\${{ matrix.target }}\release\${{ matrix.name }}.exe
153+
tar -czvf ${{ matrix.name }}-${{ github.ref_name }}-darwin_${{ matrix.package-suffix }}.tar.gz ${{ matrix.name }}
154+
mv ${{ matrix.name }}-${{ github.ref_name }}-darwin_${{ matrix.package-suffix }}.tar.gz ../../../
98155
99156
- name: Upload artifact
100157
uses: actions/upload-artifact@v4
101158
with:
102-
name: ${{ matrix.name }}-${{ github.ref_name }}-${{ matrix.target }}
159+
name: ${{ matrix.name }}-${{ github.ref_name }}-darwin_${{ matrix.package-suffix }}
103160
path: |
104-
${{ matrix.name }}-${{ github.ref_name }}-${{ matrix.target }}.${{ runner.os == 'Windows' && 'zip' || 'tar.gz' }}
161+
${{ matrix.name }}-${{ github.ref_name }}-darwin_${{ matrix.package-suffix }}.tar.gz
105162
163+
# Builds the PBS Docker image
106164
build-and-push-pbs-docker:
107-
needs: [build-binaries]
165+
needs: [build-binaries-linux]
108166
runs-on: ubuntu-latest
109167
steps:
110168
- name: Checkout code
@@ -114,6 +172,21 @@ jobs:
114172
fetch-depth: 0
115173
submodules: true
116174

175+
- name: Download binary archives
176+
uses: actions/download-artifact@v4
177+
with:
178+
path: ./artifacts
179+
pattern: "commit-boost-*"
180+
181+
- name: Extract binaries
182+
run: |
183+
mkdir -p ./artifacts/bin/linux_amd64
184+
mkdir -p ./artifacts/bin/linux_arm64
185+
tar -xzf ./artifacts/commit-boost-pbs-${{ github.ref_name }}-linux_x86-64/commit-boost-pbs-${{ github.ref_name }}-linux_x86-64.tar.gz -C ./artifacts/bin
186+
mv ./artifacts/bin/commit-boost-pbs ./artifacts/bin/linux_amd64/commit-boost-pbs
187+
tar -xzf ./artifacts/commit-boost-pbs-${{ github.ref_name }}-linux_arm64/commit-boost-pbs-${{ github.ref_name }}-linux_arm64.tar.gz -C ./artifacts/bin
188+
mv ./artifacts/bin/commit-boost-pbs ./artifacts/bin/linux_arm64/commit-boost-pbs
189+
117190
- name: Set up QEMU
118191
uses: docker/setup-qemu-action@v3
119192

@@ -133,15 +206,16 @@ jobs:
133206
context: .
134207
push: true
135208
platforms: linux/amd64,linux/arm64
209+
build-args: |
210+
BINARIES_PATH=./artifacts/bin
136211
tags: |
137212
ghcr.io/commit-boost/pbs:${{ github.ref_name }}
138213
${{ !contains(github.ref_name, 'rc') && 'ghcr.io/commit-boost/pbs:latest' || '' }}
139-
cache-from: type=registry,ref=ghcr.io/commit-boost/pbs:buildcache
140-
cache-to: type=registry,ref=ghcr.io/commit-boost/pbs:buildcache,mode=max
141214
file: provisioning/pbs.Dockerfile
142215

216+
# Builds the Signer Docker image
143217
build-and-push-signer-docker:
144-
needs: [build-binaries]
218+
needs: [build-binaries-linux]
145219
runs-on: ubuntu-latest
146220
steps:
147221
- name: Checkout code
@@ -151,6 +225,21 @@ jobs:
151225
fetch-depth: 0
152226
submodules: true
153227

228+
- name: Download binary archives
229+
uses: actions/download-artifact@v4
230+
with:
231+
path: ./artifacts
232+
pattern: "commit-boost-*"
233+
234+
- name: Extract binaries
235+
run: |
236+
mkdir -p ./artifacts/bin/linux_amd64
237+
mkdir -p ./artifacts/bin/linux_arm64
238+
tar -xzf ./artifacts/commit-boost-signer-${{ github.ref_name }}-linux_x86-64/commit-boost-signer-${{ github.ref_name }}-linux_x86-64.tar.gz -C ./artifacts/bin
239+
mv ./artifacts/bin/commit-boost-signer ./artifacts/bin/linux_amd64/commit-boost-signer
240+
tar -xzf ./artifacts/commit-boost-signer-${{ github.ref_name }}-linux_arm64/commit-boost-signer-${{ github.ref_name }}-linux_arm64.tar.gz -C ./artifacts/bin
241+
mv ./artifacts/bin/commit-boost-signer ./artifacts/bin/linux_arm64/commit-boost-signer
242+
154243
- name: Set up QEMU
155244
uses: docker/setup-qemu-action@v3
156245

@@ -170,16 +259,18 @@ jobs:
170259
context: .
171260
push: true
172261
platforms: linux/amd64,linux/arm64
262+
build-args: |
263+
BINARIES_PATH=./artifacts/bin
173264
tags: |
174265
ghcr.io/commit-boost/signer:${{ github.ref_name }}
175266
${{ !contains(github.ref_name, 'rc') && 'ghcr.io/commit-boost/signer:latest' || '' }}
176-
cache-from: type=registry,ref=ghcr.io/commit-boost/signer:buildcache
177-
cache-to: type=registry,ref=ghcr.io/commit-boost/signer:buildcache,mode=max
178267
file: provisioning/signer.Dockerfile
179268

269+
# Creates a draft release on GitHub with the binaries
180270
finalize-release:
181271
needs:
182-
- build-binaries
272+
- build-binaries-linux
273+
- build-binaries-darwin
183274
- build-and-push-pbs-docker
184275
- build-and-push-signer-docker
185276
runs-on: ubuntu-latest

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# will have compiled files and executables
33
debug/
44
target/
5+
build/
56

67
# These are backup files generated by rustfmt
78
**/*.rs.bk
@@ -14,4 +15,4 @@ cb.docker-compose.yml
1415
targets.json
1516
.idea/
1617
logs
17-
.vscode/
18+
.vscode/

Cargo.lock

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)