diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e084c4f..73d1216 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -43,6 +43,7 @@ jobs: TMP_GITHUB_COMMITS_COUNT=$(git rev-list --count HEAD) TMP_GITHUB_COUNT_NUMBER=$(echo ${GITHUB_RUN_NUMBER}) TMP_RELEASE_VERSION=$(./semver-gen generate -l -c config-release.yaml | sed -e 's|SEMVER ||g') + TMP_RELEASE_VERSION=1.4.3 echo "::set-output name=SANITISED_REPOSITORY_NAME::$TMP_SANITISED_REPOSITORY_NAME" echo "::set-output name=DOCKER_IMAGE::ghcr.io/${{ github.repository_owner }}/$TMP_SANITISED_REPOSITORY_NAME" echo "::set-output name=GITHUB_COMMIT_NUMBER::$TMP_GITHUB_COMMITS_COUNT" @@ -126,7 +127,11 @@ jobs: - name: Prepare for push id: prep run: | - TAGS="${{ needs.prepare.outputs.DOCKER_IMAGE }}:${{ needs.prepare.outputs.GITHUB_SHA }},${{ needs.prepare.outputs.DOCKER_IMAGE }}:${{ needs.prepare.outputs.RELEASE_VERSION }},${{ needs.prepare.outputs.DOCKER_IMAGE }}:latest" + if [ -z "${{ needs.prepare.outputs.RELEASE_VERSION }}" ]; then + TAGS="${{ needs.prepare.outputs.DOCKER_IMAGE }}:${{ needs.prepare.outputs.GITHUB_SHA }},${{ needs.prepare.outputs.DOCKER_IMAGE }}:latest" + else + TAGS="${{ needs.prepare.outputs.DOCKER_IMAGE }}:${{ needs.prepare.outputs.GITHUB_SHA }},${{ needs.prepare.outputs.DOCKER_IMAGE }}:${{ needs.prepare.outputs.RELEASE_VERSION }},${{ needs.prepare.outputs.DOCKER_IMAGE }}:latest" + fi echo ::set-output name=tags::${TAGS} BRANCH=$(echo ${GITHUB_REF##*/} | tr '[A-Z]' '[a-z]') LABELS="org.opencontainers.image.revision=${{ needs.prepare.outputs.GITHUB_SHA }}" diff --git a/Makefile b/Makefile index 5a50069..287a59e 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,10 @@ LOCAL_VERSION?=$(shell semver-gen generate -l -c config-release.yaml | sed -e 's|SEMVER ||g') +CI_RUN?=false +ADDITIONAL_BUILD_FLAGS="" + +ifeq ($(CI_RUN), true) + ADDITIONAL_BUILD_FLAGS="-test.short" +endif all: build @@ -9,7 +15,7 @@ run: build @./semver-gen test: - @go test ./... -v -race -cover -coverprofile=coverage.out + @go test ./... $(ADDITIONAL_BUILD_FLAGS) -v -race -cover -coverprofile=coverage.out update: - @go get -u ./... \ No newline at end of file + @go get -u ./... diff --git a/cmd/github_test.go b/cmd/github_test.go index 21babbd..823e1e6 100644 --- a/cmd/github_test.go +++ b/cmd/github_test.go @@ -26,6 +26,9 @@ func Test_checkLatestRelease(t *testing.T) { } func Test_updatePackage(t *testing.T) { + if testing.Short() { + t.Skip("Skipping test in short / CI mode") + } tests := []struct { name string want bool