1
0
mirror of https://github.com/oauth2-proxy/oauth2-proxy.git synced 2025-02-09 13:46:51 +02:00

ci: migrate to Github Actions, close #546 (#750)

* 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 <Joel.speed@hotmail.co.uk>
This commit is contained in:
Shinebayar G 2020-10-05 04:29:47 -05:00 committed by GitHub
parent 8be97f25e7
commit dc7dbc5d28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 83 additions and 0 deletions

55
.github/workflows/ci.yaml vendored Normal file
View File

@ -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

View File

@ -31,6 +31,7 @@
- [#800](https://github.com/oauth2-proxy/oauth2-proxy/pull/800) Fix import path for v7 (@johejo)
- [#783](https://github.com/oauth2-proxy/oauth2-proxy/pull/783) Update Go to 1.15 (@johejo)
- [#813](https://github.com/oauth2-proxy/oauth2-proxy/pull/813) Fix build (@thiagocaiubi)
- [#750](https://github.com/oauth2-proxy/oauth2-proxy/pull/750) ci: Migrate to Github Actions (@shinebayar-g)
# v6.1.1

27
test.sh Executable file
View File

@ -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