diff options
author | Andrea Barberio <insomniac@slackware.it> | 2021-03-14 22:36:51 +0000 |
---|---|---|
committer | insomniac <insomniacslk@users.noreply.github.com> | 2021-03-15 11:02:27 +0000 |
commit | c51060810aaab9c8a0bd1b0fcbf72bc0b91e6427 (patch) | |
tree | e4f267e63b5eb584ef34851f871abcb8e6a9af80 /.github/workflows | |
parent | 28f74147e2e808a9465553b4d92eea14371e7ce8 (diff) |
Switch to GitHub Actions
TravisCI not supported anymore.
Signed-off-by: Andrea Barberio <insomniac@slackware.it>
Diffstat (limited to '.github/workflows')
-rw-r--r-- | .github/workflows/lint.yml | 39 | ||||
-rw-r--r-- | .github/workflows/tests.yml | 70 |
2 files changed, 109 insertions, 0 deletions
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..fea79b9 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,39 @@ +name: Lint + +on: + push: + tags: + - v* + branches: + - master + pull_request: + +jobs: + golangci: + name: golangci-lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: golangci-lint + uses: golangci/golangci-lint-action@v2 + with: + version: latest + + # Optional: golangci-lint command line arguments. + # args: --issues-exit-code=0 + + # Optional: show only new issues if it's a pull request. The default value is `false`. + # only-new-issues: true + + # Optional: if set to true then the action will use pre-installed Go + # skip-go-installation: true +# checklicenses: +# name: checklicenses +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v2 +# - name: check license headers +# run: | +# set -exu +# go get -u github.com/u-root/u-root/tools/checklicenses +# $(go env GOPATH)/bin/checklicenses -c .ci/checklicenses_config.json diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..2777592 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,70 @@ +name: Tests + +on: [push, pull_request] + +jobs: + unit-tests: + runs-on: ubuntu-latest + strategy: + matrix: + go: ['1.13', '1.14', '1.15', '1.16'] + env: + GO111MODULE: on + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + stable: false + go-version: ${{ matrix.go }} + - name: run unit tests + run: | + go get -v -t ./... + echo "" > "${GITHUB_WORKSPACE}"/coverage.txt + for d in $(go list ./...); do + go test -v -race -coverprofile=profile.out -covermode=atomic "${d}" + if [ -f profile.out ]; then + cat profile.out >> "${GITHUB_WORKSPACE}"/coverage.txt + rm profile.out + fi + done + - name: report coverage to codecov + uses: codecov/codecov-action@v1 + with: + files: coverage.txt + flags: unittests + fail_ci_if_error: true + verbose: true + integration-tests: + runs-on: ubuntu-latest + strategy: + matrix: + go: ['1.13', '1.14', '1.15', '1.16'] + env: + GO111MODULE: on + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + stable: false + go-version: ${{ matrix.go }} + - name: run integ tests + run: | + go get -v -t -tags=integration ./... + echo "" > "${GITHUB_WORKSPACE}"/coverage.txt + for d in $(go list -tags=integration ./...); do + go test -c -tags=integration -v -race -coverprofile=profile.out -covermode=atomic "${d}" + testbin="./$(basename $d).test" + # only run it if it was built - i.e. if there are integ tests + test -x "${testbin}" && sudo "./${testbin}" + if [ -f profile.out ]; then + cat profile.out >> "${GITHUB_WORKSPACE}"/coverage.txt + rm profile.out + fi + done + - name: report coverage to codecov + uses: codecov/codecov-action@v1 + with: + files: coverage.txt + flags: integtests + fail_ci_if_error: true + verbose: true |