From 8abaa2c3732e499df67c7cc6343d0b7ae3f3134e Mon Sep 17 00:00:00 2001 From: Ralf Grubenmann Date: Wed, 3 Jan 2024 12:04:16 +0100 Subject: [PATCH] add test action --- .github/workflows/test.yaml | 44 +++++++++++++++++++++++++++++++++++++ devenv/nix/shell.nix | 4 +++- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..4a0fa04 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,44 @@ +name: Run Tests +on: + pull_request: + types: [ opened, reopened, synchronize ] + branches: + - "**" + - "!master" + push: + branches: + - master + tags: + - "v*.*.*" +jobs: + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Install fuse + run: | + sudo apt-get update + sudo apt-get install -y fuse3 + sudo bash -c 'echo "user_allow_other" >> /etc/fuse.conf' + - uses: actions/setup-go@v4 + with: + go-version: '1.20' + - uses: cachix/install-nix-action@v22 + with: + nix_path: nixpkgs=channel:nixos-unstable + - name: Flake check + run: nix flake check + - name: Run tests + uses: workflow/nix-shell-action@v3.3.0 + with: + flakes-from-devshell: true + script: | + init-kind-cluster + local-deploy + get-kind-kubeconfig + go test -v ./... + - name: Print rclone log + if: ${{ failure() }} + run: cat /tmp/rclone.log + + diff --git a/devenv/nix/shell.nix b/devenv/nix/shell.nix index e143c55..3c3821d 100644 --- a/devenv/nix/shell.nix +++ b/devenv/nix/shell.nix @@ -3,6 +3,8 @@ let optionalPkgs = with pkgs; if stdenv.isDarwin then [ macfuse-stubs ] else []; + scripts = import ./scripts.nix { inherit pkgs; }; + inherit (scripts) initKindCluster deleteKindCluster getKindKubeconfig localDeployScript reloadScript; in pkgs.mkShell { packages = with pkgs; [ @@ -38,7 +40,7 @@ pkgs.mkShell { # Nix nil # LSP nixfmt # Formatter - ] ++ optionalPkgs; + ] ++ optionalPkgs ++ [initKindCluster deleteKindCluster getKindKubeconfig localDeployScript reloadScript]; shellHook = '' export PROJECT_ROOT="$(pwd)"