Skip to content

Commit

Permalink
Add GitHub workflow to check if PR has Changelog (#3391)
Browse files Browse the repository at this point in the history
Co-authored-by: Vasco Guita <[email protected]>
  • Loading branch information
vascoguita and vascoguita authored Oct 25, 2022
1 parent 4aea2a8 commit 12c875c
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 163 deletions.
44 changes: 0 additions & 44 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ def main(ctx):
# ocisIntegrationTests(6, [1, 4]) - this will only run 1st and 4th parts
# implemented for: ocisIntegrationTests and s3ngIntegrationTests
return [
changelog(),
checkStarlark(),
coverage(),
buildAndPublishDocker(),
Expand Down Expand Up @@ -252,39 +251,6 @@ def buildAndPublishDocker():
],
}

def changelog():
return {
"kind": "pipeline",
"type": "docker",
"name": "changelog",
"platform": {
"os": "linux",
"arch": "amd64",
},
"trigger": {
"event": {
"include": [
"pull_request",
],
},
},
"steps": [
{
"name": "changelog",
"image": "registry.cern.ch/docker.io/library/golang:1.19",
"commands": [
"make release-deps && /go/bin/calens > /dev/null",
"make check-changelog-drone PR=$DRONE_PULL_REQUEST",
],
"environment": {
"GITHUB_API_TOKEN": {
"from_secret": "github_api_token",
},
},
},
],
}

def coverage():
return {
"kind": "pipeline",
Expand Down Expand Up @@ -319,7 +285,6 @@ def coverage():
},
},
],
"depends_on": ["changelog"],
}

def buildOnly():
Expand Down Expand Up @@ -366,7 +331,6 @@ def buildOnly():
],
},
],
"depends_on": ["changelog"],
}

def testIntegration():
Expand Down Expand Up @@ -400,7 +364,6 @@ def testIntegration():
"services": [
redisService(),
],
"depends_on": ["changelog"],
}

def release():
Expand Down Expand Up @@ -522,7 +485,6 @@ def release():
},
},
],
"depends_on": ["changelog"],
}

def virtualViews():
Expand Down Expand Up @@ -582,7 +544,6 @@ def virtualViews():
},
},
],
"depends_on": ["changelog"],
}

def litmusOcisOldWebdav():
Expand Down Expand Up @@ -635,7 +596,6 @@ def litmusOcisOldWebdav():
},
},
],
"depends_on": ["changelog"],
}

def litmusOcisNewWebdav():
Expand Down Expand Up @@ -689,7 +649,6 @@ def litmusOcisNewWebdav():
},
},
],
"depends_on": ["changelog"],
}

def litmusOcisSpacesDav():
Expand Down Expand Up @@ -748,7 +707,6 @@ def litmusOcisSpacesDav():
],
},
],
"depends_on": ["changelog"],
}

def ocisIntegrationTests(parallelRuns, skipExceptParts = []):
Expand Down Expand Up @@ -822,7 +780,6 @@ def ocisIntegrationTests(parallelRuns, skipExceptParts = []):
"services": [
ldapService(),
],
"depends_on": ["changelog"],
},
)

Expand Down Expand Up @@ -900,7 +857,6 @@ def s3ngIntegrationTests(parallelRuns, skipExceptParts = []):
ldapService(),
cephService(),
],
"depends_on": ["changelog"],
},
)

Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/check-changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Check Changelog
on:
pull_request:
paths-ignore: [".github/**", "Makefile", "tools/**", "docs/**", "tests/**", ".drone.star", ".drone.env", "go.mod", "go.sum"]

jobs:
check-changelog:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/[email protected]
- name: Setup Go environment
uses: actions/[email protected]
with:
go-version-file: ${{ github.workspace }}/go.mod
- name: Setup Golang caches
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Cache calens
id: cache-calens
uses: actions/cache@v3
with:
path: $(go env GOPATH)/bin/calens
key: ${{ runner.os }}-calens
- name: clone calens
if: steps.cache-calens.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: restic/calens
path: calens
fetch-depth: 0
ref: v0.2.0
- name: Install calens
if: steps.cache-calens.outputs.cache-hit != 'true'
run: cd ${{ github.workspace }}/calens && go install

- name: Check if changelog exists
run: |
$(go env GOPATH)/bin/calens | \
sed -n '/^Changelog for reva unreleased (UNRELEASED)/,/^Details/p' | \
grep -E '^ \* [[:alpha:]]{3} #${{ github.event.pull_request.number }}: '
14 changes: 1 addition & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ LITMUS_USERNAME="einstein"
LITMUS_PASSWORD="relativity"
TESTS="basic http copymove props"

default: build test lint gen-doc check-changelog
default: build test lint gen-doc
release: deps build test lint gen-doc

off:
Expand Down Expand Up @@ -93,13 +93,6 @@ lint-ci:
gen-doc:
go run tools/generate-documentation/main.go

check-changelog: release-deps
`go env GOPATH`/bin/calens > /dev/null
go run tools/check-changelog/main.go

check-changelog-drone:
go run tools/check-changelog/main.go -repo origin -pr "$(PR)"

# to be run in CI platform
ci: build-ci test lint-ci

Expand All @@ -113,11 +106,6 @@ build-reva-docker: off
clean:
rm -rf dist

# for releasing you need to run: go run tools/prepare-release/main.go
# $ go run tools/prepare-release/main.go -version 0.0.1 -commit -tag
release-deps:
cd /tmp && rm -rf calens && git clone --quiet -b 'v0.2.0' --single-branch --depth 1 https://github.com/restic/calens &> /dev/null && cd calens && go install

# create local build versions
dist: default
go run tools/create-artifacts/main.go -version ${VERSION} -commit ${GIT_COMMIT} -goversion ${GO_VERSION}
Expand Down
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ require (
github.com/golang/protobuf v1.5.2
github.com/gomodule/redigo v1.8.8
github.com/google/go-cmp v0.5.8
github.com/google/go-github v17.0.0+incompatible
github.com/google/uuid v1.3.0
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
github.com/hashicorp/go-hclog v1.2.1
Expand Down Expand Up @@ -98,7 +97,6 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/hashicorp/go-immutable-radix v1.0.0 // indirect
github.com/hashicorp/go-msgpack v1.1.5 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
Expand Down
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -448,12 +448,8 @@ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY=
github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
github.com/google/go-github/v32 v32.1.0/go.mod h1:rIEpZD9CTDQwDK9GDrtMTycQNA4JU3qBsCizh3q2WCI=
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
Expand Down
100 changes: 0 additions & 100 deletions tools/check-changelog/main.go

This file was deleted.

0 comments on commit 12c875c

Please sign in to comment.