CI: Use caching for nix
This commit is contained in:
parent
e8a6ebafc2
commit
2955f68562
2 changed files with 17 additions and 8 deletions
|
@ -1,7 +1,7 @@
|
|||
depends_on:
|
||||
- build
|
||||
- test
|
||||
- lint
|
||||
#depends_on:
|
||||
# - build
|
||||
# - test
|
||||
# - lint
|
||||
|
||||
when:
|
||||
- event: push
|
||||
|
@ -17,9 +17,15 @@ steps:
|
|||
build:
|
||||
image: nixos/nix:latest
|
||||
commands:
|
||||
- nix --extra-experimental-features "nix-command flakes" build ".#agent.${BUILD_TARGET}"
|
||||
- export AWS_ACCESS_KEY_ID="$${R2_CACHE_ACCESS_KEY}"
|
||||
- export AWS_SECRET_ACCESS_KEY="$${R2_CACHE_SECRET_KEY}"
|
||||
- echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf
|
||||
- echo "substituters = s3://prymn-cache?endpoint=75178f9eca227dea51b3db4db2c15a5a.r2.cloudflarestorage.com®ion=auto https://cache.nixos.org/" >> /etc/nix/nix.conf
|
||||
- nix build -L ".#agent.${BUILD_TARGET}"
|
||||
- mkdir -p "dist/${BUILD_TARGET}-unknown-linux-musl"
|
||||
- cp result/bin/prymn_agent "dist/${BUILD_TARGET}-unknown-linux-musl/"
|
||||
- nix copy --to 's3://prymn-cache?endpoint=75178f9eca227dea51b3db4db2c15a5a.r2.cloudflarestorage.com®ion=auto' ".#agent.${BUILD_TARGET}"
|
||||
secrets: [ R2_CACHE_ACCESS_KEY, R2_CACHE_SECRET_KEY ]
|
||||
|
||||
release:
|
||||
image: woodpeckerci/plugin-s3
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
|
||||
let
|
||||
craneLib = (crane.mkLib pkgs).overrideToolchain pkgs.rustToolchain;
|
||||
buildInputs = [ pkgs.protobuf ];
|
||||
doCheck = false;
|
||||
nativeBuildInputs = [ pkgs.protobuf ];
|
||||
src = pkgs.lib.cleanSourceWith {
|
||||
src = craneLib.path ../.;
|
||||
filter = path: type:
|
||||
|
@ -15,8 +14,12 @@ let
|
|||
};
|
||||
in
|
||||
craneLib.buildPackage {
|
||||
inherit src doCheck buildInputs;
|
||||
inherit src nativeBuildInputs;
|
||||
|
||||
pname = "prymn_agent";
|
||||
version = "0.1.0";
|
||||
doCheck = false; # FIXME: Tests need to run on the native architecture
|
||||
strictDeps = true;
|
||||
CARGO_BUILD_RUSTFLAGS = "-C target-feature=+crt-static -C linker=rust-lld";
|
||||
CARGO_BUILD_TARGET = buildTarget;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue