Skip to content

Commit

Permalink
exclude hack codes (#543)
Browse files Browse the repository at this point in the history
* ✅ exclude hack tests

Signed-off-by: Rintaro Okamura <[email protected]>

* 💚 add chatops help

Signed-off-by: Rintaro Okamura <[email protected]>

* 💚 Fix

Signed-off-by: Rintaro Okamura <[email protected]>

* 💚 ok

Signed-off-by: Rintaro Okamura <[email protected]>

* 🔥 remove redundant codes

Signed-off-by: Rintaro Okamura <[email protected]>
  • Loading branch information
rinx authored Jul 2, 2020
1 parent b5bbd2e commit 02db131
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 7 deletions.
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

0 comments on commit 02db131

Please sign in to comment.