Bump codecov/codecov-action from 4 to 5 (#241) #544
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Go | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
go: ["1.20", "1.21", "1.22"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Check format | |
run: gofmt -l | |
- name: Setup dependencies | |
run: go get | |
- name: Build | |
run: go build | |
- name: Test | |
run: go test ./... -coverpkg=./... -race -coverprofile=coverage.out -covermode=atomic | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v5 | |
docker-build: | |
needs: build | |
runs-on: ubuntu-22.04 | |
if: github.event_name == 'push' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
berviantoleo/${{ env.IMAGE_NAME }} | |
ghcr.io/${{ github.repository }} | |
env: | |
IMAGE_NAME: go-microservices | |
- name: Build and push Docker images | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |