mirror of
https://codeberg.org/icewind/nextcloud-config-parser.git
synced 2026-06-03 16:44:09 +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"
|
||||||
|
on:
|
||||||
name: CI
|
pull_request:
|
||||||
|
push:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
check:
|
||||||
name: Check
|
runs-on: ubuntu-latest
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- uses: actions-rs/toolchain@v1
|
- uses: cachix/install-nix-action@v24
|
||||||
|
- uses: icewind1991/attic-action@v1
|
||||||
with:
|
with:
|
||||||
profile: minimal
|
name: ci
|
||||||
toolchain: stable
|
instance: https://cache.icewind.me
|
||||||
override: true
|
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
||||||
- uses: Swatinem/rust-cache@v1
|
- run: nix build .#check
|
||||||
- uses: actions-rs/cargo@v1
|
|
||||||
|
check-all-features:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: cachix/install-nix-action@v24
|
||||||
|
- uses: icewind1991/attic-action@v1
|
||||||
with:
|
with:
|
||||||
command: check
|
name: ci
|
||||||
- uses: actions-rs/cargo@v1
|
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:
|
with:
|
||||||
command: check
|
name: ci
|
||||||
args: --features=db-sqlx
|
instance: https://cache.icewind.me
|
||||||
- uses: actions-rs/cargo@v1
|
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
||||||
with:
|
- run: nix build .#clippy
|
||||||
command: check
|
|
||||||
args: --features=redis-connect
|
|
||||||
- uses: actions-rs/cargo@v1
|
|
||||||
with:
|
|
||||||
command: check
|
|
||||||
args: --all-features
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
name: Tests
|
runs-on: ubuntu-latest
|
||||||
runs-on: ubuntu-20.04
|
needs: check
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- uses: actions-rs/toolchain@v1
|
- uses: cachix/install-nix-action@v24
|
||||||
|
- uses: icewind1991/attic-action@v1
|
||||||
with:
|
with:
|
||||||
profile: minimal
|
name: ci
|
||||||
toolchain: stable
|
instance: https://cache.icewind.me
|
||||||
override: true
|
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
||||||
- uses: Swatinem/rust-cache@v1
|
- run: nix build .#test
|
||||||
- uses: actions-rs/cargo@v1
|
|
||||||
|
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:
|
with:
|
||||||
command: test
|
name: ci
|
||||||
- uses: actions-rs/cargo@v1
|
instance: https://cache.icewind.me
|
||||||
with:
|
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
||||||
command: test
|
- run: nix build .#testAll
|
||||||
args: --all-features
|
|
||||||
|
semver:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: check
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Check semver
|
||||||
|
uses: obi1kenobi/cargo-semver-checks-action@v2
|
||||||
|
|
||||||
msrv:
|
msrv:
|
||||||
name: Check MSRV
|
runs-on: ubuntu-latest
|
||||||
runs-on: ubuntu-20.04
|
needs: check
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- uses: actions-rs/toolchain@v1
|
- uses: cachix/install-nix-action@v24
|
||||||
|
- uses: icewind1991/attic-action@v1
|
||||||
with:
|
with:
|
||||||
profile: minimal
|
name: ci
|
||||||
toolchain: 1.58
|
instance: https://cache.icewind.me
|
||||||
override: true
|
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
||||||
- uses: Swatinem/rust-cache@v1
|
- run: nix build .#msrv
|
||||||
- uses: actions-rs/cargo@v1
|
|
||||||
with:
|
|
||||||
command: check
|
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,4 +1,3 @@
|
||||||
/target
|
/target
|
||||||
Cargo.lock
|
|
||||||
.direnv
|
.direnv
|
||||||
result
|
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"
|
license = "MIT OR Apache-2.0"
|
||||||
repository = "https://github.com/icewind1991/nextcloud-config-parser"
|
repository = "https://github.com/icewind1991/nextcloud-config-parser"
|
||||||
documentation = "https://docs.rs/nextcloud-config-parser"
|
documentation = "https://docs.rs/nextcloud-config-parser"
|
||||||
rust-version = "1.58"
|
rust-version = "1.65.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
redis = { version = "0.23.3", optional = true, default-features = false }
|
redis = { version = "0.23.3", optional = true, default-features = false }
|
||||||
|
|
|
||||||
45
flake.lock
generated
45
flake.lock
generated
|
|
@ -1,5 +1,25 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"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": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1701370627,
|
"lastModified": 1701370627,
|
||||||
|
|
@ -17,10 +37,35 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"naersk": "naersk",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
|
"rust-overlay": "rust-overlay",
|
||||||
"utils": "utils"
|
"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": {
|
"systems": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1681028828,
|
"lastModified": 1681028828,
|
||||||
|
|
|
||||||
66
flake.nix
66
flake.nix
|
|
@ -2,18 +2,82 @@
|
||||||
inputs = {
|
inputs = {
|
||||||
utils.url = "github:numtide/flake-utils";
|
utils.url = "github:numtide/flake-utils";
|
||||||
nixpkgs.url = "nixpkgs/release-23.11";
|
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 = {
|
outputs = {
|
||||||
self,
|
self,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
utils,
|
utils,
|
||||||
|
naersk,
|
||||||
|
rust-overlay,
|
||||||
}:
|
}:
|
||||||
utils.lib.eachDefaultSystem (system: let
|
utils.lib.eachDefaultSystem (system: let
|
||||||
|
overlays = [(import rust-overlay)];
|
||||||
pkgs = (import nixpkgs) {
|
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 {
|
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`
|
# `nix develop`
|
||||||
devShell = pkgs.mkShell {
|
devShell = pkgs.mkShell {
|
||||||
nativeBuildInputs = with pkgs; [rustc cargo bacon cargo-edit cargo-outdated clippy cargo-audit cargo-msrv];
|
nativeBuildInputs = with pkgs; [rustc cargo bacon cargo-edit cargo-outdated clippy cargo-audit cargo-msrv];
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ pub enum DbConnect {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Database {
|
impl Database {
|
||||||
pub fn url<'a>(&self) -> String {
|
pub fn url(&self) -> String {
|
||||||
match self {
|
match self {
|
||||||
Database::Sqlite { database } => {
|
Database::Sqlite { database } => {
|
||||||
format!("sqlite://{}", database.display())
|
format!("sqlite://{}", database.display())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue