mirror of
https://codeberg.org/icewind/nextcloud-config-parser.git
synced 2026-06-03 08:34:13 +02:00
nix based ci
This commit is contained in:
parent
25721b7f98
commit
295231ae92
7 changed files with 2232 additions and 54 deletions
123
.github/workflows/rust.yml
vendored
123
.github/workflows/rust.yml
vendored
|
|
@ -1,66 +1,89 @@
|
|||
on: [push, pull_request]
|
||||
|
||||
name: CI
|
||||
name: "CI"
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
check:
|
||||
name: Check
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions-rs/toolchain@v1
|
||||
- uses: actions/checkout@v4
|
||||
- uses: cachix/install-nix-action@v24
|
||||
- uses: icewind1991/attic-action@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
override: true
|
||||
- uses: Swatinem/rust-cache@v1
|
||||
- uses: actions-rs/cargo@v1
|
||||
name: ci
|
||||
instance: https://cache.icewind.me
|
||||
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
||||
- run: nix build .#check
|
||||
|
||||
check-all-features:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: cachix/install-nix-action@v24
|
||||
- uses: icewind1991/attic-action@v1
|
||||
with:
|
||||
command: check
|
||||
- uses: actions-rs/cargo@v1
|
||||
name: ci
|
||||
instance: https://cache.icewind.me
|
||||
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
||||
- run: nix build .#checkAll
|
||||
|
||||
clippy:
|
||||
runs-on: ubuntu-latest
|
||||
needs: check-all-features
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: cachix/install-nix-action@v24
|
||||
- uses: icewind1991/attic-action@v1
|
||||
with:
|
||||
command: check
|
||||
args: --features=db-sqlx
|
||||
- uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: check
|
||||
args: --features=redis-connect
|
||||
- uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: check
|
||||
args: --all-features
|
||||
name: ci
|
||||
instance: https://cache.icewind.me
|
||||
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
||||
- run: nix build .#clippy
|
||||
|
||||
test:
|
||||
name: Tests
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
needs: check
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions-rs/toolchain@v1
|
||||
- uses: actions/checkout@v4
|
||||
- uses: cachix/install-nix-action@v24
|
||||
- uses: icewind1991/attic-action@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
override: true
|
||||
- uses: Swatinem/rust-cache@v1
|
||||
- uses: actions-rs/cargo@v1
|
||||
name: ci
|
||||
instance: https://cache.icewind.me
|
||||
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
||||
- run: nix build .#test
|
||||
|
||||
test-all-features:
|
||||
runs-on: ubuntu-latest
|
||||
needs: check-all-features
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: cachix/install-nix-action@v24
|
||||
- uses: icewind1991/attic-action@v1
|
||||
with:
|
||||
command: test
|
||||
- uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
args: --all-features
|
||||
name: ci
|
||||
instance: https://cache.icewind.me
|
||||
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
||||
- run: nix build .#testAll
|
||||
|
||||
semver:
|
||||
runs-on: ubuntu-latest
|
||||
needs: check
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Check semver
|
||||
uses: obi1kenobi/cargo-semver-checks-action@v2
|
||||
|
||||
msrv:
|
||||
name: Check MSRV
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-latest
|
||||
needs: check
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions-rs/toolchain@v1
|
||||
- uses: actions/checkout@v4
|
||||
- uses: cachix/install-nix-action@v24
|
||||
- uses: icewind1991/attic-action@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: 1.58
|
||||
override: true
|
||||
- uses: Swatinem/rust-cache@v1
|
||||
- uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: check
|
||||
name: ci
|
||||
instance: https://cache.icewind.me
|
||||
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
||||
- run: nix build .#msrv
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,4 +1,3 @@
|
|||
/target
|
||||
Cargo.lock
|
||||
.direnv
|
||||
result
|
||||
|
|
|
|||
2047
Cargo.lock
generated
Normal file
2047
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -7,7 +7,7 @@ edition = "2021"
|
|||
license = "MIT OR Apache-2.0"
|
||||
repository = "https://github.com/icewind1991/nextcloud-config-parser"
|
||||
documentation = "https://docs.rs/nextcloud-config-parser"
|
||||
rust-version = "1.58"
|
||||
rust-version = "1.65.0"
|
||||
|
||||
[dependencies]
|
||||
redis = { version = "0.23.3", optional = true, default-features = false }
|
||||
|
|
|
|||
45
flake.lock
generated
45
flake.lock
generated
|
|
@ -1,5 +1,25 @@
|
|||
{
|
||||
"nodes": {
|
||||
"naersk": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1698420672,
|
||||
"narHash": "sha256-/TdeHMPRjjdJub7p7+w55vyABrsJlt5QkznPYy55vKA=",
|
||||
"owner": "nix-community",
|
||||
"repo": "naersk",
|
||||
"rev": "aeb58d5e8faead8980a807c840232697982d47b9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "naersk",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1701370627,
|
||||
|
|
@ -17,10 +37,35 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"naersk": "naersk",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"rust-overlay": "rust-overlay",
|
||||
"utils": "utils"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": [
|
||||
"utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1701310566,
|
||||
"narHash": "sha256-CL9J3xUR2Ejni4LysrEGX0IdO+Y4BXCiH/By0lmF3eQ=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "6d3c6e185198b8bf7ad639f22404a75aa9a09bff",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
|
|
|
|||
66
flake.nix
66
flake.nix
|
|
@ -2,18 +2,82 @@
|
|||
inputs = {
|
||||
utils.url = "github:numtide/flake-utils";
|
||||
nixpkgs.url = "nixpkgs/release-23.11";
|
||||
naersk.url = "github:nix-community/naersk";
|
||||
naersk.inputs.nixpkgs.follows = "nixpkgs";
|
||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
|
||||
rust-overlay.inputs.flake-utils.follows = "utils";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
utils,
|
||||
naersk,
|
||||
rust-overlay,
|
||||
}:
|
||||
utils.lib.eachDefaultSystem (system: let
|
||||
overlays = [(import rust-overlay)];
|
||||
pkgs = (import nixpkgs) {
|
||||
inherit system;
|
||||
inherit system overlays;
|
||||
};
|
||||
|
||||
inherit (pkgs) lib callPackage rust-bin mkShell;
|
||||
inherit (lib.sources) sourceByRegex;
|
||||
|
||||
msrv = (fromTOML (readFile ./Cargo.toml)).package.rust-version;
|
||||
inherit (builtins) fromTOML readFile;
|
||||
toolchain = rust-bin.stable.latest.default;
|
||||
msrvToolchain = rust-bin.stable."${msrv}".default;
|
||||
|
||||
naersk' = callPackage naersk {
|
||||
rustc = toolchain;
|
||||
cargo = toolchain;
|
||||
};
|
||||
msrvNaersk = callPackage naersk {
|
||||
rustc = msrvToolchain;
|
||||
cargo = msrvToolchain;
|
||||
};
|
||||
|
||||
src = sourceByRegex ./. ["Cargo.*" "(src|derive|benches|tests|examples)(/.*)?"];
|
||||
nearskOpt = {
|
||||
pname = "nextcloud-config-parser";
|
||||
root = src;
|
||||
};
|
||||
in rec {
|
||||
packages = {
|
||||
check = naersk'.buildPackage (nearskOpt
|
||||
// {
|
||||
mode = "check";
|
||||
});
|
||||
checkAll = naersk'.buildPackage (nearskOpt
|
||||
// {
|
||||
mode = "check";
|
||||
cargoBuildOptions = x: x++ ["--all-features"];
|
||||
});
|
||||
clippy = naersk'.buildPackage (nearskOpt
|
||||
// {
|
||||
mode = "clippy";
|
||||
cargoBuildOptions = x: x++ ["--all-features"];
|
||||
});
|
||||
test = naersk'.buildPackage (nearskOpt
|
||||
// {
|
||||
release = false;
|
||||
mode = "test";
|
||||
});
|
||||
testAll = naersk'.buildPackage (nearskOpt
|
||||
// {
|
||||
release = false;
|
||||
mode = "test";
|
||||
cargoTestOptions = x: x++ ["--all-features"];
|
||||
});
|
||||
msrv = msrvNaersk.buildPackage (nearskOpt
|
||||
// {
|
||||
mode = "check";
|
||||
cargoBuildOptions = x: x++ ["--all-features"];
|
||||
});
|
||||
};
|
||||
|
||||
# `nix develop`
|
||||
devShell = pkgs.mkShell {
|
||||
nativeBuildInputs = with pkgs; [rustc cargo bacon cargo-edit cargo-outdated clippy cargo-audit cargo-msrv];
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ pub enum DbConnect {
|
|||
}
|
||||
|
||||
impl Database {
|
||||
pub fn url<'a>(&self) -> String {
|
||||
pub fn url(&self) -> String {
|
||||
match self {
|
||||
Database::Sqlite { database } => {
|
||||
format!("sqlite://{}", database.display())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue