mirror of
https://codeberg.org/icewind/php-literal-parser.git
synced 2026-06-03 10:34:08 +02:00
nix based ci
This commit is contained in:
parent
987ae2c474
commit
3b0e53f6b8
5 changed files with 1164 additions and 47 deletions
88
.github/workflows/rust.yml
vendored
88
.github/workflows/rust.yml
vendored
|
|
@ -1,64 +1,64 @@
|
||||||
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-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- uses: actions-rs/toolchain@v1
|
- uses: cachix/install-nix-action@v26
|
||||||
|
- 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
|
|
||||||
with:
|
|
||||||
command: check
|
|
||||||
|
|
||||||
check-no-default-features:
|
clippy:
|
||||||
name: Check --no-default-features
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: check
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- uses: actions-rs/toolchain@v1
|
- uses: cachix/install-nix-action@v26
|
||||||
|
- 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 .#clippy
|
||||||
- uses: actions-rs/cargo@v1
|
|
||||||
with:
|
|
||||||
command: check
|
|
||||||
args: --no-default-features
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Tests
|
needs: check
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- uses: actions-rs/toolchain@v1
|
- uses: cachix/install-nix-action@v26
|
||||||
|
- uses: icewind1991/attic-action@v1
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
name: ci
|
||||||
- uses: Swatinem/rust-cache@v1
|
instance: https://cache.icewind.me
|
||||||
- uses: actions-rs/cargo@v1
|
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
||||||
with:
|
- run: nix build .#test
|
||||||
command: test
|
|
||||||
|
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-latest
|
||||||
|
needs: check
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- uses: actions-rs/toolchain@v1
|
- uses: cachix/install-nix-action@v26
|
||||||
|
- uses: icewind1991/attic-action@v1
|
||||||
with:
|
with:
|
||||||
profile: minimal
|
name: ci
|
||||||
toolchain: 1.56
|
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
|
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,3 +1,3 @@
|
||||||
/target
|
/target
|
||||||
Cargo.lock
|
|
||||||
.direnv
|
.direnv
|
||||||
|
result
|
||||||
|
|
|
||||||
1021
Cargo.lock
generated
Normal file
1021
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
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": 1710162809,
|
"lastModified": 1710162809,
|
||||||
|
|
@ -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": 1710123130,
|
||||||
|
"narHash": "sha256-EoGL/WSM1M2L099Q91mPKO/FRV2iu2ZLOEp3y5sLfiE=",
|
||||||
|
"owner": "oxalica",
|
||||||
|
"repo": "rust-overlay",
|
||||||
|
"rev": "73aca260afe5d41d3ebce932c8d896399c9d5174",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "oxalica",
|
||||||
|
"repo": "rust-overlay",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"systems": {
|
"systems": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1681028828,
|
"lastModified": 1681028828,
|
||||||
|
|
|
||||||
55
flake.nix
55
flake.nix
|
|
@ -2,21 +2,72 @@
|
||||||
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|benches|tests|examples)(/.*)?"];
|
||||||
|
nearskOpt = {
|
||||||
|
pname = "php-literal-parser";
|
||||||
|
root = src;
|
||||||
};
|
};
|
||||||
in rec {
|
in rec {
|
||||||
|
packages = {
|
||||||
|
check = naersk'.buildPackage (nearskOpt
|
||||||
|
// {
|
||||||
|
mode = "check";
|
||||||
|
});
|
||||||
|
clippy = naersk'.buildPackage (nearskOpt
|
||||||
|
// {
|
||||||
|
mode = "clippy";
|
||||||
|
});
|
||||||
|
test = naersk'.buildPackage (nearskOpt
|
||||||
|
// {
|
||||||
|
release = false;
|
||||||
|
mode = "test";
|
||||||
|
});
|
||||||
|
msrv = msrvNaersk.buildPackage (nearskOpt
|
||||||
|
// {
|
||||||
|
mode = "check";
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
# `nix develop`
|
# `nix develop`
|
||||||
devShell = pkgs.mkShell {
|
devShell = pkgs.mkShell {
|
||||||
nativeBuildInputs = with pkgs; [rustc cargo bacon cargo-edit cargo-outdated clippy cargo-audit];
|
nativeBuildInputs = with pkgs; [toolchain bacon cargo-edit cargo-outdated clippy cargo-audit cargo-msrv];
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue