diff options
author | Alex Auvolat <lx@deuxfleurs.fr> | 2025-02-01 21:48:10 +0100 |
---|---|---|
committer | Alex Auvolat <lx@deuxfleurs.fr> | 2025-02-03 16:39:50 +0100 |
commit | 390a5d97fece744bcad3c5b7b7d31b2722d0b092 (patch) | |
tree | 02ca809d1305f8f76eedfac145fb843489d65d35 /.woodpecker | |
parent | 4dc2bc337f10be616a141ba8b52564038ef3ae41 (diff) | |
download | garage-390a5d97fece744bcad3c5b7b7d31b2722d0b092.tar.gz garage-390a5d97fece744bcad3c5b7b7d31b2722d0b092.zip |
nix, ci: build with Crane
This removes our dependency on cargo2nix, which was causing us some
issues. Whereas cargo2nix creates one Nix derivation per crate, Crane
uses only two derivations:
1. Build dependencies only
2. Build the final binary
This means that during the second step, no caching can be done. For
instance, if we do a change in garage_model, we need to recompile all of
the Garage crates including those that do not depend on garage_model.
On the upside, this allows all of the Garage crates to be built at once
using cargo build logic, which is optimized for high parallelism and
better pipelining between all of the steps of the build. All in all,
this makes most builds faster than cargo2nix.
A few other changes have been made to the build scripts and CI:
- Unit tests are now run within a Nix derivation. In fact, we have
different derivations to run the tests using LMDB and Sqlite as
metadata db engines.
- For debug builds, most CI steps now run in parallel (with the notable
exception of the smoke test that runs after the build, which is
inevitable).
- We no longer pass the GIT_VERSION argument when building debug builds
and running the tests. This means that dev binaries and test
binaries don't know the exact version of Garage they are from. That
shouldn't be an issue in most cases.
- The not-dynamic.sh scripts has been fixed to fail if the file does not
exist.
Diffstat (limited to '.woodpecker')
-rw-r--r-- | .woodpecker/debug.yaml | 33 | ||||
-rw-r--r-- | .woodpecker/release.yaml | 4 |
2 files changed, 12 insertions, 25 deletions
diff --git a/.woodpecker/debug.yaml b/.woodpecker/debug.yaml index c0f8eb91..65dab9ab 100644 --- a/.woodpecker/debug.yaml +++ b/.woodpecker/debug.yaml @@ -16,34 +16,21 @@ steps: - name: build image: nixpkgs/nix:nixos-22.05 commands: - - nix-build -j4 --no-build-output --attr pkgs.amd64.debug --argstr git_version ${CI_COMMIT_TAG:-$CI_COMMIT_SHA} + - nix-build -j4 --attr flakePackages.dev - - name: unit + func tests + - name: unit + func tests (lmdb) image: nixpkgs/nix:nixos-22.05 - environment: - GARAGE_TEST_INTEGRATION_EXE: result-bin/bin/garage - GARAGE_TEST_INTEGRATION_PATH: tmp-garage-integration commands: - - nix-build -j4 --no-build-output --attr test.amd64 --argstr git_version ${CI_COMMIT_TAG:-$CI_COMMIT_SHA} - - ./result/bin/garage_db-* - - ./result/bin/garage_api_common-* - - ./result/bin/garage_api_s3-* - - ./result/bin/garage_api_k2v-* - - ./result/bin/garage_api_admin-* - - ./result/bin/garage_model-* - - ./result/bin/garage_rpc-* - - ./result/bin/garage_table-* - - ./result/bin/garage_util-* - - ./result/bin/garage_web-* - - ./result/bin/garage-* - - GARAGE_TEST_INTEGRATION_DB_ENGINE=lmdb ./result/bin/integration-* || (cat tmp-garage-integration/stderr.log; false) - - nix-shell --attr ci --run "killall -9 garage" || true - - GARAGE_TEST_INTEGRATION_DB_ENGINE=sqlite ./result/bin/integration-* || (cat tmp-garage-integration/stderr.log; false) - - rm result - - rm -rv tmp-garage-integration + - nix-build -j4 --attr flakePackages.tests-lmdb + + - name: unit + func tests (sqlite) + image: nixpkgs/nix:nixos-22.05 + commands: + - nix-build -j4 --attr flakePackages.tests-sqlite - name: integration tests image: nixpkgs/nix:nixos-22.05 commands: - - nix-build -j4 --no-build-output --attr pkgs.amd64.debug --argstr git_version ${CI_COMMIT_TAG:-$CI_COMMIT_SHA} + - nix-build -j4 --attr flakePackages.dev - nix-shell --attr ci --run ./script/test-smoke.sh || (cat /tmp/garage.log; false) + depends_on: [ build ] diff --git a/.woodpecker/release.yaml b/.woodpecker/release.yaml index a2328d5e..0678a45b 100644 --- a/.woodpecker/release.yaml +++ b/.woodpecker/release.yaml @@ -18,12 +18,12 @@ steps: - name: build image: nixpkgs/nix:nixos-22.05 commands: - - nix-build --no-build-output --attr pkgs.${ARCH}.release --argstr git_version ${CI_COMMIT_TAG:-$CI_COMMIT_SHA} + - nix-build --attr releasePackages.${ARCH} --argstr git_version ${CI_COMMIT_TAG:-$CI_COMMIT_SHA} - name: check is static binary image: nixpkgs/nix:nixos-22.05 commands: - - nix-shell --attr ci --run "./script/not-dynamic.sh result-bin/bin/garage" + - nix-shell --attr ci --run "./script/not-dynamic.sh result/bin/garage" - name: integration tests image: nixpkgs/nix:nixos-22.05 |