Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable codecov #5

Merged
merged 10 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
coverage:
status:
project: false
patch: off

ignore:
- "docs/**/*"
- "tests/**/*"
- "internal/testutil/*"
- "pkg/**/*"
- "wiki/**/*"
24 changes: 10 additions & 14 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
name: CI

env:
# renovate: github=golangci/golangci-lint
GO_LINT_CI_VERSION: v1.63.4
# renovate: github=goreleaser/goreleaser
GORELEASER_VERSION: v2.5.1

on:
pull_request:
push:
Expand All @@ -32,6 +26,8 @@ jobs:
go-version-file: 'go.mod'
cache: true

- run: go mod tidy -diff

- run: go build -o m365-exporter ./cmd/m365-exporter

- name: Fetch OIDC token from GH actions API
Expand All @@ -48,6 +44,10 @@ jobs:
AZURE_CLIENT_ID: "${{ vars.AZURE_CLIENT_ID }}"
AZURE_FEDERATED_TOKEN_FILE: "${{ format('{0}/.az-token', runner.temp) }}"

- name: Upload coverage reports to Codecov
if: always()
uses: codecov/codecov-action@v5

- name: Login to GitHub Container Registry
if: github.ref == 'refs/heads/main'
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
Expand All @@ -59,18 +59,13 @@ jobs:
- name: go build (with goreleaser)
uses: goreleaser/goreleaser-action@9ed2f89a662bf1735a48bc8557fd212fa902bebf # v6.1.0
with:
version: ${{ env.GORELEASER_VERSION }}
# renovate: github=goreleaser/goreleaser
version: v2.5.1
args: release --clean --timeout=3600s ${{ github.ref == 'refs/heads/main' && '--auto-snapshot --skip announce' || '--snapshot' }}
env:
GITHUB_TOKEN: ${{ github.ref == 'refs/heads/main' && secrets.GITHUB_TOKEN || '' }}
GORELEASER_CURRENT_TAG: ${{ github.ref == 'refs/heads/main' && github.ref_name || '' }}

- name: Archive code coverage results
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: code-coverage
path: coverage.txt

lint:
name: golangci-lint
runs-on: ubuntu-24.04
Expand Down Expand Up @@ -103,13 +98,14 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MULTI_STATUS: false
VALIDATE_ALL_CODEBASE: false
VALIDATE_ALL_CODEBASE: true
VALIDATE_BASH: true
VALIDATE_BASH_EXEC: true
VALIDATE_EDITORCONFIG: true
VALIDATE_ENV: true
VALIDATE_GITHUB_ACTIONS: true
VALIDATE_GITLEAKS: true
#VALIDATE_GO_RELEASER: true
VALIDATE_JSON: true
VALIDATE_NATURAL_LANGUAGE: true
VALIDATE_PYTHON: true
Expand Down
5 changes: 3 additions & 2 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ builds:
-X github.com/prometheus/common/version.BuildDate={{.Date}}

kos:
- repository: ghcr.io/cloudeteer/m365-exporter
- repositories:
- ghcr.io/cloudeteer/m365-exporter
tags:
- "{{ if .IsSnapshot }}main{{ else }}{{.Version}}{{ end }}"
- "{{ if not .IsSnapshot }}latest{{ end }}"
Expand All @@ -47,7 +48,7 @@ kos:
org.opencontainers.image.vendor: "Cloudeteer GmbH"
org.opencontainers.image.licenses: "MIT"
org.opencontainers.image.description: "A Microsoft 365 exporter for Prometheus metrics"
label:
labels:
org.opencontainers.image.source: "https://github.com/cloudeteer/m365-exporter"
docker_signs:
- artifacts: manifests
Expand Down
1 change: 1 addition & 0 deletions pkg/collectors/adsync/adsync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (

func TestCollector_ScrapeMetrics(t *testing.T) {
t.Parallel()
t.Skip()

var (
ok bool
Expand Down
Loading