Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: introduce justfile for building locally #16

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/.idea
/.vscode
/target
/artifacts
**/artifacts
.intentionally-empty-file.o

*.swp
Expand Down
34 changes: 34 additions & 0 deletions identity-server/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Define variables
artifacts_dir := "artifacts"
target_dir := "../target"
package_name := "identity-server"
targets := ("x86_64-unknown-linux-musl"
+ "aarch64-unknown-linux-musl"
+ "x86_64-pc-windows-gnu"
+ "aarch64-apple-darwin")

default: all

# Build Rust binaries for different targets
rust-build:
cargo-zigbuild build --profile artifact -p {{package_name}} --target aarch64-apple-darwin --target x86_64-pc-windows-gnu --target aarch64-unknown-linux-musl --target x86_64-unknown-linux-musl

# Copy artifacts from cargo target dir into to the artifacts directory
artifacts: rust-build
pwd
mkdir -p {{artifacts_dir}}
cp {{target_dir}}/aarch64-apple-darwin/artifact/{{package_name}} {{artifacts_dir}}/{{package_name}}-macos-aarch64
cp {{target_dir}}/x86_64-unknown-linux-musl/artifact/{{package_name}} {{artifacts_dir}}/{{package_name}}-linux-x86_64
cp {{target_dir}}/aarch64-unknown-linux-musl/artifact/{{package_name}} {{artifacts_dir}}/{{package_name}}-linux-aarch64
cp {{target_dir}}/x86_64-pc-windows-gnu/artifact/{{package_name}}.exe {{artifacts_dir}}/{{package_name}}-windows-x86_64.exe

# Build Docker image
podman: artifacts
podman build --platform linux/arm64,linux/amd64,windows/amd64 .

# Clean artifacts
clean:
rm -rf {{artifacts_dir}}

# Run all tasks
all: rust-build artifacts podman