Skip to content
This repository was archived by the owner on Feb 16, 2024. It is now read-only.

Commit 794b2fe

Browse files
committed
Add workflow to build release
Add Go installation to release workflow Switch from shell command to gobuild crate in build.rs Add gcc installation to release workflow Rename go output archive name Remodeled release workflow to use actions-rs Install libssl-dev in release workflow Install libssl-dev in release workflow WIP: Run release workflow on main branch Don't use cross for x86_64-unknown-linux-gnu Dont use cross-compilation, use different os's Try releasing with rust-build/rust-build.action Try release with actions-rs Fix wrong binary path Only create releases when release is created Fix wrong binary name for Windows Add support for aarch64-apple-darwin fix: Only require kind when spinning up kind cluster Refactor workflow
1 parent a50b96c commit 794b2fe

File tree

8 files changed

+94
-15
lines changed

8 files changed

+94
-15
lines changed

.github/workflows/build.yml

+34
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,37 @@ jobs:
159159
- uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # renovate: tag=v1.0.3
160160
with:
161161
command: test
162+
163+
run_build:
164+
name: Build for ${{ matrix.target }}
165+
runs-on: ${{ matrix.os }}
166+
strategy:
167+
fail-fast: false
168+
matrix:
169+
include:
170+
- target: x86_64-unknown-linux-gnu
171+
os: ubuntu-latest
172+
- target: x86_64-pc-windows-gnu
173+
os: windows-latest
174+
- target: x86_64-apple-darwin
175+
os: macos-latest
176+
- target: aarch64-apple-darwin
177+
os: macos-latest
178+
steps:
179+
- uses: actions/checkout@v3
180+
- uses: actions/setup-go@v3
181+
with:
182+
go-version: '^1.18.1'
183+
- uses: actions-rs/toolchain@v1
184+
with:
185+
profile: minimal
186+
toolchain: stable
187+
target: ${{ matrix.target }}
188+
override: true
189+
- uses: Swatinem/rust-cache@cb2cf0cc7c5198d3364b9630e2c3d457f160790c # tag=v1.4.0
190+
with:
191+
key: build-${{ matrix.target }}
192+
- uses: actions-rs/cargo@v1
193+
with:
194+
command: build
195+
args: --target=${{ matrix.target }}

.github/workflows/release.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
name: Stackable Release Pipeline
3+
4+
on:
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
release:
10+
name: Release for ${{ matrix.target }}
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
include:
16+
- target: x86_64-unknown-linux-gnu
17+
os: ubuntu-latest
18+
file-suffix: ""
19+
- target: x86_64-pc-windows-gnu
20+
os: windows-latest
21+
file-suffix: ".exe"
22+
- target: x86_64-apple-darwin
23+
os: macos-latest
24+
file-suffix: ""
25+
- target: aarch64-apple-darwin
26+
os: macos-latest
27+
file-suffix: ""
28+
steps:
29+
- uses: actions/checkout@v3
30+
- uses: actions/setup-go@v3
31+
with:
32+
go-version: '^1.18.1'
33+
- uses: actions-rs/toolchain@v1
34+
with:
35+
profile: minimal
36+
toolchain: stable
37+
target: ${{ matrix.target }}
38+
override: true
39+
- uses: actions-rs/cargo@v1
40+
with:
41+
command: build
42+
args: --release --target=${{ matrix.target }}
43+
- name: Rename binary file
44+
run: mv target/${{ matrix.target }}/release/stackablectl${{ matrix.file-suffix }} stackablectl-${{ matrix.target }}${{ matrix.file-suffix }}
45+
- name: Upload Release binaries
46+
uses: softprops/action-gh-release@v1
47+
with:
48+
files: stackablectl-${{ matrix.target }}${{ matrix.file-suffix }}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Cargo.lock
33

44
.idea/
5+
.vscode/
56

67
go-helm-wrapper/go-helm-wrapper
78
go-helm-wrapper/libhelm.a

Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@ reqwest = { version = "0.11", features = ["blocking"] }
2424
[profile.release]
2525
# strip = true # By default on Linux and macOS, symbol information is included in the compiled .elf file.
2626
lto = true # Enable Link Time Optimization to reduce binary size
27+
28+
[build-dependencies]
29+
gobuild = "0.1.0-alpha.2"

build.rs

+5-12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
1-
use std::{env, process::Command};
1+
use gobuild::BuildMode;
22

33
fn main() {
4-
let out_dir = env::var("OUT_DIR").unwrap();
5-
6-
Command::new("sh")
7-
.arg("-c")
8-
.arg(format!("cd go-helm-wrapper/ && go build -buildmode=c-archive -ldflags -w -o {out_dir}/libhelm.a main.go && cd .."))
9-
.status().unwrap();
10-
11-
println!("cargo:rustc-link-search=native={}", out_dir);
12-
println!("cargo:rustc-link-lib=static=helm");
13-
14-
println!("cargo:rerun-if-changed=go-helm-wrapper/main.go");
4+
gobuild::Build::new()
5+
.file("go-helm-wrapper/main.go")
6+
.buildmode(BuildMode::CArchive)
7+
.compile("go-helm-wrapper");
158
}
File renamed without changes.
File renamed without changes.

src/kind.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ nodes:
3232
"#;
3333

3434
pub fn handle_cli_arguments(kind_cluster: &Option<Option<String>>) {
35-
helpers::ensure_program_installed("docker");
36-
helpers::ensure_program_installed("kind");
37-
3835
if let Some(kind_cluster) = kind_cluster {
36+
helpers::ensure_program_installed("docker");
37+
helpers::ensure_program_installed("kind");
38+
3939
match kind_cluster {
4040
Some(kind_cluster_nane) => create_cluster_if_not_exists(kind_cluster_nane),
4141
None => create_cluster_if_not_exists(DEFAULT_KIND_CLUSTER_NAME),

0 commit comments

Comments
 (0)