use nix-built binary to produce debian package

Currently just for `x86_64-unknown-linux-musl`. Theoretically, we can
use this same mechanism for `aarch64-unknown-linux-musl`. Practically,
I'm not sure just this will even work.
This commit is contained in:
Charles Hall 2024-03-04 23:12:17 -08:00
parent 4e09c9e58a
commit d5a9c6ac32
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF
3 changed files with 16 additions and 27 deletions

View file

@ -43,13 +43,18 @@ ci:
- target
- .gitlab-ci.d
nix:artifacts:
artifacts:
stage: artifacts
image: nixos/nix:2.20.4
script:
- ./bin/nix-build-and-cache .#static-x86_64-unknown-linux-musl
- cp result/bin/conduit x86_64-unknown-linux-musl
- mkdir -p target/release
- cp result/bin/conduit target/release
- direnv exec . cargo deb --no-build
- mv target/debian/*.deb x86_64-unknown-linux-musl.deb
# Since the OCI image package is based on the binary package, this has the
# fun side effect of uploading the normal binary too. Conduit users who are
# deploying with Nix can leverage this fact by adding our binary cache to
@ -70,29 +75,10 @@ nix:artifacts:
paths:
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-musl
- x86_64-unknown-linux-musl.deb
- oci-image-amd64.tar.gz
- oci-image-arm64v8.tar.gz
debian:x86_64-unknown-linux-gnu:
stage: artifacts
# See also `rust-toolchain.toml`
image: rust:1.75.0
script:
- apt-get update && apt-get install -y --no-install-recommends libclang-dev
- cargo install cargo-deb
- cargo deb
# Make the output less difficult to find
- mv target/debian/*.deb conduit.deb
artifacts:
paths:
- conduit.deb
cache:
key: debian
paths:
- target
- .gitlab-ci.d
.push-oci-image:
stage: publish
image: docker:25.0.0
@ -124,7 +110,7 @@ debian:x86_64-unknown-linux-gnu:
docker manifest push $IMAGE_NAME:latest
fi
dependencies:
- nix:artifacts
- artifacts
only:
- next
- master