Skip to content

Commit

Permalink
Merge pull request #20 from withlazers/improve/aarch-containers
Browse files Browse the repository at this point in the history
Build for aarch64 container, build macos binaries
  • Loading branch information
Gottox authored Mar 10, 2025
2 parents 00d0111 + 409b418 commit 56d13e1
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 27 deletions.
42 changes: 28 additions & 14 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,32 @@ on:
jobs:
prepare:
runs-on: 'ubuntu-latest'

steps:
- uses: actions/checkout@v4

# Check Versions
- name: Check If Versions Match
if: ${{ contains(github.ref_name, 'snapshot') == false }}
run: |
helm_version=$(yq .version charts/rustcloak-operator/Chart.yaml)
helm_appversion=$(yq .appVersion charts/rustcloak-operator/Chart.yaml)
cd rustcloak-operator
cargo_version=$(cargo pkgid | cut -d'#' -f 2)
cargo_version=$(cargo pkgid --manifest-path rustcloak-operator/Cargo.toml | cut -d'#' -f 2)
cargo_version=$(cargo pkgid --manifest-path rustcloak-crd/Cargo.toml | cut -d'#' -f 2)
set -x
test "${cargo_version}" = "${GITHUB_REF_NAME#v}"
test "${helm_version}" = "${GITHUB_REF_NAME#v}"
test "${helm_appversion}" = "${GITHUB_REF_NAME}"
test "${cargo_crd_version}" = "${GITHUB_REF_NAME#v}"
test "${cargo_version}" = "${GITHUB_REF_NAME#v}"
test "${helm_version}" = "${GITHUB_REF_NAME#v}"
test "${helm_appversion}" = "${GITHUB_REF_NAME}"
build:
if: contains(github.ref_name, 'snapshot') == false
needs: prepare
runs-on: 'ubuntu-latest'
strategy:
matrix:
target:
- aarch64-unknown-linux-musl
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-musl
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/rust-build
Expand All @@ -42,11 +42,26 @@ jobs:
target: ${{ matrix.target }}
use-cross: true

build-apple:
needs: prepare
runs-on: 'macos-latest'
strategy:
matrix:
target:
- x86_64-apple-darwin
- aarch64-apple-darwin
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/rust-build
name: Build Apple
with:
target: ${{ matrix.target }}
use-cross: false

container:
needs:
- build
runs-on: 'ubuntu-latest'

steps:
- uses: actions/checkout@v4
- uses: withlazers/container-action@main
Expand All @@ -55,17 +70,16 @@ jobs:
username: gottox
password: ${{ secrets.DOCKER_TOKEN }}
ref-tags: ${{ github.ref_name }}
dockerfile: ./Dockerfile
archs: "amd64"

dockerfile: ./dev-scripts/Dockerfile.release
archs: "amd64,arm64"

release:
if: contains(github.ref_name, 'snapshot') == false
if: ${{ contains(github.ref_name, 'snapshot') == false }}
needs:
- container
- build
- build-apple
runs-on: 'ubuntu-latest'

steps:
- uses: actions/checkout@v4
- uses: withlazers/release-action@main
Expand Down
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
[workspace]
resolver = "2"
members = ["rustcloak-operator", "rustcloak-crd", "utils"]

[profile.release]
strip = true
opt-level = "z"
lto = true
panic = "abort"
9 changes: 9 additions & 0 deletions dev-scripts/Dockerfile.release
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ARG TARGETARCH

FROM gcr.io/distroless/static-debian12:nonroot-${TARGETARCH}

ARG TARGETARCH

COPY artifacts/${TARGETARCH}-unknown-linux-musl/bin/rustcloak /rustcloak

ENTRYPOINT ["/rustcloak"]
2 changes: 1 addition & 1 deletion rustcloak-crd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2024"
[dependencies]
kube = { version = "0.98.0", features = ["derive"], default-features = false }
k8s-openapi = { version = "0.24.0", features = ["latest", "schemars"] }
serde = { version = "1.0.218", features = ["derive"] }
serde = { version = "1.0.219", features = ["derive"] }
schemars = { version = "0.8.22", features = ["chrono", "either"] }
serde_json = "1.0.140"
keycloak-types = { git = "https://github.com/Gottox/keycloak-client.rs" }
Expand Down
11 changes: 3 additions & 8 deletions rustcloak-operator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ edition = "2024"
[dependencies]
kube = { version = "0.98.0", features = ["runtime", "derive"] }
k8s-openapi = { version = "0.24.0", features = ["latest", "schemars"] }
tokio = { version = "1.43.0", features = ["macros", "rt-multi-thread", "sync"] }
tokio = { version = "1.44.0", features = ["macros", "rt-multi-thread", "sync"] }
clap = { version = "4.5.31", features = ["derive", "help", "std", "string"], default-features = false }
serde = "1.0.218"
serde = "1.0.219"
thiserror = "2.0.12"
log = { version = "0.4.26", features = ["kv"] }
futures = { version = "0.3.31", default-features = false }
Expand All @@ -25,10 +25,5 @@ structured-logger = "1.0.3"
case_style = "0.2.1"
rustcloak-crd = { path = "../rustcloak-crd" }
keycloak-client = { git = "https://github.com/Gottox/keycloak-client.rs" }
#keycloak-client = { path = "../../keycloak-client.rs/keycloak-client" }
shorter-bounds = "0.1.1"

[profile.release]
strip = true
opt-level = "z"
lto = true
panic = "abort"

0 comments on commit 56d13e1

Please sign in to comment.