1
0
mirror of https://github.com/oauth2-proxy/oauth2-proxy.git synced 2024-11-28 09:08:44 +02:00

Improve CI (#819)

* simplify github actions workflow

no more GOPATH, update Go to 1.15.x

* add script to install golangci-lint

* drop support for Go 1.14

* check docker build in ci

* update alpine linux to 3.12

* update CHANGELOG

* fix golangci-lint installation

Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
This commit is contained in:
Mitsuo Heijo 2020-10-08 02:46:41 +09:00 committed by GitHub
parent a835fc5192
commit f705d2b5d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 25 deletions

View File

@ -14,42 +14,46 @@ jobs:
build: build:
env: env:
COVER: true COVER: true
GOPATH: ${{ github.workspace }}
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
steps: steps:
- name: Check out code into the Go module directory - name: Check out code
uses: actions/checkout@v2 uses: actions/checkout@v2
with:
path: ./src/github.com/${{ github.repository }}
- name: Set up Go 1.14 - name: Set up Go 1.15
uses: actions/setup-go@v2 uses: actions/setup-go@v2
with: with:
go-version: ^1.14 go-version: 1.15.x
id: go id: go
- name: Get dependencies - name: Get dependencies
run: | run: |
cd src/github.com/${{ github.repository }} curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.24.0
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $GOPATH/bin v1.24.0 go mod download
GO111MODULE=on go mod download
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter chmod +x ./cc-test-reporter
- name: Lint - name: Lint
run: | run: |
cd src/github.com/${{ github.repository }}
make lint make lint
- name: Build - name: Build
run: | run: |
cd src/github.com/${{ github.repository }}
make build make build
- name: Test - name: Test
env: env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: | run: |
cd src/github.com/${{ github.repository }}
./test.sh ./test.sh
docker:
runs-on: ubuntu-18.04
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Docker Build
run: |
make docker

View File

@ -39,6 +39,7 @@
- [#801](https://github.com/oauth2-proxy/oauth2-proxy/pull/801) Update go-redis/redis to v8 (@johejo) - [#801](https://github.com/oauth2-proxy/oauth2-proxy/pull/801) Update go-redis/redis to v8 (@johejo)
- [#750](https://github.com/oauth2-proxy/oauth2-proxy/pull/750) ci: Migrate to Github Actions (@shinebayar-g) - [#750](https://github.com/oauth2-proxy/oauth2-proxy/pull/750) ci: Migrate to Github Actions (@shinebayar-g)
- [#829](https://github.com/oauth2-proxy/oauth2-proxy/pull/820) Rename test directory to testdata (@johejo) - [#829](https://github.com/oauth2-proxy/oauth2-proxy/pull/820) Rename test directory to testdata (@johejo)
- [#819](https://github.com/oauth2-proxy/oauth2-proxy/pull/819) Improve CI (@johejo)
# v6.1.1 # v6.1.1

View File

@ -1,9 +1,6 @@
FROM golang:1.15-buster AS builder FROM golang:1.15-buster AS builder
ARG VERSION ARG VERSION
# Download tools
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.24.0
# Copy sources # Copy sources
WORKDIR $GOPATH/src/github.com/oauth2-proxy/oauth2-proxy WORKDIR $GOPATH/src/github.com/oauth2-proxy/oauth2-proxy
@ -23,7 +20,7 @@ COPY . .
RUN VERSION=${VERSION} make build && touch jwt_signing_key.pem RUN VERSION=${VERSION} make build && touch jwt_signing_key.pem
# Copy binary to alpine # Copy binary to alpine
FROM alpine:3.11 FROM alpine:3.12
COPY nsswitch.conf /etc/nsswitch.conf COPY nsswitch.conf /etc/nsswitch.conf
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /go/src/github.com/oauth2-proxy/oauth2-proxy/oauth2-proxy /bin/oauth2-proxy COPY --from=builder /go/src/github.com/oauth2-proxy/oauth2-proxy/oauth2-proxy /bin/oauth2-proxy

View File

@ -1,9 +1,6 @@
FROM golang:1.15-buster AS builder FROM golang:1.15-buster AS builder
ARG VERSION ARG VERSION
# Download tools
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.24.0
# Copy sources # Copy sources
WORKDIR $GOPATH/src/github.com/oauth2-proxy/oauth2-proxy WORKDIR $GOPATH/src/github.com/oauth2-proxy/oauth2-proxy
@ -23,7 +20,7 @@ COPY . .
RUN VERSION=${VERSION} GOARCH=arm64 make build && touch jwt_signing_key.pem RUN VERSION=${VERSION} GOARCH=arm64 make build && touch jwt_signing_key.pem
# Copy binary to alpine # Copy binary to alpine
FROM arm64v8/alpine:3.11 FROM arm64v8/alpine:3.12
COPY nsswitch.conf /etc/nsswitch.conf COPY nsswitch.conf /etc/nsswitch.conf
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /go/src/github.com/oauth2-proxy/oauth2-proxy/oauth2-proxy /bin/oauth2-proxy COPY --from=builder /go/src/github.com/oauth2-proxy/oauth2-proxy/oauth2-proxy /bin/oauth2-proxy

View File

@ -1,9 +1,6 @@
FROM golang:1.15-buster AS builder FROM golang:1.15-buster AS builder
ARG VERSION ARG VERSION
# Download tools
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.24.0
# Copy sources # Copy sources
WORKDIR $GOPATH/src/github.com/oauth2-proxy/oauth2-proxy WORKDIR $GOPATH/src/github.com/oauth2-proxy/oauth2-proxy
@ -23,7 +20,7 @@ COPY . .
RUN VERSION=${VERSION} GOARCH=arm GOARM=6 make build && touch jwt_signing_key.pem RUN VERSION=${VERSION} GOARCH=arm GOARM=6 make build && touch jwt_signing_key.pem
# Copy binary to alpine # Copy binary to alpine
FROM arm32v6/alpine:3.11 FROM arm32v6/alpine:3.12
COPY nsswitch.conf /etc/nsswitch.conf COPY nsswitch.conf /etc/nsswitch.conf
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /go/src/github.com/oauth2-proxy/oauth2-proxy/oauth2-proxy /bin/oauth2-proxy COPY --from=builder /go/src/github.com/oauth2-proxy/oauth2-proxy/oauth2-proxy /bin/oauth2-proxy

View File

@ -10,7 +10,7 @@ REGISTRY ?= quay.io/oauth2-proxy
GO_MAJOR_VERSION = $(shell $(GO) version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1) GO_MAJOR_VERSION = $(shell $(GO) version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1)
GO_MINOR_VERSION = $(shell $(GO) version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f2) GO_MINOR_VERSION = $(shell $(GO) version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f2)
MINIMUM_SUPPORTED_GO_MAJOR_VERSION = 1 MINIMUM_SUPPORTED_GO_MAJOR_VERSION = 1
MINIMUM_SUPPORTED_GO_MINOR_VERSION = 14 MINIMUM_SUPPORTED_GO_MINOR_VERSION = 15
GO_VERSION_VALIDATION_ERR_MSG = Golang version is not supported, please update to at least $(MINIMUM_SUPPORTED_GO_MAJOR_VERSION).$(MINIMUM_SUPPORTED_GO_MINOR_VERSION) GO_VERSION_VALIDATION_ERR_MSG = Golang version is not supported, please update to at least $(MINIMUM_SUPPORTED_GO_MAJOR_VERSION).$(MINIMUM_SUPPORTED_GO_MINOR_VERSION)
DOCKER_BUILD := docker build --build-arg VERSION=${VERSION} DOCKER_BUILD := docker build --build-arg VERSION=${VERSION}