workflows: bump codecov/codecov-action from 4 to 5 (#92) #288
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: CI | |
on: | |
push: | |
branches: [main] | |
tags: | |
- "v*" | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build and test | |
permissions: | |
contents: read | |
packages: read | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- run: | | |
CMETRICS_VERSION=$(sed -n 's/^ARG CMETRICS_VERSION=\(.*\)/\1/p' testdata/Dockerfile) | |
CMETRICS_RELEASE=$(sed -n 's/^ARG CMETRICS_RELEASE=\(.*\)/\1/p' testdata/Dockerfile) | |
echo "Using release: CMETRICS_RELEASE" | |
echo "Using version: CMETRICS_VERSION" | |
wget https://github.com/calyptia/cmetrics/releases/download/${CMETRICS_RELEASE}/cmetrics_${CMETRICS_VERSION}_${TARGETARCH}-headers.deb | |
wget https://github.com/calyptia/cmetrics/releases/download/${CMETRICS_RELEASE}/cmetrics_${CMETRICS_VERSION}_${TARGETARCH}.deb | |
sudo dpkg -i *.deb | |
rm *.deb | |
shell: bash | |
env: | |
TARGETARCH: amd64 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22" | |
- name: Go mod download | |
run: go mod download | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.CI_USERNAME }} | |
password: ${{ secrets.CI_PAT }} | |
- name: Cache Golang Docker Image | |
run: docker pull golang:latest | |
- name: Cache ghcr.io/calyptia/internal/core-fluent-bit Docker Image | |
run: docker pull ghcr.io/calyptia/internal/core-fluent-bit:main | |
- name: Unit tests | |
run: | | |
# go test -v -covermode=atomic -coverprofile=coverage.out ./... | |
go test -v -covermode=atomic -coverprofile=coverage.out \ | |
-run \^TestInputCallbackCtrlC\$ ./ | |
go test -v -covermode=atomic -coverprofile=coverage.out \ | |
-run \^TestInputCallbackDangle\$ ./ | |
go test -v -covermode=atomic -coverprofile=coverage.out \ | |
-run \^TestInputCallbackInfinite\$ ./ | |
go test -v -covermode=atomic -coverprofile=coverage.out \ | |
-run \^TestInputCallbackInfiniteLatency\$ ./ | |
go test -v -covermode=atomic -coverprofile=coverage.out \ | |
-run \^TestInputCallbackInfiniteConcurrent\$ ./ | |
go test -v -covermode=atomic -coverprofile=coverage.out \ | |
-run \^TestPlugin\$ ./ | |
go test -v -covermode=atomic -coverprofile=coverage.out \ | |
-run \^TestInputCallbackInfiniteConcurrent\$ ./ | |
go test -v -covermode=atomic -coverprofile=coverage.out \ | |
./configloader/ | |
go test -v -covermode=atomic -coverprofile=coverage.out \ | |
./output/ | |
- name: Upload coverage to Codecov | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: codecov/codecov-action@v5 | |
with: | |
file: ./coverage.out | |
flags: ${{ runner.os }} | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Install Syft for sboms | |
if: startsWith(github.ref, 'refs/tags/') | |
run: curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin | |
shell: bash | |
- name: Import GPG key | |
if: startsWith(github.ref, 'refs/tags/') | |
id: import_gpg | |
uses: crazy-max/ghaction-import-gpg@v6 | |
with: | |
gpg_private_key: ${{ secrets.CALYPTIA_GPG_KEY }} | |
passphrase: ${{ secrets.CALYPTIA_GPG_KEY_PASSPHRASE }} | |
- name: Run GoReleaser | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
version: latest | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.CI_PAT }} | |
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} |