reddit-magnet/.gitlab-ci.yml

84 lines
2.4 KiB
YAML

---
stages:
- test
- build
- publish
default:
tests:
stage: test
image: rust
before_script:
- rustc --version
- cargo --version
- rustup component add rustfmt
script:
- cargo fmt --check
- cargo test
flake-check:
stage: test
image: nixpkgs/nix-flakes:nixos-24.11-x86_64-linux
before_script:
- mkdir -p ~/.ssh
- eval $(ssh-agent -s)
- chmod 400 "$NIX_SSH_PRIVATE_KEY"
- ssh-add "$NIX_SSH_PRIVATE_KEY"
- cp "$SSH_KNOWN_HOSTS" ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- echo "substituters = ssh://nix-ssh@build.enoent.fr?priority=10 https://cache.nixos.org?priority=40 https://cuda-maintainers.cachix.org https://nix-community.cachix.org https://statix.cachix.org https://pre-commit-hooks.cachix.org" >> /etc/nix/nix.conf
- echo "trusted-substituters = ssh://nix-ssh@build.enoent.fr" >> /etc/nix/nix.conf
- echo "trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= statix.cachix.org-1:Z9E/g1YjCjU117QOOt07OjhljCoRZddiAm4VVESvais= pre-commit-hooks.cachix.org-1:Pkk3Panw5AW24TOv6kz3PvLhlH8puAsJTBbOPmBo7Rc=" >> /etc/nix/nix.conf
- echo "extra-trusted-public-keys = galatea-0:E7F1FzfoY+X9l9Xn9AvNWDkW1U7H644FHDzX3lpxHkI=" >> /etc/nix/nix.conf
- echo "builders-use-substitutes = true" >> /etc/nix/nix.conf
- echo "max-jobs = 0" >> /etc/nix/nix.conf
- echo "ssh://nix-ssh@build.enoent.fr x86_64-linux" >> /etc/nix/machines
- echo "ssh://nix-ssh@build.enoent.fr aarch64-linux" >> /etc/nix/machines
- nix store info --store ssh://nix-ssh@build.enoent.fr
script:
- nix flake check
build:amd64:
stage: build
image: rust
before_script:
- rustc --version
- cargo --version
script:
- cargo build --release
artifacts:
paths:
- target/release/reddit-magnet
rustdoc:
stage: build
image: rust
before_script:
- rustc --version
- cargo --version
script:
- cargo doc
artifacts:
paths:
- target/doc
pages:
stage: publish
image: alpine
dependencies:
- build:amd64
- rustdoc
script:
- mkdir -p public
- mv target/doc public/doc
- mv target/release/reddit-magnet public/reddit-magnet-amd64
artifacts:
paths:
- public
only:
- main
...