Skip to content

Commit 5b9693c

Browse files
committed
ci: add workflows for testing, linting, housekeeping, and updates
Created workflows for testing, code coverage, linting, and other housekeeping tasks including issue management, semantic pull request enforcement, and dependency updates automation. These enhancements improve code quality, automate routine tasks, and ensure adherence to project standards.
1 parent e048b76 commit 5b9693c

File tree

7 files changed

+303
-0
lines changed

7 files changed

+303
-0
lines changed

.github/auto_request_review.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
reviewers:
2+
defaults:
3+
- rollkit
4+
groups:
5+
rollkit:
6+
- team:core
7+
files:
8+
".github/**":
9+
- MSevey
10+
- rollkit
11+
options:
12+
ignore_draft: true
13+
ignored_keywords:
14+
- WIP
15+
number_of_reviewers: 3

.github/dependabot.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
open-pull-requests-limit: 10
8+
labels:
9+
- T:dependencies
10+
# Group all patch updates into a single PR
11+
groups:
12+
patch-updates:
13+
applies-to: version-updates
14+
update-types:
15+
- "patch"
16+
- package-ecosystem: gomod
17+
directory: "/"
18+
schedule:
19+
interval: daily
20+
open-pull-requests-limit: 10
21+
labels:
22+
- T:dependencies
23+
# Group all patch updates into a single PR
24+
groups:
25+
patch-updates:
26+
applies-to: version-updates
27+
update-types:
28+
- "patch"
29+
- package-ecosystem: docker
30+
directory: "/docker"
31+
schedule:
32+
interval: daily
33+
open-pull-requests-limit: 10
34+
labels:
35+
- T:dependencies
36+
# Group all patch updates into a single PR
37+
groups:
38+
patch-updates:
39+
applies-to: version-updates
40+
update-types:
41+
- "patch"

.github/workflows/ci_release.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: CI and Release
2+
on:
3+
push:
4+
branches:
5+
- main
6+
# Trigger on version tags
7+
tags:
8+
- 'v[0-9]+\.[0-9]+\.[0-9]+'
9+
- 'v[0-9]+\.[0-9]+\.[0-9]+-rc(?:[0-9]+|\.[0-9]+)'
10+
pull_request:
11+
merge_group:
12+
workflow_dispatch:
13+
# Inputs the workflow accepts.
14+
inputs:
15+
version:
16+
# Friendly description to be shown in the UI instead of 'name'
17+
description: "Semver type of new version (major / minor / patch)"
18+
# Input has to be provided for the workflow to run
19+
required: true
20+
type: choice
21+
options:
22+
- patch
23+
- minor
24+
- major
25+
26+
jobs:
27+
lint:
28+
uses: ./.github/workflows/lint.yml
29+
30+
test:
31+
uses: ./.github/workflows/test.yml
32+
33+
# Make a release if this is a manually trigger job, i.e. workflow_dispatch
34+
release:
35+
needs: [lint, test]
36+
runs-on: ubuntu-latest
37+
if: ${{ github.event_name == 'workflow_dispatch' }}
38+
permissions: "write-all"
39+
steps:
40+
- uses: actions/checkout@v4
41+
- name: Version Release
42+
uses: rollkit/.github/.github/actions/[email protected]
43+
with:
44+
github-token: ${{secrets.GITHUB_TOKEN}}
45+
version-bump: ${{inputs.version}}

.github/workflows/housekeeping.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Housekeeping
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
pull_request_target:
7+
types: [opened, ready_for_review]
8+
9+
jobs:
10+
issue-management:
11+
if: ${{ github.event.issue }}
12+
name: Add issues to project and add triage label
13+
uses: rollkit/.github/.github/workflows/[email protected]
14+
secrets: inherit
15+
permissions:
16+
issues: write
17+
pull-requests: write
18+
with:
19+
run-labels: true
20+
labels-to-add: "needs-triage"
21+
run-projects: true
22+
project-url: https://github.com/orgs/rollkit/projects/7
23+
24+
add-pr-to-project:
25+
# ignore dependabot PRs
26+
if: ${{ github.event.pull_request && github.actor != 'dependabot[bot]' }}
27+
name: Add PRs to project
28+
uses: rollkit/.github/.github/workflows/[email protected]
29+
secrets: inherit
30+
permissions:
31+
issues: write
32+
pull-requests: write
33+
with:
34+
run-projects: true
35+
project-url: https://github.com/orgs/rollkit/projects/7
36+
37+
auto-add-reviewer:
38+
name: Auto add reviewer to PR
39+
if: github.event.pull_request
40+
uses: rollkit/.github/.github/workflows/[email protected]
41+
secrets: inherit
42+
permissions:
43+
issues: write
44+
pull-requests: write
45+
with:
46+
run-auto-request-review: true
47+
48+
auto-add-assignee-pr:
49+
# ignore dependabot PRs
50+
if: ${{ github.event.pull_request && github.actor != 'dependabot[bot]' }}
51+
name: Assign PR to creator
52+
runs-on: ubuntu-latest
53+
permissions:
54+
issues: write
55+
pull-requests: write
56+
steps:
57+
- name: Set pull_request url and creator login
58+
# yamllint disable rule:line-length
59+
run: |
60+
echo "PR=${{ github.event.pull_request.html_url }}" >> $GITHUB_ENV
61+
echo "CREATOR=${{ github.event.pull_request.user.login }}" >> $GITHUB_ENV
62+
# yamllint enable rule:line-length
63+
- name: Assign PR to creator
64+
run: gh pr edit ${{ env.PR }} --add-assignee ${{ env.CREATOR }}
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
68+
auto-add-assignee-label:
69+
if: ${{ github.event.issue }}
70+
name: Assign issue to creator
71+
runs-on: ubuntu-latest
72+
permissions:
73+
issues: write
74+
pull-requests: write
75+
steps:
76+
- name: Checkout the repository
77+
uses: actions/checkout@v4
78+
- name: Set issue number and creator login
79+
run: |
80+
echo "ISSUE=${{ github.event.issue.number }}" >> $GITHUB_ENV
81+
echo "CREATOR=${{ github.event.issue.user.login }}" >> $GITHUB_ENV
82+
- name: Assign issue to creator
83+
run: gh issue edit ${{ env.ISSUE }} --add-assignee ${{ env.CREATOR }}
84+
env:
85+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/lint.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# lint runs all linters in this repository
2+
# This workflow is triggered by ci_release.yml workflow
3+
name: lint
4+
on:
5+
workflow_call:
6+
7+
jobs:
8+
golangci-lint:
9+
name: golangci-lint
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-go@v5
14+
with:
15+
go-version-file: ./go.mod
16+
# This steps sets the GIT_DIFF environment variable to true
17+
# if files defined in PATTERS changed
18+
- uses: technote-space/[email protected]
19+
with:
20+
# This job will pass without running if go.mod, go.sum, and *.go
21+
# wasn't modified.
22+
PATTERNS: |
23+
**/**.go
24+
go.mod
25+
go.sum
26+
- uses: golangci/[email protected]
27+
with:
28+
version: latest
29+
args: --timeout 10m
30+
github-token: ${{ secrets.github_token }}
31+
if: env.GIT_DIFF
32+
33+
# hadolint lints the Dockerfile
34+
hadolint:
35+
uses: rollkit/.github/.github/workflows/[email protected] # yamllint disable-line rule:line-length
36+
with:
37+
dockerfile: Dockerfile
38+
failure-threshold: error
39+
40+
yamllint:
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: actions/checkout@v4
44+
- uses: rollkit/.github/.github/actions/[email protected]
45+
46+
markdown-lint:
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@v4
50+
- uses: rollkit/.github/.github/actions/[email protected]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Semantic Pull Request
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
permissions:
11+
pull-requests: read
12+
13+
jobs:
14+
main:
15+
name: conventional-commit-pr-title
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: amannn/action-semantic-pull-request@v5
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Tests / Code Coverage workflow
2+
# This workflow is triggered by ci_release.yml workflow
3+
name: Tests / Code Coverage
4+
on:
5+
workflow_call:
6+
7+
jobs:
8+
go_mod_tidy_check:
9+
name: Go Mod Tidy Check
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-go@v5
14+
with:
15+
go-version-file: ./go.mod
16+
- run: go mod tidy
17+
- name: check for diff
18+
run: git diff --exit-code
19+
20+
unit_test:
21+
name: Run Unit Tests
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
- name: set up go
26+
uses: actions/setup-go@v5
27+
with:
28+
go-version-file: ./go.mod
29+
- name: Run unit test
30+
run: make test
31+
- name: upload coverage report
32+
uses: codecov/[email protected]
33+
with:
34+
token: ${{ secrets.CODECOV_TOKEN }}
35+
file: ./coverage.txt
36+
37+
integration_test:
38+
name: Run Integration Tests
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v4
42+
- name: set up go
43+
uses: actions/setup-go@v5
44+
with:
45+
go-version-file: ./go.mod
46+
- name: Integration Tests
47+
run: echo "No integration tests yet"

0 commit comments

Comments
 (0)