Skip to content

Commit 3c62f5d

Browse files
committed
👷 [CI] Use GitHub instead of Travis.
Signed-off-by: Oliver Tale-Yazdi <oliver@perun.network>
1 parent cf9279c commit 3c62f5d

File tree

3 files changed

+61
-49
lines changed

3 files changed

+61
-49
lines changed

.github/workflows/ci.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Go
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
- master
8+
tags:
9+
pull_request:
10+
release:
11+
12+
jobs:
13+
build:
14+
name: CI
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Set up Go 1.x
18+
uses: actions/setup-go@v2
19+
with:
20+
go-version: ^1.15
21+
22+
- name: Checkout
23+
uses: actions/checkout@v2
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Copyright notice
28+
run: |
29+
.scripts/check-copyright-notice.sh
30+
.scripts/check-notice-authors.sh $(git log --pretty=format:"%H" --merges -n 1)
31+
32+
- name: Dependencies
33+
run: |
34+
go get -v -t -d ./...
35+
docker pull golangci/golangci-lint:v1.27
36+
37+
- name: Vanity import
38+
run: .scripts/check-vanity-imports.sh $GITHUB_WORKSPACE
39+
40+
- name: Vetting
41+
run: docker run --rm -v $GITHUB_WORKSPACE:/app -w /app golangci/golangci-lint:v1.27 golangci-lint run
42+
43+
- name: Unit Tests
44+
run: go test -timeout 60s ./...
45+
46+
- name: Unit Race Tests
47+
run: go test -timeout 120s -race -gcflags=all=-d=checkptr=0 ./...

.scripts/check-notice-authors.sh

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,29 @@ exit_code=0
2525
# Call with an ancestor whereas all commits newer than the ancestor are checked.
2626
base="$1"
2727
if [ -z "$base" ]; then
28-
commits="$(git rev-list --reverse HEAD)"
28+
commits="$(git rev-list --no-merges --reverse HEAD)"
2929
else
30-
commits="$(git rev-list --reverse $base..HEAD)"
30+
commits="$(git rev-list --no-merges --reverse $base..HEAD)"
3131
fi
3232

33+
echo "Current commit: $(git show $(git rev-parse HEAD))"
34+
git log -n 5
3335
# Authors found in commits and NOTICE.
3436
declare -A known_authors
3537
# Authors found only in commits but not NOTICE file.
3638
declare -A assumed_authors
3739

3840
for c in $commits; do
3941
author=$(git show -s --format='%an <%ae>' $c)
40-
# Check Signed-Off-By message
41-
if ! git show -s --format='%B' $c | grep -wq "Signed-off-by: $author"; then
42+
msg=$(git show -s --format='%B' $c)
43+
echo "Checking commit: $c"
44+
45+
# Do not check automatically created merge commits in the GitHub CI for a 'Signed-Off-By' message.
46+
# They still need to be created with a valid author email.
47+
# *@users.noreply.github.com authors is not allowed.
48+
if [ -n "$GITHUB_WORKSPACE" ] && (echo "$msg" | egrep -wq "^[[:space:]]*Merge [[:xdigit:]]{40} into [[:xdigit:]]{40}[[:space:]]*$"); then
49+
echo "Skipping GitHub CI merge commit: $c"
50+
elif ! echo "$msg" | grep -wq "Signed-off-by: $author"; then
4251
echo "Commit $c is missing or has wrong 'Signed-off-by' message."
4352
exit_code=1
4453
fi
@@ -68,4 +77,5 @@ for c in $commits; do
6877
fi
6978
done
7079

80+
echo "Check exit code: $exit_code"
7181
exit $exit_code

.travis.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)