From 4bcebbedb5868f63ce37c231d0f616261fa10e06 Mon Sep 17 00:00:00 2001 From: marc0246 <40955683+marc0246@users.noreply.github.com> Date: Mon, 1 Dec 2025 10:08:25 +0100 Subject: [PATCH] Add a test --- .github/workflows/nix.yml | 33 +++++++++++++++++++++++++++++++++ tests/flake.nix | 23 +++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 .github/workflows/nix.yml create mode 100644 tests/flake.nix diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml new file mode 100644 index 0000000..2db980d --- /dev/null +++ b/.github/workflows/nix.yml @@ -0,0 +1,33 @@ +name: nix + +on: [push, pull_request] + +permissions: {} + +jobs: + nix: + if: github.repository == 'Swatinem/rust-cache' + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest] + + name: Test Nix on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 + with: + persist-credentials: false + + - uses: cachix/install-nix-action@7e5978947b7efba56e96c43fd785691980aca924 # v31.8.4 + + - uses: ./ + with: + workspaces: tests + cmd-format: nix develop tests -c {0} + + - run: | + nix develop -c cargo check --color always + nix develop -c cargo test --color always + working-directory: tests diff --git a/tests/flake.nix b/tests/flake.nix new file mode 100644 index 0000000..270ddcc --- /dev/null +++ b/tests/flake.nix @@ -0,0 +1,23 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = inputs @ { self, nixpkgs, flake-utils, rust-overlay, ... }: + flake-utils.lib.eachDefaultSystem ( + system: let + overlays = [ (import rust-overlay) ]; + pkgs = import nixpkgs { inherit system overlays; }; + in { + devShells.default = with pkgs; mkShell { + buildInputs = [ rust-bin.stable.latest.minimal ]; + }; + } + ); +} +