2023-09-16 19:15:10 +00:00
|
|
|
stages:
|
|
|
|
- lint
|
|
|
|
- build
|
|
|
|
- deploy
|
|
|
|
|
|
|
|
# Set any required environment variables here
|
|
|
|
variables:
|
|
|
|
RUST_BACKTRACE: FULL
|
|
|
|
|
2024-06-03 19:55:39 +00:00
|
|
|
.scripts_cache: &scripts_cache
|
|
|
|
- nix --extra-experimental-features 'nix-command flakes' profile install nixpkgs#attic-client
|
|
|
|
- attic login skynet https://nix-cache.skynet.ie/ $CACHE_KEY
|
|
|
|
- attic use skynet-cache
|
2024-06-03 22:06:27 +00:00
|
|
|
- attic watch-store skynet-cache &
|
2023-09-16 19:15:10 +00:00
|
|
|
|
2024-06-03 22:06:27 +00:00
|
|
|
.build_template: &nix
|
|
|
|
tags:
|
|
|
|
- nix
|
|
|
|
before_script:
|
|
|
|
- *scripts_cache
|
|
|
|
|
|
|
|
.rules_template: &rules
|
2023-09-16 19:15:10 +00:00
|
|
|
rules:
|
|
|
|
- if: $CI_COMMIT_TAG
|
|
|
|
when: never
|
|
|
|
- changes:
|
|
|
|
- src/**/*
|
2024-06-03 04:09:24 +00:00
|
|
|
- Cargo.*
|
2023-09-16 19:15:10 +00:00
|
|
|
when: always
|
|
|
|
|
2024-06-03 22:06:27 +00:00
|
|
|
# clippy and fmt are magic
|
|
|
|
# runs on all commits/branches
|
|
|
|
lint-clippy:
|
|
|
|
stage: lint
|
|
|
|
<<: *nix
|
|
|
|
<<: *rules
|
|
|
|
script:
|
|
|
|
- nix --extra-experimental-features "nix-command flakes" build --verbose .#clippy
|
|
|
|
|
2023-09-16 19:15:10 +00:00
|
|
|
lint-fmt:
|
|
|
|
stage: lint
|
2024-06-03 22:06:27 +00:00
|
|
|
<<: *nix
|
|
|
|
<<: *rules
|
2023-09-16 19:15:10 +00:00
|
|
|
script:
|
2024-06-03 22:06:27 +00:00
|
|
|
- nix --extra-experimental-features "nix-command flakes" build --verbose .#fmt
|
2023-09-16 19:15:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
# has to actually compile
|
|
|
|
build:
|
|
|
|
stage: build
|
2024-06-03 22:06:27 +00:00
|
|
|
<<: *nix
|
2023-09-16 19:15:10 +00:00
|
|
|
script:
|
2024-06-03 20:10:28 +00:00
|
|
|
- nix --extra-experimental-features "nix-command flakes" build --verbose
|
2023-09-16 19:15:10 +00:00
|
|
|
rules:
|
|
|
|
- if: $CI_COMMIT_TAG
|
|
|
|
when: never
|
|
|
|
- changes:
|
|
|
|
- src/**/*
|
2024-06-03 04:09:24 +00:00
|
|
|
- Cargo.*
|
2023-09-16 19:15:10 +00:00
|
|
|
when: on_success
|
|
|
|
|
|
|
|
|
|
|
|
# from https://docs.gitlab.com/ee/ci/pipelines/multi_project_pipelines.html
|
|
|
|
# so simple to deploy now
|
|
|
|
nixos:
|
|
|
|
stage: deploy
|
|
|
|
variables:
|
|
|
|
PACKAGE_NAME: "skynet_discord_bot"
|
|
|
|
UPDATE_FLAKE: "yes"
|
|
|
|
trigger: compsoc1/skynet/nixos
|
|
|
|
rules:
|
|
|
|
- if: $CI_COMMIT_TAG
|
|
|
|
when: never
|
|
|
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
|
|
when: on_success
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|