From 3cd9b1cb3db149cb3f4640076f0549e1fc66813a Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 5 Mar 2020 14:09:05 +0100 Subject: [PATCH] Run unit tests within goreleaser Reduces CI jobs, simplifies local build too --- .github/workflows/{test.yml => build.yml} | 15 ++------------- .github/workflows/release.yml | 13 +------------ .goreleaser.yml | 4 ++++ README.md | 2 +- 4 files changed, 8 insertions(+), 26 deletions(-) rename .github/workflows/{test.yml => build.yml} (60%) diff --git a/.github/workflows/test.yml b/.github/workflows/build.yml similarity index 60% rename from .github/workflows/test.yml rename to .github/workflows/build.yml index b0b3801..b3c12c2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/build.yml @@ -1,5 +1,5 @@ --- -name: Test +name: Build on: push: @@ -11,18 +11,7 @@ on: types: [opened, reopened] jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - uses: actions/cache@v1 - with: - path: /home/runner/go/pkg/mod - key: go-mod - - name: Run unit tests - run: go test ./... - - build: + goreleaser: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1531a5e..54c1781 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,18 +9,7 @@ on: - "*" jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - uses: actions/cache@v1 - with: - path: /home/runner/go/pkg/mod - key: go-mod - - name: Run unit tests - run: go test ./... - - release: + goreleaser: runs-on: ubuntu-latest needs: - test diff --git a/.goreleaser.yml b/.goreleaser.yml index 6e09649..46ef12e 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,5 +1,9 @@ # Make sure to check the documentation at http://goreleaser.com +before: + hooks: + - go test ./... + builds: - env: - CGO_ENABLED=0 # this is needed otherwise the Docker image build is faulty diff --git a/README.md b/README.md index 5865c9d..e8719ce 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![dockeri.co](https://dockeri.co/image/appuio/image-cleanup)](https://hub.docker.com/r/appuio/image-cleanup) -![](https://img.shields.io/github/workflow/status/appuio/image-cleanup/Release) +![](https://img.shields.io/github/workflow/status/appuio/image-cleanup/Build) ![](https://img.shields.io/github/v/release/appuio/image-cleanup?include_prereleases) ![](https://img.shields.io/github/issues-raw/appuio/image-cleanup) ![](https://img.shields.io/github/issues-pr-raw/appuio/image-cleanup)