Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI tests] exclude hack codes #543

Merged
merged 5 commits into from
Jul 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/chatops_commands.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- :ok_woman: `/approve` - approve
- :love_letter: `/changelog` - add changelog comment
- :bento: `/format` - format codes and add licenses
- :white_check_mark: `/gen-test` - generate test codes
- :label: `/label` - add labels
- :rewind: `/rebase` - rebase master
24 changes: 24 additions & 0 deletions .github/workflows/chatops-help.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: "ChatOps help"
on:
pull_request:
types: [opened]
jobs:
print-help:
name: print help
runs-on: ubuntu-latest
steps:
- name: comment to PR
run: |
curl -o chatops_commands.md https://raw.githubusercontent.com/vdaas/vald/master/.github/chatops_commands.md
BODY=`cat chatops_commands.md | sed ':a;N;$!ba;s/\n/\\\\n/g'`
curl --include --verbose --fail \
-H "Accept: application/json" \
-H "Content-Type:application/json" \
-H "Authorization: token ${GITHUB_TOKEN}" \
--request POST \
--data "{\"body\": \"**[CHATOPS:HELP]** ChatOps commands.\\n${BODY}\"}" \
$API_URL
env:
GITHUB_TOKEN: ${{ secrets.DISPATCH_TOKEN }}
API_URL: ${{ github.event.pull_request.comments_url }}
PR_NUM: ${{ github.event.issue.number }}
8 changes: 7 additions & 1 deletion .github/workflows/chatops.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ jobs:
label:
name: Add labels
runs-on: ubuntu-latest
if: steps.check_comments_label.outputs.COMMENTER_USERNAME != 'vdaas-ci'
steps:
- name: check PR Comments
id: check_comments_label
Expand Down Expand Up @@ -60,6 +61,7 @@ jobs:
changelog:
name: Add draft comment for a new CHANGELOG entry
runs-on: ubuntu-latest
if: steps.check_comments_label.outputs.COMMENTER_USERNAME != 'vdaas-ci'
steps:
- name: check PR Comments
id: check_comments_changelog
Expand Down Expand Up @@ -102,7 +104,7 @@ jobs:
run: |
git checkout master
PREVIOUS_VERSION=$(git describe --tags $(git rev-list --tags --max-count=1))
BODY=`git log --pretty=format:'- %s' ${PREVIOUS_VERSION}..master | grep "#[[:digit:]]\+" | sed -e "s/\[\(patch\|minor\|major\)\] *//g" | sed -e "s%#\([[:digit:]]\+\)%[&](https://github.com/vdaas/vald/pull/\1)%" | sed ':a;N;$!ba;s/\n/\\\\n/g'`
BODY=`git log --pretty=format:'- %s' ${PREVIOUS_VERSION}..master | grep "#[[:digit:]]\+" | sed -e "s/\[\(patch\|minor\|major\)\] *//g" | sed -e "s%#\([[:digit:]]\+\)%[&](https://github.com/vdaas/vald/pull/\1)%g" | sed ':a;N;$!ba;s/\n/\\\\n/g'`
CURRENT="- ${PR_TITLE} ([#${PR_NUM}](https://github.com/vdaas/vald/pull/${PR_NUM}))"
curl --include --verbose --fail \
-H "Accept: application/json" \
Expand All @@ -119,6 +121,7 @@ jobs:
rebase:
name: Rebase
runs-on: ubuntu-latest
if: steps.check_comments_label.outputs.COMMENTER_USERNAME != 'vdaas-ci'
steps:
- name: check PR Comments
id: check_comments_rebase
Expand Down Expand Up @@ -192,6 +195,7 @@ jobs:
needs:
- rebase
runs-on: ubuntu-latest
if: steps.check_comments_label.outputs.COMMENTER_USERNAME != 'vdaas-ci'
steps:
- name: check PR Comments
id: check_comments_gen_test
Expand Down Expand Up @@ -298,6 +302,7 @@ jobs:
- rebase
- gentest
runs-on: ubuntu-latest
if: steps.check_comments_label.outputs.COMMENTER_USERNAME != 'vdaas-ci'
steps:
- name: check PR Comments
id: check_comments_format
Expand Down Expand Up @@ -428,6 +433,7 @@ jobs:
- rebase
- format
runs-on: ubuntu-latest
if: steps.check_comments_label.outputs.COMMENTER_USERNAME != 'vdaas-ci'
steps:
- name: check PR Comments
id: check_comments_approve
Expand Down
34 changes: 30 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ on:
- 'cmd/**'

jobs:
coverage:
name: Run tests
test-cmd:
name: Run tests for cmd packages
runs-on: ubuntu-latest
container:
image: vdaas/vald-ci-container:nightly
Expand All @@ -26,6 +26,32 @@ jobs:
uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Run tests
- name: Run tests for cmd packages
run: |
make test
make test/cmd
test-internal:
name: Run tests for internal packages
runs-on: ubuntu-latest
container:
image: vdaas/vald-ci-container:nightly
steps:
- name: Check out code.
uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Run tests for internal packages
run: |
make test/internal
test-pkg:
name: Run tests for pkg packages
runs-on: ubuntu-latest
container:
image: vdaas/vald-ci-container:nightly
steps:
- name: Check out code.
uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Run tests for pkg packages
run: |
make test/pkg
29 changes: 27 additions & 2 deletions Makefile.d/test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,34 @@
#

.PHONY: test
## run tests
## run tests for cmd, internal, pkg
test:
go test -json -cover ./... | tparse -top
go test -json -cover ./cmd/... ./internal/... ./pkg/... | tparse -notests

.PHONY: test/cmd
## run tests for cmd
test/cmd:
go test -json -cover ./cmd/... | tparse -pass -notests

.PHONY: test/internal
## run tests for internal
test/internal:
go test -json -cover ./internal/... | tparse -pass -notests

.PHONY: test/pkg
## run tests for pkg
test/pkg:
go test -json -cover ./pkg/... | tparse -pass -notests

.PHONY: test/hack
## run tests for hack
test/hack:
go test -json -cover ./hack/... | tparse -pass -notests

.PHONY: test/all
## run tests for all Go codes
test/all:
go test -json -cover ./... | tparse -notests

.PHONY: coverage
## calculate coverages
Expand Down