forked from oauth2-proxy/oauth2-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ci: migrate to Github Actions * ci: optimize on feedback * ci: run gocov in correct dir * ci: running after-build script always * ci: giving test script execute permission * ci: correct error handling on test script * ci: more verbose test script * ci: configure CC_TEST_REPORTER_ID env * ci: check existence of CC_TEST_REPORT_ID variable, skip if unset * ci: check existence of CC_TEST_REPORT_ID variable, skip if unset * update changelog * Update CHANGELOG.md Co-authored-by: Joel Speed <[email protected]>
- Loading branch information
1 parent
8be97f2
commit dc7dbc5
Showing
3 changed files
with
83 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Continuous Integration | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' | ||
# - $default-branch | ||
pull_request: | ||
branches: | ||
- '**' | ||
# - $default-branch | ||
|
||
jobs: | ||
build: | ||
env: | ||
COVER: true | ||
GOPATH: ${{ github.workspace }} | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
with: | ||
path: ./src/github.com/${{ github.repository }} | ||
|
||
- name: Set up Go 1.14 | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ^1.14 | ||
id: go | ||
|
||
- name: Get dependencies | ||
run: | | ||
cd src/github.com/${{ github.repository }} | ||
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $GOPATH/bin v1.24.0 | ||
GO111MODULE=on go mod download | ||
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter | ||
chmod +x ./cc-test-reporter | ||
- name: Lint | ||
run: | | ||
cd src/github.com/${{ github.repository }} | ||
make lint | ||
- name: Build | ||
run: | | ||
cd src/github.com/${{ github.repository }} | ||
make build | ||
- name: Test | ||
env: | ||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | ||
run: | | ||
cd src/github.com/${{ github.repository }} | ||
./test.sh |
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 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,27 @@ | ||
#!/bin/bash | ||
# manually exiting from script, because after-build needs to run always | ||
set +e | ||
|
||
if [ -z $CC_TEST_REPORT_ID ]; then | ||
echo "1. CC_TEST_REPORT_ID is unset, skipping" | ||
else | ||
echo "1. Running before-build" | ||
./cc-test-reporter before-build | ||
fi | ||
|
||
echo "2. Running test" | ||
make test | ||
TEST_STATUS=$? | ||
echo "TEST_STATUS: ${TEST_STATUS}" | ||
|
||
if [ -z $CC_TEST_REPORT_ID ]; then | ||
echo "3. CC_TEST_REPORT_ID is unset, skipping" | ||
else | ||
echo "3. Running after-build" | ||
./cc-test-reporter after-build --exit-code $TEST_STATUS -t gocov | ||
fi | ||
|
||
if [ "$TEST_STATUS" -ne 0 ]; then | ||
echo "Test failed, status code: $TEST_STATUS" | ||
exit $TEST_STATUS | ||
fi |