Skip to content

Commit

Permalink
feat: updated metrics & logic based on upstream contributions (#260)
Browse files Browse the repository at this point in the history
* config: updated pre-commit yamlfmt options

* docs: updated README metric info

* refactor: updated metric descriptions and renamed for clarity

* test: added tests to helpers_test for new functions

* feat: updated gitlab_scraper w/ latest helpers changes

* test: fixing up tests/happy paths

* test: added test case for merged PRs

* ci: fixed formatting for build ci workflow

BREAKING CHANGE: removed the Repository pull request deployment time metric & renamed other metrics
  • Loading branch information
4lch4 committed Jan 19, 2024
1 parent 5b77def commit 0c32706
Show file tree
Hide file tree
Showing 37 changed files with 1,171 additions and 1,149 deletions.
3 changes: 2 additions & 1 deletion .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
---
ignore:
- "**/generated*.go"
- '**/generated*.go'
20 changes: 10 additions & 10 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
---
# Add 'documentation' label to any change to *.md files
documentation:
- changed-files:
- any-glob-to-any-file: '**/*.md'
- changed-files:
- any-glob-to-any-file: '**/*.md'

# Add 'docker' label to any change in docker related files
docker:
- changed-files:
- any-glob-to-any-file: ['**/Dockerfile*', '**/.dockerignore']
- changed-files:
- any-glob-to-any-file: ['**/Dockerfile*', '**/.dockerignore']

# Add 'github_actions' label to any change .github/ directory
github_actions:
- changed-files:
- any-glob-to-any-file: .github/**
- changed-files:
- any-glob-to-any-file: .github/**

# Add 'go' label to any change *.go files
go:
- changed-files:
- any-glob-to-any-file: ['**/*.go', '**/*.mod', '**/*.sum', '**/*.tmpl']
- changed-files:
- any-glob-to-any-file: ['**/*.go', '**/*.mod', '**/*.sum', '**/*.tmpl']

# Add 'build' to any config files or makefiles
build:
- changed-files:
- any-glob-to-any-file: [config/**, '**/Makefile*']
- changed-files:
- any-glob-to-any-file: [config/**, '**/Makefile*']
281 changes: 141 additions & 140 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,145 +2,146 @@
name: Build and Test

on:
pull_request:
paths:
- '**/Dokerfile*'
- '**/.dockerignore'
- .github/**
- '**/*.go'
- '**/*.mod'
- '**/*.sum'
- config/**
- '**/Makefile*'
- '**/documentation.md'
- .golangci.yaml
- .goreleaser.yaml

push:
branches: [main]
pull_request:
branches: [main]
paths:
- '**/Dockerfile'
- '**/.dockerignore'
- .github/**
- '**.go'
- '**.mod'
- '**.sum'
- config/**
- '**/Makefile*'
- '**/documentation.md'
- .golangci.yaml
- .goreleaser.yaml

push:
branches: [main]

jobs:
lint:
strategy:
matrix:
go: ['1.21']
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
cache: false

- name: Make install-tools
run: make install-tools

- name: Make lint-all
run: make lint-all

- name: Check Code Generation
run: |
make generate
git diff -s --exit-code || (echo 'Generated code is out of date. Run make generate and commit the changes' && exit 1)
- name: Check packages are up-to-date
run: |
make tidy-all
git diff -s --exit-code || (echo 'Packages are out of date. Run make tidy-all and commit the changes' && exit 1)
- name: Check crosslink run
run: |
make crosslink
git diff -s --exit-code || (echo 'Replace statements not updated. Run make crosslink and commit the changes' && exit 1)
build:
name: build
strategy:
matrix:
GOOS: [darwin, linux, windows]
GOARCH: [arm64, amd64, '386']
go: ['1.21']
exclude:
- GOOS: darwin
GOARCH: '386'
- GOOS: darwin
GOARCH: arm
- GOOS: windows
GOARCH: arm
- GOOS: windows
GOARCH: arm64
runs-on:
group: bigger
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
cache: false

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
if: steps.cache.outputs.cache-hit != 'true'
with:
distribution: goreleaser-pro
version: latest
args: release --clean --snapshot --split
env:
GGOOS: ${{ matrix.GOOS }}
GGOARCH: ${{ matrix.GOARCH }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}

test:
strategy:
matrix:
go: ['1.21']
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
cache: false

- name: Make test-all
run: make test-all

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3

go-semantic-release:
if: ${{ github.ref == 'refs/heads/main' }}
needs: [lint, build]
runs-on:
group: bigger
permissions:
contents: write
steps:
- name: Run go-semantic-release
uses: go-semantic-release/action@v1
with:
github-token: ${{ secrets.SEMANTIC_RELEASE_GH_PAT }}
changelog-generator-opt: emojis=true
allow-initial-development-versions: true
lint:
strategy:
matrix:
go: ['1.21']
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
cache: false

- name: Make install-tools
run: make install-tools

- name: Make lint-all
run: make lint-all

- name: Check Code Generation
run: |
make generate
git diff -s --exit-code || (echo 'Generated code is out of date. Run make generate and commit the changes' && exit 1)
- name: Check packages are up-to-date
run: |
make tidy-all
git diff -s --exit-code || (echo 'Packages are out of date. Run make tidy-all and commit the changes' && exit 1)
- name: Check crosslink run
run: |
make crosslink
git diff -s --exit-code || (echo 'Replace statements not updated. Run make crosslink and commit the changes' && exit 1)
build:
name: build
strategy:
matrix:
GOOS: [darwin, linux, windows]
GOARCH: [arm64, amd64, '386']
go: ['1.21']
exclude:
- GOOS: darwin
GOARCH: '386'
- GOOS: darwin
GOARCH: arm
- GOOS: windows
GOARCH: arm
- GOOS: windows
GOARCH: arm64
runs-on:
group: bigger
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
cache: false

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
if: steps.cache.outputs.cache-hit != 'true'
with:
distribution: goreleaser-pro
version: latest
args: release --clean --snapshot --split
env:
GGOOS: ${{ matrix.GOOS }}
GGOARCH: ${{ matrix.GOARCH }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}

test:
strategy:
matrix:
go: ['1.21']
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
cache: false

- name: Make test-all
run: make test-all

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3

go-semantic-release:
if: ${{ github.ref == 'refs/heads/main' }}
needs: [lint, build]
runs-on:
group: bigger
permissions:
contents: write
steps:
- name: Run go-semantic-release
uses: go-semantic-release/action@v1
with:
github-token: ${{ secrets.SEMANTIC_RELEASE_GH_PAT }}
changelog-generator-opt: emojis=true
allow-initial-development-versions: true
22 changes: 11 additions & 11 deletions .github/workflows/pr_conventional.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
name: PR Linter

on:
pull_request:
types:
- opened
- edited
- synchronize
pull_request:
types:
- opened
- edited
- synchronize

jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
triage:
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16 changes: 8 additions & 8 deletions .github/workflows/pr_labeler.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
name: Pull Request Labeler
on:
- pull_request_target
- pull_request_target

jobs:
labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
Loading

0 comments on commit 0c32706

Please sign in to comment.