variable "acct" { default = "$GITHUB_ACTOR" } variable "repo" { default = "$GITHUB_REPOSITORY" } variable "docker_repo" { default = "$DOCKER_ID" } variable "git_ref" { default = "$GITHUB_REF" } variable "git_ref_sha" { default = "$GITHUB_REF_SHA" } variable "git_ref_name" { default = "$GITHUB_REF_NAME" } cargo_feat_sets = { none = "" default = "brotli_compression,element_hacks,gzip_compression,io_uring,jemalloc,jemalloc_conf,media_thumbnail,release_max_log_level,systemd,url_preview,zstd_compression" all = "blurhashing,brotli_compression,tuwunel_mods,console,default,direct_tls,element_hacks,gzip_compression,hardened_malloc,io_uring,jemalloc,jemalloc_conf,jemalloc_prof,jemalloc_stats,ldap,media_thumbnail,perf_measurements,release_max_log_level,sentry_telemetry,systemd,tokio_console,url_preview,zstd_compression" } variable "cargo_features_always" { default = "direct_tls" } variable "feat_sets" { default = "[\"none\", \"default\", \"all\"]" } variable "cargo_profiles" { default = "[\"test\", \"bench\"]" } variable "cargo_install_root" { default = "/usr" } variable "rust_toolchains" { default = "[\"nightly\", \"stable\"]" } variable "rust_targets" { default = "[\"x86_64-unknown-linux-gnu\"]" } variable "sys_targets" { default = "[\"x86_64-linux-gnu\"]" } variable "sys_versions" { default = "[\"testing-slim\"]" } variable "sys_names" { default = "[\"debian\"]" } # RocksDB options variable "rocksdb_portable" { default = 1 } variable "rocksdb_opt_level" { default = "3" } variable "rocksdb_build_type" { default = "Release" } variable "rocksdb_make_verbose" { default = "ON" } # Complement options variable "complement_count" { default = 1 } variable "complement_debug" { default = 0 } variable "complement_run" { default = ".*" } variable "complement_skip" { default = "" } # Package metadata inputs variable "package_name" { default = "tuwunel" } variable "package_authors" { default = "Jason Volk " } variable "package_version" { default = "1.0" } variable "package_revision" { default = "" } variable "package_last_modified" { default = "" } # Use the cargo-chef layering strategy to separate and pre-build dependencies # in a lower-layer image; only workspace crates will rebuild unless # dependencies themselves change (default). This option can be set to false for # bypassing chef, building within a single layer. variable "use_chef" { default = "true" } # Options for output verbosity variable "BUILDKIT_PROGRESS" {} variable "CARGO_TERM_VERBOSE" { default = BUILDKIT_PROGRESS == "plain"? 1: 0 } # Override the project checkout variable "git_checkout" { default = "HEAD" } nightly_rustflags = [ "--cfg tokio_unstable", "--cfg tuwunel_bench", "--allow=unstable-features", "-Zcrate-attr=feature(test)", "-Zenforce-type-length-limit", ] # # Default # group "default" { targets = [ "lints", "tests", ] } group "lints" { targets = [ "audit", "check", "clippy", "docs", "fmt", "lychee", ] } group "tests" { targets = [ "tests-unit", "tests-bench", "tests-smoke", "complement", ] } # # Common matrices # cargo_rust_feat_sys = { cargo_profile = jsondecode(cargo_profiles) rust_toolchain = jsondecode(rust_toolchains) rust_target = jsondecode(rust_targets) feat_set = jsondecode(feat_sets) sys_name = jsondecode(sys_names) sys_version = jsondecode(sys_versions) sys_target = jsondecode(sys_targets) } rust_feat_sys = { rust_toolchain = jsondecode(rust_toolchains) rust_target = jsondecode(rust_targets) feat_set = jsondecode(feat_sets) sys_name = jsondecode(sys_names) sys_version = jsondecode(sys_versions) sys_target = jsondecode(sys_targets) } feat_sys = { feat_set = jsondecode(feat_sets) sys_name = jsondecode(sys_names) sys_version = jsondecode(sys_versions) sys_target = jsondecode(sys_targets) } sys = { sys_name = jsondecode(sys_names) sys_version = jsondecode(sys_versions) sys_target = jsondecode(sys_targets) } # # Publish # group "publish" { targets = [ "dockerhub", "github", ] } target "github" { name = elem("github", [cargo_profile, rust_toolchain, rust_target, feat_set, sys_name, sys_version, sys_target]) tags = [ "ghcr.io/${repo}:${git_ref_name}-${cargo_profile}-${feat_set}-${sys_target}", (cargo_profile == "release" && feat_set == "all")? "ghcr.io/${repo}:${git_ref_name}": "", (git_ref_name == "main" && cargo_profile == "release" && feat_set == "all")? "ghcr.io/${repo}:latest": "", ] output = ["type=registry,compression=zstd,mode=min"] matrix = cargo_rust_feat_sys inherits = [ elem("tuwunel", [cargo_profile, rust_toolchain, rust_target, feat_set, sys_name, sys_version, sys_target]), ] } target "dockerhub" { name = elem("dockerhub", [cargo_profile, rust_toolchain, rust_target, feat_set, sys_name, sys_version, sys_target]) tags = [ "${docker_repo}:${git_ref_name}-${cargo_profile}-${feat_set}-${sys_target}", (cargo_profile == "release" && feat_set == "all")? "${docker_repo}:${git_ref_name}": "", (git_ref_name == "main" && cargo_profile == "release" && feat_set == "all")? "${docker_repo}:latest": "", ] output = ["type=registry,compression=zstd,mode=min"] matrix = cargo_rust_feat_sys inherits = [ elem("tuwunel", [cargo_profile, rust_toolchain, rust_target, feat_set, sys_name, sys_version, sys_target]), ] } target "tuwunel" { name = elem("tuwunel", [cargo_profile, rust_toolchain, rust_target, feat_set, sys_name, sys_version, sys_target]) tags = [ elem_tag("tuwunel", [cargo_profile, rust_toolchain, rust_target, feat_set, sys_name, sys_version, sys_target], "latest"), ] output = ["type=docker,compression=zstd,mode=min"] matrix = cargo_rust_feat_sys inherits = [ elem("install", [cargo_profile, rust_toolchain, rust_target, feat_set, sys_name, sys_version, sys_target]), ] contexts = { input = elem("target:install", [cargo_profile, rust_toolchain, rust_target, feat_set, sys_name, sys_version, sys_target]) } target = "tuwunel" dockerfile-inline =<