diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..0a89bbe7 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,22 @@ +name: Run Tests + +on: + workflow_dispatch: + push: + branches: + - main + tags: + - '*' + pull_request: + +jobs: + test: + name: Run Tests + steps: + - name: git checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Install Nix + uses: cachix/install-nix-action@08dcb3a5e62fa31e2da3d490afc4176ef55ecd72 # v30 + - name: Test + run: | + nix develop --command run-tests diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..8fcd25fe --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1733759999, + "narHash": "sha256-463SNPWmz46iLzJKRzO3Q2b0Aurff3U1n0nYItxq7jU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a73246e2eef4c6ed172979932bc80e1404ba2d56", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..55d37016 --- /dev/null +++ b/flake.nix @@ -0,0 +1,48 @@ + +{ + description = "sdk-internal"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + }; + outputs = { + self, + nixpkgs, + ... + }: let + supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; + forAllSystemTypes = fn: nixpkgs.lib.genAttrs supportedSystems fn; + in { + devShells = forAllSystemTypes (system: let + pkgs = import nixpkgs {inherit system;}; + in { + default = pkgs.mkShell { + inputsFrom = with self.devShells.${system}; [ + building + ]; + }; + building = let + runBuild = (pkgs.writeScriptBin "run-build" '' + cargo build + ''); + runTests = (pkgs.writeScriptBin "run-tests" '' + cargo test + ''); + in + pkgs.mkShell { + buildInputs = [ + pkgs.rustup + pkgs.cargo + ]; + packages = [ + runBuild + runTests + ]; + shellHook = '' + rustup default nightly + ''; + }; + }); + }; +} + +