From 80f96e867de8fa34a455b785a5887f9cfb616813 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vlado=20Paji=C4=87?= Date: Tue, 19 Nov 2024 14:29:43 +0100 Subject: [PATCH 1/4] delete untagged packages --- .github/workflows/action-test.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/action-test.yml b/.github/workflows/action-test.yml index 320f5021..ff01ca84 100644 --- a/.github/workflows/action-test.yml +++ b/.github/workflows/action-test.yml @@ -16,6 +16,13 @@ jobs: with: go-version-file: go.mod + - uses: actions/delete-package-versions@v5 + with: + owner: vladopajic + package-name: go-test-coverage + package-type: container + delete-only-untagged-versions: true + - name: set action image version to dev run: | yq e -i '.runs.image = "docker://ghcr.io/vladopajic/go-test-coverage:dev"' action.yml From 694d64b742d60a71d57a8f43c1074f0b85c541c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vlado=20Paji=C4=87?= Date: Tue, 19 Nov 2024 14:39:31 +0100 Subject: [PATCH 2/4] action test update --- .github/workflows/action-test.yml | 71 +++++++++++++++++-------------- 1 file changed, 39 insertions(+), 32 deletions(-) diff --git a/.github/workflows/action-test.yml b/.github/workflows/action-test.yml index ff01ca84..4f51f5fe 100644 --- a/.github/workflows/action-test.yml +++ b/.github/workflows/action-test.yml @@ -1,50 +1,57 @@ name: action-test on: [push] jobs: - test: - name: test + build-dev-image: + name: build dev image permissions: contents: write packages: write + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: set action image version to dev + run: | + yq e -i '.runs.image = "docker://ghcr.io/vladopajic/go-test-coverage:dev"' action.yml + image=$(yq '.runs.image' action.yml) + echo "Image: $image" + + - name: login to GitHub container registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: build and push + uses: docker/build-push-action@v6 + with: + push: true + build-args: | + VERSION=dev + tags: | + ghcr.io/vladopajic/go-test-coverage:dev + + - uses: actions/delete-package-versions@v5 + with: + owner: vladopajic + package-name: go-test-coverage + package-type: container + min-versions-to-keep: 5 + delete-only-untagged-versions: true + test: + name: test runs-on: ubuntu-latest steps: - name: checkout uses: actions/checkout@v4 - + - name: setup go uses: actions/setup-go@v5 with: go-version-file: go.mod - - uses: actions/delete-package-versions@v5 - with: - owner: vladopajic - package-name: go-test-coverage - package-type: container - delete-only-untagged-versions: true - - - name: set action image version to dev - run: | - yq e -i '.runs.image = "docker://ghcr.io/vladopajic/go-test-coverage:dev"' action.yml - image=$(yq '.runs.image' action.yml) - echo "Image: $image" - - - name: login to GitHub container registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: build and push - uses: docker/build-push-action@v6 - with: - push: true - build-args: | - VERSION=dev - tags: | - ghcr.io/vladopajic/go-test-coverage:dev - - name: generate test coverage run: go test ./... -coverprofile=./cover.out -covermode=atomic From fb02d87044f9c06b169334553f315586792eec07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vlado=20Paji=C4=87?= Date: Tue, 19 Nov 2024 14:43:50 +0100 Subject: [PATCH 3/4] update --- .github/workflows/action-test.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/action-test.yml b/.github/workflows/action-test.yml index 4f51f5fe..dd7282ab 100644 --- a/.github/workflows/action-test.yml +++ b/.github/workflows/action-test.yml @@ -4,19 +4,12 @@ jobs: build-dev-image: name: build dev image permissions: - contents: write packages: write runs-on: ubuntu-latest steps: - name: checkout uses: actions/checkout@v4 - - name: set action image version to dev - run: | - yq e -i '.runs.image = "docker://ghcr.io/vladopajic/go-test-coverage:dev"' action.yml - image=$(yq '.runs.image' action.yml) - echo "Image: $image" - - name: login to GitHub container registry uses: docker/login-action@v3 with: @@ -55,6 +48,12 @@ jobs: - name: generate test coverage run: go test ./... -coverprofile=./cover.out -covermode=atomic + - name: set action image version to dev + run: | + yq e -i '.runs.image = "docker://ghcr.io/vladopajic/go-test-coverage:dev"' action.yml + image=$(yq '.runs.image' action.yml) + echo "Image: $image" + ## Test 1 - name: "test: total coverage 0% (config)" From 6bc1423f0bba78a450139fe28d2b91b6cdb2d8ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vlado=20Paji=C4=87?= Date: Tue, 19 Nov 2024 14:46:27 +0100 Subject: [PATCH 4/4] update --- .github/workflows/action-test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/action-test.yml b/.github/workflows/action-test.yml index dd7282ab..d97358f9 100644 --- a/.github/workflows/action-test.yml +++ b/.github/workflows/action-test.yml @@ -36,6 +36,8 @@ jobs: test: name: test runs-on: ubuntu-latest + needs: build-dev-image + steps: - name: checkout uses: actions/checkout@v4