diff --git a/.envrc.example b/.envrc.example deleted file mode 100644 index ba40eccc..00000000 --- a/.envrc.example +++ /dev/null @@ -1,7 +0,0 @@ -if [[ $(type -t use_flake) != function ]]; then - echo "ERROR: use_flake function missing." - echo "Please update direnv to v2.30.0 or later." - exit 1 -fi -use flake -watch_file flake.nix flake.lock diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cf4d4fc0..dd0a4eb1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,21 +1,22 @@ -name: Nix +name: "Test Suite" on: push: branches: - master - - gh-readonly-queue/master/** pull_request: branches: - master - jobs: - tests: + test: + name: cargo test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v20 - with: - github_access_token: ${{ secrets.GITHUB_TOKEN }} - extra_nix_config: experimental-features = nix-command flakes - - run: nix flake check + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@nightly + with: + components: rust-src, rustfmt, clippy + - run: cargo test --all-features + - run: cargo fmt --check --all --verbose + - run: cargo clippy --all-targets --all-features -- -D warnings + - run: cargo build --release --all --all-targets \ No newline at end of file diff --git a/flake.lock b/flake.lock deleted file mode 100644 index 41fd857f..00000000 --- a/flake.lock +++ /dev/null @@ -1,120 +0,0 @@ -{ - "nodes": { - "advisory-db": { - "flake": false, - "locked": { - "lastModified": 1719490091, - "narHash": "sha256-FIDzlKCLL8D02bSWgNUw0ydc+ctyV34ELirYuENvjlE=", - "owner": "rustsec", - "repo": "advisory-db", - "rev": "f5b488da7f6994a1fef6c4c78250cb25275c6c99", - "type": "github" - }, - "original": { - "owner": "rustsec", - "repo": "advisory-db", - "type": "github" - } - }, - "crane": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1719249093, - "narHash": "sha256-0q1haa3sw6GbmJ+WhogMnducZGjEaCa/iR6hF2vq80I=", - "owner": "ipetkov", - "repo": "crane", - "rev": "9791c77eb7e98b8d8ac5b0305d47282f994411ca", - "type": "github" - }, - "original": { - "owner": "ipetkov", - "repo": "crane", - "type": "github" - } - }, - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1719468428, - "narHash": "sha256-vN5xJAZ4UGREEglh3lfbbkIj+MPEYMuqewMn4atZFaQ=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "1e3deb3d8a86a870d925760db1a5adecc64d329d", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "advisory-db": "advisory-db", - "crane": "crane", - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs", - "rust-overlay": "rust-overlay" - } - }, - "rust-overlay": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1719541143, - "narHash": "sha256-YdHqW6EM5pXMwXHhC+KniBv3aquXuJrFar2XXaV7x+c=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "ed12832f267ab223cd085b0bd6ee3432caa69067", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/flake.nix b/flake.nix deleted file mode 100644 index 4a8b5483..00000000 --- a/flake.nix +++ /dev/null @@ -1,165 +0,0 @@ -{ - description = "Build a cargo project"; - - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - flake-utils.url = "github:numtide/flake-utils"; - - crane = { - url = "github:ipetkov/crane"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - rust-overlay = { - url = "github:oxalica/rust-overlay"; - inputs = { - nixpkgs.follows = "nixpkgs"; - }; - }; - - advisory-db = { - url = "github:rustsec/advisory-db"; - flake = false; - }; - }; - - outputs = - { - self, - nixpkgs, - crane, - rust-overlay, - flake-utils, - advisory-db, - ... - }: - flake-utils.lib.eachDefaultSystem ( - system: - let - pkgs = import nixpkgs { - inherit system; - config = { - allowBroken = true; - }; - overlays = [ (import rust-overlay) ]; - }; - - inherit (pkgs) lib; - - rust-toolchain = pkgs.rust-bin.selectLatestNightlyWith ( - toolchain: - toolchain.default.override { - extensions = [ "rust-src" ]; - targets = [ - "aarch64-apple-darwin" - "x86_64-apple-darwin" - "aarch64-unknown-linux-gnu" - "x86_64-unknown-linux-gnu" - ]; - } - ); - - craneLib = (crane.mkLib pkgs).overrideToolchain rust-toolchain; - src = craneLib.cleanCargoSource (craneLib.path ./.); - - commonArgs = { - inherit src; - - buildInputs = - [ ] - ++ lib.optionals pkgs.stdenv.isDarwin [ - # Additional darwin specific inputs can be set here - pkgs.libiconv - ]; - }; - - # Build *just* the cargo dependencies, so we can reuse - # all of that work (e.g. via cachix) when running in CI - cargoArtifacts = craneLib.buildDepsOnly commonArgs; - - rs-poker = craneLib.buildPackage ( - commonArgs - // { - inherit cargoArtifacts; - doCheck = false; - } - ); - in - { - checks = - { - # Build the crate as part of `nix flake check` for convenience - inherit rs-poker; - - # Run clippy (and deny all warnings) on the crate source, - # again, resuing the dependency artifacts from above. - rs-poker-clippy = craneLib.cargoClippy ( - commonArgs - // { - inherit cargoArtifacts; - cargoClippyExtraArgs = "--all-targets -- --deny warnings"; - } - ); - - rs-poker-doc = craneLib.cargoDoc (commonArgs // { inherit cargoArtifacts; }); - - # Check formatting - rs-poker-fmt = craneLib.cargoFmt { - inherit src; - cargoClippyExtraArgs = "--all --check"; - }; - - # Audit dependencies - rs-poker-audit = craneLib.cargoAudit { inherit src advisory-db; }; - - # Run tests since rs-poker has doCheck = false; - rs-poker-nextest = craneLib.cargoNextest ( - commonArgs - // { - inherit cargoArtifacts; - partitions = 1; - partitionType = "count"; - cargoNextestExtraArgs = "--all-targets"; - } - ); - } - // lib.optionalAttrs (system == "x86_64-linux") { - rs-poker-coverage = craneLib.cargoTarpaulin (commonArgs // { inherit cargoArtifacts; }); - }; - - packages = { - inherit rs-poker; - default = rs-poker; - }; - - apps.default = flake-utils.lib.mkApp { drv = rs-poker; }; - - devShells.default = pkgs.mkShell { - inputsFrom = builtins.attrValues self.checks.${system}; - - nativeBuildInputs = with pkgs; [ - rust-toolchain - rust-analyzer - pkg-config - git - cmake - openssl - - cargo-audit - cargo-release - cargo-fuzz - cargo-nextest - ]; - - shellHook = '' - BASE=$(git rev-parse --show-toplevel || echo ".") - - # This keeps cargo self contained in this dir - export CARGO_HOME=$BASE/.nix-cargo - mkdir -p $CARGO_HOME - export PATH=$CARGO_HOME/bin:$PATH - ''; - }; - } - ); -}