Revert "ci: improvements to building in pipeline"
This reverts commit d8b232b546
.
This commit is contained in:
parent
bee41c192f
commit
394d6b4545
4 changed files with 65 additions and 100 deletions
|
@ -1,3 +1,6 @@
|
|||
# copied a good chunk from my bfom config
|
||||
image: rust:latest
|
||||
|
||||
stages:
|
||||
- lint
|
||||
- build
|
||||
|
@ -11,15 +14,17 @@ variables:
|
|||
- 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
|
||||
- attic watch-store skynet-cache &
|
||||
|
||||
.build_template: &nix
|
||||
tags:
|
||||
- nix
|
||||
before_script:
|
||||
- *scripts_cache
|
||||
|
||||
.rules_template: &rules
|
||||
# clippy and fmt are magic
|
||||
# runs on all commits/branches
|
||||
lint-clippy:
|
||||
stage: lint
|
||||
script:
|
||||
- rustup component add clippy
|
||||
- rustc --version
|
||||
- cargo version
|
||||
- cargo clippy
|
||||
- cargo test --verbose
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG
|
||||
when: never
|
||||
|
@ -28,28 +33,31 @@ variables:
|
|||
- Cargo.*
|
||||
when: always
|
||||
|
||||
# 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
|
||||
|
||||
lint-fmt:
|
||||
stage: lint
|
||||
<<: *nix
|
||||
<<: *rules
|
||||
script:
|
||||
- nix --extra-experimental-features "nix-command flakes" build --verbose .#fmt
|
||||
- rustup component add rustfmt
|
||||
- rustc --version
|
||||
- cargo version
|
||||
- cargo fmt -- --check
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG
|
||||
when: never
|
||||
- changes:
|
||||
- src/**/*
|
||||
- Cargo.*
|
||||
when: always
|
||||
|
||||
|
||||
# has to actually compile
|
||||
build:
|
||||
stage: build
|
||||
<<: *nix
|
||||
tags:
|
||||
- nix
|
||||
before_script:
|
||||
- *scripts_cache
|
||||
script:
|
||||
- attic watch-store skynet-cache &
|
||||
- nix --extra-experimental-features "nix-command flakes" build --verbose
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG
|
||||
|
|
56
flake.lock
56
flake.lock
|
@ -1,57 +1,55 @@
|
|||
{
|
||||
"nodes": {
|
||||
"crane": {
|
||||
"naersk": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1717386774,
|
||||
"narHash": "sha256-YYMGHDo4f+tu7k2q6hWNiI5C8gAN5eksb3g3EbKFf4k=",
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"rev": "ad21f86e47a2751faa99aecd0d494be70411d5e9",
|
||||
"lastModified": 1692351612,
|
||||
"narHash": "sha256-KTGonidcdaLadRnv9KFgwSMh1ZbXoR/OBmPjeNMhFwU=",
|
||||
"owner": "nix-community",
|
||||
"repo": "naersk",
|
||||
"rev": "78789c30d64dea2396c9da516bbcc8db3a475207",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"owner": "nix-community",
|
||||
"repo": "naersk",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1714656196,
|
||||
"narHash": "sha256-kjQkA98lMcsom6Gbhw8SYzmwrSo+2nruiTcTZp5jK7o=",
|
||||
"lastModified": 1693060755,
|
||||
"narHash": "sha256-KNsbfqewEziFJEpPR0qvVz4rx0x6QXxw1CcunRhlFdk=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "94035b482d181af0a0f8f77823a790b256b7c3cc",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1717144377,
|
||||
"narHash": "sha256-F/TKWETwB5RaR8owkPPi+SPJh83AQsm6KrQAlJ8v/uA=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "805a384895c696f802a9bf5bf4720f37385df547",
|
||||
"rev": "c66ccfa00c643751da2fd9290e096ceaa30493fc",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-24.05",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1693087214,
|
||||
"narHash": "sha256-Kn1SSqRfPpqcI1MDy82JXrPT1WI8c03TA2F0xu6kS+4=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "f155f0cf4ea43c4e3c8918d2d327d44777b6cad4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-23.05",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"crane": "crane",
|
||||
"naersk": "naersk",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"utils": "utils"
|
||||
}
|
||||
|
|
57
flake.nix
57
flake.nix
|
@ -2,8 +2,8 @@
|
|||
description = "Skynet Discord Bot";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "nixpkgs/nixos-24.05";
|
||||
crane.url = "github:ipetkov/crane";
|
||||
nixpkgs.url = "nixpkgs/nixos-23.05";
|
||||
naersk.url = "github:nix-community/naersk";
|
||||
utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
|
@ -21,67 +21,26 @@
|
|||
self,
|
||||
nixpkgs,
|
||||
utils,
|
||||
crane,
|
||||
naersk,
|
||||
}:
|
||||
utils.lib.eachDefaultSystem (
|
||||
system: let
|
||||
pkgs = nixpkgs.legacyPackages."${system}";
|
||||
|
||||
naersk-lib = naersk.lib."${system}";
|
||||
package_name = "skynet_discord_bot";
|
||||
desc = "Skynet Discord Bot";
|
||||
|
||||
craneLib = crane.mkLib pkgs;
|
||||
|
||||
src = craneLib.cleanCargoSource (craneLib.path ./.);
|
||||
|
||||
commonArgs = {
|
||||
src = src;
|
||||
strictDeps = true;
|
||||
|
||||
in rec {
|
||||
# `nix build`
|
||||
packages."${package_name}" = naersk-lib.buildPackage {
|
||||
pname = "${package_name}";
|
||||
root = ./.;
|
||||
|
||||
buildInputs = with pkgs; [
|
||||
# Add extra build inputs here, etc.
|
||||
openssl
|
||||
];
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
# Add extra native build inputs here, etc.
|
||||
pkg-config
|
||||
];
|
||||
};
|
||||
|
||||
cargoArtifacts = craneLib.buildDepsOnly (commonArgs
|
||||
// {
|
||||
pname = "${package_name}-deps";
|
||||
});
|
||||
|
||||
clippy = craneLib.cargoClippy (commonArgs
|
||||
// {
|
||||
inherit cargoArtifacts;
|
||||
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
|
||||
});
|
||||
|
||||
fmt = craneLib.cargoFmt {
|
||||
inherit src;
|
||||
};
|
||||
|
||||
result = craneLib.buildPackage (commonArgs
|
||||
// {
|
||||
inherit cargoArtifacts;
|
||||
});
|
||||
in rec {
|
||||
packages = {
|
||||
# nix build --verbose
|
||||
"${package_name}" = result;
|
||||
|
||||
# nix build --verbose .#clippy
|
||||
clippy = clippy;
|
||||
|
||||
# nix build --verbose .#fmt
|
||||
fmt = fmt;
|
||||
};
|
||||
|
||||
defaultPackage = packages."${package_name}";
|
||||
|
||||
# `nix run`
|
||||
|
|
Loading…
Reference in a new issue