upgrade github action checkout@v2 (#10889)

enhance go_check order to make it fail earlier

Signed-off-by: Ziming Zhang <zziming@vmware.com>
This commit is contained in:
Ziming 2020-02-29 01:15:27 +08:00 committed by GitHub
parent 8de3fab3c5
commit 5f2544941e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 21 deletions

View File

@ -37,20 +37,22 @@ jobs:
with: with:
docker_version: 18.09 docker_version: 18.09
docker_channel: stable docker_channel: stable
- uses: actions/checkout@v1 - uses: actions/checkout@v2
with: with:
path: src/github.com/goharbor/harbor path: src/github.com/goharbor/harbor
- name: setup env - name: setup env
run: | run: |
cd src/github.com/goharbor/harbor
pwd pwd
go env go env
echo "::set-env name=GOPATH::$(go env GOPATH):$RUNNER_WORKSPACE" echo "::set-env name=GOPATH::$(go env GOPATH):$GITHUB_WORKSPACE"
echo "::add-path::$(go env GOPATH)/bin" echo "::add-path::$(go env GOPATH)/bin"
echo "::set-env name=TOKEN_PRIVATE_KEY_PATH::${GITHUB_WORKSPACE}/tests/private_key.pem" echo "::set-env name=TOKEN_PRIVATE_KEY_PATH::${GITHUB_WORKSPACE}/src/github.com/goharbor/harbor/tests/private_key.pem"
shell: bash shell: bash
- name: before_install - name: before_install
run: | run: |
set -x set -x
cd src/github.com/goharbor/harbor
pwd pwd
env env
#sudo apt install -y xvfb #sudo apt install -y xvfb
@ -66,6 +68,7 @@ jobs:
sudo service docker restart sudo service docker restart
- name: install - name: install
run: | run: |
cd src/github.com/goharbor/harbor
env env
bash ./tests/showtime.sh ./tests/travis/ut_install.sh bash ./tests/showtime.sh ./tests/travis/ut_install.sh
- name: script - name: script
@ -73,12 +76,13 @@ jobs:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
echo IP: $IP echo IP: $IP
cd src/github.com/goharbor/harbor
bash ./tests/showtime.sh ./tests/travis/ut_run.sh $IP bash ./tests/showtime.sh ./tests/travis/ut_run.sh $IP
- name: Codecov For BackEnd - name: Codecov For BackEnd
uses: codecov/codecov-action@v1 uses: codecov/codecov-action@v1
with: with:
file: ./profile.cov file: ./src/github.com/goharbor/harbor/profile.cov
yml: ./.github/codecov-ut-config/codecov.yml yml: ./src/github.com/goharbor/harbor/.github/codecov-ut-config/codecov.yml
APITEST_DB: APITEST_DB:
env: env:
@ -97,20 +101,22 @@ jobs:
with: with:
docker_version: 18.09 docker_version: 18.09
docker_channel: stable docker_channel: stable
- uses: actions/checkout@v1 - uses: actions/checkout@v2
with: with:
path: src/github.com/goharbor/harbor path: src/github.com/goharbor/harbor
- name: setup env - name: setup env
run: | run: |
cd src/github.com/goharbor/harbor
pwd pwd
go env go env
echo "::set-env name=GOPATH::$(go env GOPATH):$RUNNER_WORKSPACE" echo "::set-env name=GOPATH::$(go env GOPATH):$GITHUB_WORKSPACE"
echo "::add-path::$(go env GOPATH)/bin" echo "::add-path::$(go env GOPATH)/bin"
echo "::set-env name=TOKEN_PRIVATE_KEY_PATH::${GITHUB_WORKSPACE}/tests/private_key.pem" echo "::set-env name=TOKEN_PRIVATE_KEY_PATH::${GITHUB_WORKSPACE}/src/github.com/goharbor/harbor/tests/private_key.pem"
shell: bash shell: bash
- name: before_install - name: before_install
run: | run: |
set -x set -x
cd src/github.com/goharbor/harbor
pwd pwd
env env
#sudo apt install -y xvfb #sudo apt install -y xvfb
@ -126,10 +132,12 @@ jobs:
sudo service docker restart sudo service docker restart
- name: install - name: install
run: | run: |
cd src/github.com/goharbor/harbor
env env
bash ./tests/showtime.sh ./tests/travis/api_common_install.sh $IP DB bash ./tests/showtime.sh ./tests/travis/api_common_install.sh $IP DB
- name: script - name: script
run: | run: |
cd src/github.com/goharbor/harbor
echo IP: $IP echo IP: $IP
bash ./tests/showtime.sh ./tests/travis/api_run.sh DB $IP bash ./tests/showtime.sh ./tests/travis/api_run.sh DB $IP
@ -150,20 +158,22 @@ jobs:
with: with:
docker_version: 18.09 docker_version: 18.09
docker_channel: stable docker_channel: stable
- uses: actions/checkout@v1 - uses: actions/checkout@v2
with: with:
path: src/github.com/goharbor/harbor path: src/github.com/goharbor/harbor
- name: setup env - name: setup env
run: | run: |
cd src/github.com/goharbor/harbor
pwd pwd
go env go env
echo "::set-env name=GOPATH::$(go env GOPATH):$RUNNER_WORKSPACE" echo "::set-env name=GOPATH::$(go env GOPATH):$GITHUB_WORKSPACE"
echo "::add-path::$(go env GOPATH)/bin" echo "::add-path::$(go env GOPATH)/bin"
echo "::set-env name=TOKEN_PRIVATE_KEY_PATH::${GITHUB_WORKSPACE}/tests/private_key.pem" echo "::set-env name=TOKEN_PRIVATE_KEY_PATH::${GITHUB_WORKSPACE}/src/github.com/goharbor/harbor/tests/private_key.pem"
shell: bash shell: bash
- name: before_install - name: before_install
run: | run: |
set -x set -x
cd src/github.com/goharbor/harbor
pwd pwd
env env
#sudo apt install -y xvfb #sudo apt install -y xvfb
@ -179,11 +189,13 @@ jobs:
sudo service docker restart sudo service docker restart
- name: install - name: install
run: | run: |
cd src/github.com/goharbor/harbor
env env
bash ./tests/showtime.sh ./tests/travis/api_common_install.sh $IP LDAP bash ./tests/showtime.sh ./tests/travis/api_common_install.sh $IP LDAP
- name: script - name: script
run: | run: |
echo IP: $IP echo IP: $IP
cd src/github.com/goharbor/harbor
bash ./tests/showtime.sh ./tests/travis/api_run.sh LDAP $IP bash ./tests/showtime.sh ./tests/travis/api_run.sh LDAP $IP
OFFLINE: OFFLINE:
@ -203,21 +215,23 @@ jobs:
with: with:
docker_version: 18.09 docker_version: 18.09
docker_channel: stable docker_channel: stable
- uses: actions/checkout@v1 - uses: actions/checkout@v2
with: with:
path: src/github.com/goharbor/harbor path: src/github.com/goharbor/harbor
- name: setup env - name: setup env
run: | run: |
cd src/github.com/goharbor/harbor
pwd pwd
docker version docker version
go env go env
echo "::set-env name=GOPATH::$(go env GOPATH):$RUNNER_WORKSPACE" echo "::set-env name=GOPATH::$(go env GOPATH):$GITHUB_WORKSPACE"
echo "::add-path::$(go env GOPATH)/bin" echo "::add-path::$(go env GOPATH)/bin"
echo "::set-env name=TOKEN_PRIVATE_KEY_PATH::${GITHUB_WORKSPACE}/tests/private_key.pem" echo "::set-env name=TOKEN_PRIVATE_KEY_PATH::${GITHUB_WORKSPACE}/src/github.com/goharbor/harbor/tests/private_key.pem"
shell: bash shell: bash
- name: before_install - name: before_install
run: | run: |
set -x set -x
cd src/github.com/goharbor/harbor
pwd pwd
env env
#sudo apt install -y xvfb #sudo apt install -y xvfb
@ -234,6 +248,7 @@ jobs:
- name: script - name: script
run: | run: |
echo IP: $IP echo IP: $IP
cd src/github.com/goharbor/harbor
bash ./tests/showtime.sh ./tests/travis/distro_installer.sh bash ./tests/showtime.sh ./tests/travis/distro_installer.sh
UI_UT: UI_UT:
@ -246,20 +261,22 @@ jobs:
- uses: actions/setup-node@v1 - uses: actions/setup-node@v1
with: with:
node-version: '10.16.2' node-version: '10.16.2'
- uses: actions/checkout@v1 - uses: actions/checkout@v2
with: with:
path: src/github.com/goharbor/harbor path: src/github.com/goharbor/harbor
- name: setup env - name: setup env
run: | run: |
cd src/github.com/goharbor/harbor
pwd pwd
go env go env
echo "::set-env name=GOPATH::$(go env GOPATH):$RUNNER_WORKSPACE" echo "::set-env name=GOPATH::$(go env GOPATH):$GITHUB_WORKSPACE"
echo "::add-path::$(go env GOPATH)/bin" echo "::add-path::$(go env GOPATH)/bin"
echo "::set-env name=TOKEN_PRIVATE_KEY_PATH::${GITHUB_WORKSPACE}/tests/private_key.pem" echo "::set-env name=TOKEN_PRIVATE_KEY_PATH::${GITHUB_WORKSPACE}/src/github.com/goharbor/harbor/tests/private_key.pem"
shell: bash shell: bash
- name: before_install - name: before_install
run: | run: |
set -x set -x
cd src/github.com/goharbor/harbor
pwd pwd
env env
#sudo apt install -y xvfb #sudo apt install -y xvfb
@ -276,9 +293,10 @@ jobs:
- name: script - name: script
run: | run: |
echo IP: $IP echo IP: $IP
cd src/github.com/goharbor/harbor
bash ./tests/showtime.sh ./tests/travis/ui_ut_run.sh bash ./tests/showtime.sh ./tests/travis/ui_ut_run.sh
- name: Codecov For UI - name: Codecov For UI
uses: codecov/codecov-action@v1.0.5 uses: codecov/codecov-action@v1.0.5
with: with:
file: ./src/portal/coverage/lcov.info file: ./src/github.com/goharbor/harbor/src/portal/coverage/lcov.info
yml: ./.github/codecov-ut-config/codecov.yml yml: ./src/github.com/goharbor/harbor/.github/codecov-ut-config/codecov.yml

View File

@ -419,7 +419,7 @@ gosec:
$(GOPATH)/bin/gosec -fmt=json -out=harbor_gas_output.json -quiet ./... | true ; \ $(GOPATH)/bin/gosec -fmt=json -out=harbor_gas_output.json -quiet ./... | true ; \
fi fi
go_check: gen_apis misspell golint govet gofmt commentfmt go_check: gen_apis misspell gofmt commentfmt golint govet
gofmt: gofmt:
@echo checking gofmt... @echo checking gofmt...
@ -432,7 +432,7 @@ gofmt:
commentfmt: commentfmt:
@echo checking comment format... @echo checking comment format...
@res=$$(find . -type d \( -path ./src/vendor -o -path ./tests \) -prune -o -name '*.go' -print | xargs grep -P '(^|\s)\/\/(?!go:generate\s)(\S)'); \ @res=$$(find . -type d \( -path ./src/vendor -o -path ./tests \) -prune -o -name '*.go' -print | xargs egrep '(^|\s)\/\/(\S)'|grep -v '//go:generate'); \
if [ -n "$${res}" ]; then \ if [ -n "$${res}" ]; then \
echo checking comment format fail.. ; \ echo checking comment format fail.. ; \
echo missing whitespace between // and comment body;\ echo missing whitespace between // and comment body;\