Skip to content

build(deps): bump codecov/codecov-action from 5.5.0 to 5.5.1 #350

build(deps): bump codecov/codecov-action from 5.5.0 to 5.5.1

build(deps): bump codecov/codecov-action from 5.5.0 to 5.5.1 #350

Workflow file for this run

name: CI
permissions:
contents: read
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
GO_VERSION: '^1.25'
jobs:
test:
name: Test
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
cache: true
- name: Get dependencies
run: |
go mod download
go mod verify
- name: Run tests with coverage (race)
run: |
export CGO_ENABLED=1
export GORACE=halt_on_error=1
go test -race ./... -v
go test -race -v -coverprofile=coverage.txt -covermode=atomic -json ./... >> report.json
- name: Upload coverage reports to Codecov (unit)
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.0 pinned
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: GoCodeAlone/modular
files: coverage.txt
flags: unit
- name: Upload unit coverage artifact
# Make the raw Go coverage profile available for the merge job
uses: actions/upload-artifact@v4
with:
name: unit-coverage
path: coverage.txt
if-no-files-found: error
retention-days: 1
- name: CTRF Test Output
run: |
go install github.com/ctrf-io/go-ctrf-json-reporter/cmd/go-ctrf-json-reporter@latest
cat report.json | go-ctrf-json-reporter -o report.ctrf.json
if: always()
# https://github.com/ctrf-io/github-test-reporter
- name: Publish CTRF Test Summary Results
run: npx github-actions-ctrf report.ctrf.json
if: always()
test-cli:
name: Test CLI
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
cache: true
- name: Get dependencies
run: |
cd cmd/modcli
go mod download
go mod verify
- name: Run CLI tests with coverage
run: |
cd cmd/modcli
go test ./... -v -coverprofile=cli-coverage.txt -covermode=atomic -json >> cli-report.json
- name: Upload CLI coverage reports to Codecov
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.0 pinned
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: GoCodeAlone/modular
directory: cmd/modcli/
files: cli-coverage.txt
flags: cli
- name: Upload CLI coverage artifact
uses: actions/upload-artifact@v4
with:
name: cli-coverage
path: cmd/modcli/cli-coverage.txt
if-no-files-found: error
retention-days: 1
- name: CTRF Test Output for CLI
run: |
go install github.com/ctrf-io/go-ctrf-json-reporter/cmd/go-ctrf-json-reporter@latest
cd cmd/modcli
cat cli-report.json | go-ctrf-json-reporter -o cli-report.ctrf.json
if: always()
- name: Publish CLI CTRF Test Summary Results
run: |
cd cmd/modcli
npx github-actions-ctrf cli-report.ctrf.json
if: always()
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: go.sum
- name: golangci-lint
uses: golangci/golangci-lint-action@v8
# See: https://github.com/marketplace/actions/golangci-lint for configuration options
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: latest
only-new-issues: true
args: -c .golangci.github.yml
merge-coverage:
name: Merge Unit/CLI/BDD Coverage
runs-on: ubuntu-latest
needs: [test, test-cli]
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Download unit coverage artifact
uses: actions/download-artifact@v5
with:
name: unit-coverage
path: cov-artifacts
continue-on-error: true
- name: Download cli coverage artifact
uses: actions/download-artifact@v5
with:
name: cli-coverage
path: cov-artifacts
continue-on-error: true
- name: Download merged BDD coverage artifact
uses: actions/download-artifact@v5
with:
name: merged-bdd-coverage
path: cov-artifacts
continue-on-error: true
- name: Merge coverage profiles
run: |
set -e
ls -R cov-artifacts || true
FILES=()
[ -f cov-artifacts/coverage.txt ] && FILES+=(cov-artifacts/coverage.txt) # unit
[ -f cov-artifacts/cli-coverage.txt ] && FILES+=(cov-artifacts/cli-coverage.txt) # cli
[ -f cov-artifacts/merged-bdd-coverage.txt ] && FILES+=(cov-artifacts/merged-bdd-coverage.txt)
if [ ${#FILES[@]} -eq 0 ]; then
echo "No coverage files found to merge"; exit 0; fi
chmod +x scripts/merge-coverprofiles.sh
./scripts/merge-coverprofiles.sh total-coverage.txt "${FILES[@]}"
echo "Merged: ${FILES[*]}"
- name: Upload merged total coverage artifact
if: success() && hashFiles('total-coverage.txt') != ''
uses: actions/upload-artifact@v4
with:
name: total-coverage
path: total-coverage.txt
if-no-files-found: error
retention-days: 1
- name: Upload merged total coverage
# Fail the job if Codecov can't find or upload the merged coverage
if: always()
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.0 pinned
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: GoCodeAlone/modular
files: total-coverage.txt
flags: total
fail_ci_if_error: true