mirror of
https://github.com/apricote/releaser-pleaser.git
synced 2026-01-13 21:21:03 +00:00
ci: setup unit tests, linting
This commit is contained in:
parent
e0b1e2221d
commit
4dfc8e9654
3 changed files with 63 additions and 3 deletions
60
.github/workflows/ci.yaml
vendored
Normal file
60
.github/workflows/ci.yaml
vendored
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
name: ci
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version-file: go.mod
|
||||||
|
|
||||||
|
- name: Run golangci-lint
|
||||||
|
uses: golangci/golangci-lint-action@v6
|
||||||
|
with:
|
||||||
|
version: v1.59.1 # renovate: datasource=github-releases depName=golangci/golangci-lint
|
||||||
|
args: --timeout 5m
|
||||||
|
|
||||||
|
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version-file: go.mod
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: go test -v -race -coverpkg=./... ./...
|
||||||
|
|
||||||
|
|
||||||
|
go-mod-tidy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version-file: go.mod
|
||||||
|
|
||||||
|
- name: Run go mod tidy
|
||||||
|
run: go mod tidy
|
||||||
|
|
||||||
|
- name: Check uncommitted changes
|
||||||
|
run: git diff --exit-code
|
||||||
|
|
||||||
|
- if: failure()
|
||||||
|
run: echo "::error::Check failed, please run 'go mod tidy' and commit the changes."
|
||||||
|
|
@ -200,6 +200,9 @@ func reconcileReleasePR(ctx context.Context, forge rp.Forge, changesets []rp.Cha
|
||||||
}
|
}
|
||||||
|
|
||||||
localCommit, err := repo.CommitObject(releaseCommitHash)
|
localCommit, err := repo.CommitObject(releaseCommitHash)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
diff, err := localCommit.PatchContext(ctx, remoteCommit)
|
diff, err := localCommit.PatchContext(ctx, remoteCommit)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAnalyzeCommits(t *testing.T) {
|
func TestAnalyzeCommits(t *testing.T) {
|
||||||
type args struct {
|
|
||||||
commits []Commit
|
|
||||||
}
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
commits []Commit
|
commits []Commit
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue