From 307de72af77fb57b2040924360ccaa0030287766 Mon Sep 17 00:00:00 2001 From: Jacob Weinstock Date: Tue, 9 May 2023 18:35:44 -0600 Subject: [PATCH 1/2] Move ci-checks.sh to a make target: This allows us to check for nix-shell and use docker if nix-shell is not installed. Update CI to use the make target. Signed-off-by: Jacob Weinstock --- .github/workflows/ci.yaml | 4 ++-- Makefile | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d0dfa387f..938cbbe1c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -45,8 +45,8 @@ jobs: uses: cachix/install-nix-action@v20 with: nix_path: nixpkgs=channel:nixos-unstable - - run: nix-shell --run 'true' - - run: PATH=$PWD/bin/:$PATH ./ci-checks.sh + - name: Run ci-checks.sh + run: nix-shell --run 'make ci-checks' # We preemptively build the binaries for efficiency instead of waiting on unit tests to pass # hence this doesn't depend on anything. build: diff --git a/Makefile b/Makefile index bf2b0a9f9..47bc267fe 100644 --- a/Makefile +++ b/Makefile @@ -177,6 +177,14 @@ check-proto: generate-proto verify: lint check-generated ## Verify code style, is lint free, freshness ... $(GOFUMPT) -s -d . +.PHONY: ci-checks +ci-checks: ## Run ci-checks.sh script + @if type nix-shell 2>&1 > /dev/null; then \ + ./ci-checks.sh; \ + else \ + docker run -it --rm -v $${PWD}:/code -w /code nixos/nix nix-shell --run 'make ci-checks'; \ + fi + .PHONY: lint lint: shellcheck hadolint golangci-lint yamllint ## Lint code From 0e32177bbfcf410ed9c2657ee9df23a6784b1472 Mon Sep 17 00:00:00 2001 From: Jacob Weinstock Date: Tue, 9 May 2023 17:52:06 -0600 Subject: [PATCH 2/2] Clean up shell.nix Signed-off-by: Jacob Weinstock --- shell.nix | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/shell.nix b/shell.nix index ae2757b96..31c02667a 100644 --- a/shell.nix +++ b/shell.nix @@ -9,29 +9,11 @@ in { pkgs ? import (_pkgs.fetchFromGitHub { with pkgs; -let - pkgs = import (_pkgs.fetchFromGitHub { - # go 1.18.5 - owner = "NixOS"; - repo = "nixpkgs"; - # branch@date: nixpkgs-unstable@2023-03-30 - rev = "8b3bc690e201c8d3cbd14633dbf3462a820e73f2"; - sha256 = "sha256-+ckiCxbGFSs1/wHKCXAZnvb37Htf6k5nmQE3T0Y7hK8="; - }) { }; - - go_1_20_3 = pkgs.go; - -in mkShell { +mkShell { buildInputs = [ - docker-compose - git - gnumake - gnused - go_1_20_3 jq nixfmt nodePackages.prettier - protobuf python3Packages.codespell python3Packages.pip python3Packages.setuptools