From e883f215dd221ce9e9df9ea42a66b1632c9666b9 Mon Sep 17 00:00:00 2001 From: Manuel Mendez Date: Thu, 10 Feb 2022 16:05:05 -0500 Subject: [PATCH 1/2] make: Better test target Why do we clean the test cache? It should not be necessary (I haven't found it be necessary). Also get rid of -v as its just noisy and never useful. When there is not test failure I don't really care to see *all* the tests being run. Yet when there *is* a test failure we potentially have to scroll over all the passing tests just to get to the output of the failed one. Why fight go here? Go will expand the test output for the failed tests anyway so its just doesn't make any sense to run with -v. Signed-off-by: Manuel Mendez --- .github/workflows/ci.yaml | 4 +--- Makefile | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index de7afeeca..40cae9b25 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -34,10 +34,8 @@ jobs: run: nix-shell --run 'true' - name: Generate run: nix-shell --run 'make generate' - - name: go clean -testcache - run: go clean -testcache - name: go test - run: go test -coverprofile=coverage.txt ./... -v + run: make test - name: upload codecov run: bash <(curl -s https://codecov.io/bash) ci-checks: diff --git a/Makefile b/Makefile index 35d46368b..fe553edbf 100644 --- a/Makefile +++ b/Makefile @@ -12,8 +12,7 @@ images: tink-cli-image tink-server-image tink-worker-image ## Build all docker i run: crosscompile run-stack ## Builds and runs the Tink stack (tink, db, cli) via docker-compose test: ## Run tests - go clean -testcache - go test -coverprofile=coverage.txt ./... -v + go test -coverprofile=coverage.txt ./... verify: lint check-generated # Verify code style, is lint free, freshness ... gofumpt -s -d . From 8c6f92d9dfbf84dfb4d3d67ff0d6ceaf165e23d8 Mon Sep 17 00:00:00 2001 From: Manuel Mendez Date: Fri, 11 Feb 2022 09:59:32 -0500 Subject: [PATCH 2/2] ci: Break up the long block of text with empty lines For easier parsing/reading/scanning. Signed-off-by: Manuel Mendez --- .github/workflows/ci.yaml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 40cae9b25..2003cf351 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,10 +11,12 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v2 + - name: Install Go uses: actions/setup-go@v2 with: go-version: "1.17" + - name: make verify run: make verify test: @@ -22,20 +24,26 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v2 + - name: Install Go uses: actions/setup-go@v2 with: go-version: "1.17" + - name: Install nix uses: cachix/install-nix-action@v16 with: nix_path: nixpkgs=channel:nixos-unstable + - name: Fetch Nix Packages run: nix-shell --run 'true' + - name: Generate run: nix-shell --run 'make generate' + - name: go test run: make test + - name: upload codecov run: bash <(curl -s https://codecov.io/bash) ci-checks: @@ -43,19 +51,25 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v2 + - name: Install nix uses: cachix/install-nix-action@v16 with: nix_path: nixpkgs=channel:nixos-unstable + - name: Fetch Nix Packages run: nix-shell --run 'true' + - run: make bin/gofumpt + - run: PATH=$PWD/bin/:$PATH ./ci-checks.sh validation: runs-on: ubuntu-latest needs: - ci-checks + - test + - verify steps: - name: fake @@ -67,26 +81,32 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v2 + - name: Install Go uses: actions/setup-go@v2 with: go-version: "1.17" + - run: make crosscompile -j$(nproc) + - name: Upload tink-cli binaries uses: actions/upload-artifact@v2 with: name: tink-cli path: cmd/tink-cli/tink-cli-* + - name: Upload tink-server binaries uses: actions/upload-artifact@v2 with: name: tink-server path: cmd/tink-server/tink-server-* + - name: Upload tink-worker binaries uses: actions/upload-artifact@v2 with: name: tink-worker path: cmd/tink-worker/tink-worker-* + - name: Upload tink-controller binaries uses: actions/upload-artifact@v2 with: @@ -101,10 +121,13 @@ jobs: include: - repository: quay.io/tinkerbell/tink-cli binary: tink-cli + - repository: quay.io/tinkerbell/tink binary: tink-server + - repository: quay.io/tinkerbell/tink-worker binary: tink-worker + - repository: quay.io/tinkerbell/tink-controller binary: tink-controller steps: @@ -112,8 +135,10 @@ jobs: id: docker-image-tag run: | echo ::set-output name=tags::${{ matrix.repository }}:latest,${{ matrix.repository }}:sha-${GITHUB_SHA::8} + - name: Checkout code uses: actions/checkout@v2 + - name: Login to quay.io uses: docker/login-action@v1 if: ${{ startsWith(github.ref, 'refs/heads/main') }} @@ -121,17 +146,22 @@ jobs: registry: quay.io username: ${{ secrets.QUAY_USERNAME }} password: ${{ secrets.QUAY_PASSWORD }} + - name: Set up QEMU uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 + - name: Download ${{ matrix.binary }} artifacts uses: actions/download-artifact@v2 with: name: ${{ matrix.binary}} path: cmd/${{ matrix.binary }} + - name: Fix Permissions run: chmod +x cmd/${{ matrix.binary }}/${{ matrix.binary }}* + - name: ${{ matrix.repository }} uses: docker/build-push-action@v2 with: