From 38f2f8501bac2e2defcf6c38df93a1af7062d1ee Mon Sep 17 00:00:00 2001 From: cosimomeli Date: Wed, 29 Nov 2023 11:38:07 +0100 Subject: [PATCH] golang: add docker login on test and benchmark workflows (#64) ## Description Add docker login on test and benchmark golang workflows ## Changes Made - Add docker login on golang test workflow - Add docker login on golang benchmark workflow ## Related Issues N/A ## Checklist - [x] I have used a PR title that is descriptive enough for a release note. - [x] I have tested these changes locally. - [ ] I have added appropriate tests or updated existing tests. - [ ] I have tested these changes on a dedicated VM or a customer VM [name of the VM] - [x] I have added appropriate documentation or updated existing documentation. --------- Co-authored-by: Federico M. Facca Co-authored-by: Federico M. Facca Co-authored-by: Bot --- .github/workflows/golang.yaml | 18 ++++++++++++++++++ README.MD | 6 +++++- RELEASE_NOTES.md | 6 ++++-- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/.github/workflows/golang.yaml b/.github/workflows/golang.yaml index 0e67b778..f4a58fb7 100644 --- a/.github/workflows/golang.yaml +++ b/.github/workflows/golang.yaml @@ -81,6 +81,15 @@ jobs: - name: Install gcov2lcov run: | go install github.com/jandelgado/gcov2lcov@latest + # We Login in GHCR to retrieve owned private images used in docker-compose + # This requires to set in the package settings read permission for the + # repository where the golang ci is running + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Test run: | make ci-test @@ -121,6 +130,15 @@ jobs: - uses: actions/setup-go@v4 with: go-version-file: go.mod + # We Login in GHCR to retrieve owned private images used in docker-compose + # This requires to set in the package settings read permission for the + # repository where the golang ci is running + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Run benchmark shell: bash run: make ci-bench | tee output.txt diff --git a/README.MD b/README.MD index f1c0108f..d6b84048 100644 --- a/README.MD +++ b/README.MD @@ -22,7 +22,11 @@ The repository includes: - [release-notes](.github/workflows/release-notes.yaml) workflow: automatically updates release notes using PR titles and labels. - [golang](.github/workflows/golang.yaml) workflow: lint, test and benchmark Go - Applications + Applications. The workflow includes authentication to Github Container + Registry in case tests rely on private images. To retrieve the images, you + need also to set + [read permission](https://docs.github.com/en/packages/learn-github-packages/configuring-a-packages-access-control-and-visibility#ensuring-workflow-access-to-your-package) + for the repository on the package. - [docker](.github/workflows/docker.yaml) workflow: build and push Docker images - [clean-up-docker](.github/workflows/clean-up-docker.yaml) workflow: when a PR is closed, related docker images and untagged ones are deleted diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index c0cdeb66..54684db3 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,9 +1,11 @@ # github-workflows Release Notes -## 0.0.2-dev - 2023-11-27 +## 0.0.2-dev - 2023-11-29 ### Features +- golang: add docker login on test and benchmark workflows (PR #64 by + @cosimomeli) - docker workflow: add git and build information as build arguments (PR #63 by @cosimomeli) - add workflow to support license management (PR #58 by @chicco785) @@ -30,8 +32,8 @@ ### Bug Fixes -- pr-check workflow: pass correctly `input.labels` (PR #67 by @chicco785) - markdown workflow: support correctly `.prettierignore` (PR #65 by @chicco785) +- pr-check workflow: pass correctly `input.labels` (PR #67 by @chicco785) - markdown workflow: fix check to enable/disable spellchecker (PR #55 by @chicco785) - golang workflow: add shell configuration to enable `pipefail` for benchmark