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:
|
stages:
|
||||||
- lint
|
- lint
|
||||||
- build
|
- build
|
||||||
|
@ -11,15 +14,17 @@ variables:
|
||||||
- nix --extra-experimental-features 'nix-command flakes' profile install nixpkgs#attic-client
|
- nix --extra-experimental-features 'nix-command flakes' profile install nixpkgs#attic-client
|
||||||
- attic login skynet https://nix-cache.skynet.ie/ $CACHE_KEY
|
- attic login skynet https://nix-cache.skynet.ie/ $CACHE_KEY
|
||||||
- attic use skynet-cache
|
- attic use skynet-cache
|
||||||
- attic watch-store skynet-cache &
|
|
||||||
|
|
||||||
.build_template: &nix
|
# clippy and fmt are magic
|
||||||
tags:
|
# runs on all commits/branches
|
||||||
- nix
|
lint-clippy:
|
||||||
before_script:
|
stage: lint
|
||||||
- *scripts_cache
|
script:
|
||||||
|
- rustup component add clippy
|
||||||
.rules_template: &rules
|
- rustc --version
|
||||||
|
- cargo version
|
||||||
|
- cargo clippy
|
||||||
|
- cargo test --verbose
|
||||||
rules:
|
rules:
|
||||||
- if: $CI_COMMIT_TAG
|
- if: $CI_COMMIT_TAG
|
||||||
when: never
|
when: never
|
||||||
|
@ -28,28 +33,31 @@ variables:
|
||||||
- Cargo.*
|
- Cargo.*
|
||||||
when: always
|
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:
|
lint-fmt:
|
||||||
stage: lint
|
stage: lint
|
||||||
<<: *nix
|
|
||||||
<<: *rules
|
|
||||||
script:
|
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
|
# has to actually compile
|
||||||
build:
|
build:
|
||||||
stage: build
|
stage: build
|
||||||
<<: *nix
|
tags:
|
||||||
|
- nix
|
||||||
|
before_script:
|
||||||
|
- *scripts_cache
|
||||||
script:
|
script:
|
||||||
|
- attic watch-store skynet-cache &
|
||||||
- nix --extra-experimental-features "nix-command flakes" build --verbose
|
- nix --extra-experimental-features "nix-command flakes" build --verbose
|
||||||
rules:
|
rules:
|
||||||
- if: $CI_COMMIT_TAG
|
- if: $CI_COMMIT_TAG
|
||||||
|
|
56
flake.lock
56
flake.lock
|
@ -1,57 +1,55 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"crane": {
|
"naersk": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1717386774,
|
"lastModified": 1692351612,
|
||||||
"narHash": "sha256-YYMGHDo4f+tu7k2q6hWNiI5C8gAN5eksb3g3EbKFf4k=",
|
"narHash": "sha256-KTGonidcdaLadRnv9KFgwSMh1ZbXoR/OBmPjeNMhFwU=",
|
||||||
"owner": "ipetkov",
|
"owner": "nix-community",
|
||||||
"repo": "crane",
|
"repo": "naersk",
|
||||||
"rev": "ad21f86e47a2751faa99aecd0d494be70411d5e9",
|
"rev": "78789c30d64dea2396c9da516bbcc8db3a475207",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "ipetkov",
|
"owner": "nix-community",
|
||||||
"repo": "crane",
|
"repo": "naersk",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1714656196,
|
"lastModified": 1693060755,
|
||||||
"narHash": "sha256-kjQkA98lMcsom6Gbhw8SYzmwrSo+2nruiTcTZp5jK7o=",
|
"narHash": "sha256-KNsbfqewEziFJEpPR0qvVz4rx0x6QXxw1CcunRhlFdk=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "94035b482d181af0a0f8f77823a790b256b7c3cc",
|
"rev": "c66ccfa00c643751da2fd9290e096ceaa30493fc",
|
||||||
"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",
|
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"id": "nixpkgs",
|
"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"
|
"type": "indirect"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"crane": "crane",
|
"naersk": "naersk",
|
||||||
"nixpkgs": "nixpkgs_2",
|
"nixpkgs": "nixpkgs_2",
|
||||||
"utils": "utils"
|
"utils": "utils"
|
||||||
}
|
}
|
||||||
|
|
57
flake.nix
57
flake.nix
|
@ -2,8 +2,8 @@
|
||||||
description = "Skynet Discord Bot";
|
description = "Skynet Discord Bot";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "nixpkgs/nixos-24.05";
|
nixpkgs.url = "nixpkgs/nixos-23.05";
|
||||||
crane.url = "github:ipetkov/crane";
|
naersk.url = "github:nix-community/naersk";
|
||||||
utils.url = "github:numtide/flake-utils";
|
utils.url = "github:numtide/flake-utils";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21,67 +21,26 @@
|
||||||
self,
|
self,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
utils,
|
utils,
|
||||||
crane,
|
naersk,
|
||||||
}:
|
}:
|
||||||
utils.lib.eachDefaultSystem (
|
utils.lib.eachDefaultSystem (
|
||||||
system: let
|
system: let
|
||||||
pkgs = nixpkgs.legacyPackages."${system}";
|
pkgs = nixpkgs.legacyPackages."${system}";
|
||||||
|
naersk-lib = naersk.lib."${system}";
|
||||||
package_name = "skynet_discord_bot";
|
package_name = "skynet_discord_bot";
|
||||||
desc = "Skynet Discord Bot";
|
desc = "Skynet Discord Bot";
|
||||||
|
in rec {
|
||||||
craneLib = crane.mkLib pkgs;
|
# `nix build`
|
||||||
|
packages."${package_name}" = naersk-lib.buildPackage {
|
||||||
src = craneLib.cleanCargoSource (craneLib.path ./.);
|
|
||||||
|
|
||||||
commonArgs = {
|
|
||||||
src = src;
|
|
||||||
strictDeps = true;
|
|
||||||
|
|
||||||
pname = "${package_name}";
|
pname = "${package_name}";
|
||||||
|
root = ./.;
|
||||||
|
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
# Add extra build inputs here, etc.
|
|
||||||
openssl
|
openssl
|
||||||
];
|
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs; [
|
|
||||||
# Add extra native build inputs here, etc.
|
|
||||||
pkg-config
|
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}";
|
defaultPackage = packages."${package_name}";
|
||||||
|
|
||||||
# `nix run`
|
# `nix run`
|
||||||
|
|
Loading…
Reference in a new issue