-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(CI): add nightly build & test tasks (#1006)
* feat(CI): add nightly build & test tasks Signed-off-by: Triple-Z <[email protected]> * chore(CI): add manual trigger Signed-off-by: Triple-Z <[email protected]> * chore(nightly): expand the lint timeout to 5m Signed-off-by: Triple-Z <[email protected]> * chore(CI): expand golangci-lint timeout to 5 mins Signed-off-by: Triple-Z <[email protected]> Signed-off-by: Triple-Z <[email protected]>
- Loading branch information
Showing
3 changed files
with
237 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,236 @@ | ||
name: nightly | ||
|
||
on: | ||
schedule: | ||
- cron: '0 2 * * *' # UTC 2:00 every day | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
lint: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.18 | ||
- uses: actions/checkout@v3 | ||
- name: Cache Go modules | ||
uses: actions/cache@preview | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.OS }}-build-${{ env.cache-name }}- | ||
${{ runner.OS }}-build- | ||
${{ runner.OS }}- | ||
- name: Add license | ||
run: | | ||
make addlicense && git add pkg cmd && | ||
git diff --cached --exit-code || (echo 'Please run "make addlicense" to verify govet' && exit 1); | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
args: --timeout=5m | ||
version: latest | ||
# Ref https://github.com/golangci/golangci-lint-action/issues/244 | ||
skip-pkg-cache: true | ||
test: | ||
name: test | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest ] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
- name: Setup Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.18 | ||
- name: Cache Go modules | ||
uses: actions/cache@preview | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.OS }}-build-${{ env.cache-name }}- | ||
${{ runner.OS }}-build- | ||
${{ runner.OS }}- | ||
- name: Verify mockgen | ||
run: | | ||
make generate && git add pkg && | ||
git diff --cached --exit-code || (echo 'Please run "make generate" to verify generate' && exit 1); | ||
- name: Test | ||
run: make test | ||
- name: Upload coverage report | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: coverage-out | ||
path: coverage.out | ||
e2e-cli: | ||
name: e2e-cli | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest ] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
- name: Setup Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.18 | ||
- name: Cache Go modules | ||
uses: actions/cache@preview | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.OS }}-build-${{ env.cache-name }}- | ||
${{ runner.OS }}-build- | ||
${{ runner.OS }}- | ||
- uses: actions-ecosystem/action-get-latest-tag@v1 | ||
id: get-latest-tag | ||
- name: e2e test | ||
run: make e2e-cli-test | ||
env: | ||
GIT_LATEST_TAG: ${{ steps.get-latest-tag.outputs.tag }} | ||
- name: Upload coverage report | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: e2e-cli-coverage-out | ||
path: e2e-cli-coverage.out | ||
e2e-lang: | ||
name: e2e-lang | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest ] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
- name: Setup Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.18 | ||
- name: Cache Go modules | ||
uses: actions/cache@preview | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.OS }}-build-${{ env.cache-name }}- | ||
${{ runner.OS }}-build- | ||
${{ runner.OS }}- | ||
- uses: actions-ecosystem/action-get-latest-tag@v1 | ||
id: get-latest-tag | ||
- name: e2e test | ||
run: make e2e-lang-test | ||
env: | ||
GIT_LATEST_TAG: ${{ steps.get-latest-tag.outputs.tag }} | ||
- name: Upload coverage report | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: e2e-lang-coverage-out | ||
path: e2e-lang-coverage.out | ||
# notifies that all test jobs are finished. | ||
report: | ||
needs: | ||
- test | ||
- e2e-cli | ||
- e2e-lang | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
- name: Setup Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.18 | ||
- name: Install bins | ||
run: | | ||
go install github.com/mattn/goveralls@latest | ||
go install github.com/wadey/gocovmerge@latest | ||
- name: Get coverage report | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: coverage-out | ||
path: coverage.out | ||
- name: Get cli e2e coverage report | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: e2e-cli-coverage-out | ||
path: e2e-cli-coverage.out | ||
- name: Get language e2e coverage report | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: e2e-lang-coverage-out | ||
path: e2e-lang-coverage.out | ||
# - name: Send coverage | ||
# env: | ||
# COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# run: | | ||
# gocovmerge e2e-coverage.out coverage.out > final.out | ||
# goveralls -coverprofile=final.out -service=github | ||
build: | ||
name: build | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest, macos-latest ] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
- name: Setup Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.18 | ||
- name: Cache Go modules | ||
uses: actions/cache@preview | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.OS }}-build-${{ env.cache-name }}- | ||
${{ runner.OS }}-build- | ||
${{ runner.OS }}- | ||
- name: Build | ||
run: make | ||
e2e-doc: | ||
name: e2e-doc | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
- name: Setup Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.18 | ||
- name: Cache Go modules | ||
uses: actions/cache@preview | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.OS }}-build-${{ env.cache-name }}- | ||
${{ runner.OS }}-build- | ||
${{ runner.OS }}- | ||
- uses: actions-ecosystem/action-get-latest-tag@v1 | ||
id: get-latest-tag | ||
- name: e2e doc test | ||
run: make e2e-doc-test | ||
env: | ||
GIT_LATEST_TAG: ${{ steps.get-latest-tag.outputs.tag }} | ||
- name: Upload coverage report | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: e2e-doc-coverage-out | ||
path: e2e-doc-coverage.out |