From f705d2b5d33ef7b18edc0716823454fcb548a55a Mon Sep 17 00:00:00 2001 From: Mitsuo Heijo Date: Thu, 8 Oct 2020 02:46:41 +0900 Subject: [PATCH] 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 --- .github/workflows/ci.yaml | 28 ++++++++++++++++------------ CHANGELOG.md | 1 + Dockerfile | 5 +---- Dockerfile.arm64 | 5 +---- Dockerfile.armv6 | 5 +---- Makefile | 2 +- 6 files changed, 21 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c5e63403..1b0d26c4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -14,42 +14,46 @@ jobs: build: env: COVER: true - GOPATH: ${{ github.workspace }} runs-on: ubuntu-18.04 steps: - - name: Check out code into the Go module directory + - name: Check out code 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 with: - go-version: ^1.14 + go-version: 1.15.x 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 -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.24.0 + 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 + + docker: + runs-on: ubuntu-18.04 + steps: + + - name: Check out code + uses: actions/checkout@v2 + + - name: Docker Build + run: | + make docker diff --git a/CHANGELOG.md b/CHANGELOG.md index d61f800f..62a9c5ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ - [#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) - [#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 diff --git a/Dockerfile b/Dockerfile index 310eec1f..a47a9ce0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,6 @@ FROM golang:1.15-buster AS builder 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 WORKDIR $GOPATH/src/github.com/oauth2-proxy/oauth2-proxy @@ -23,7 +20,7 @@ COPY . . RUN VERSION=${VERSION} make build && touch jwt_signing_key.pem # Copy binary to alpine -FROM alpine:3.11 +FROM alpine:3.12 COPY nsswitch.conf /etc/nsswitch.conf 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 diff --git a/Dockerfile.arm64 b/Dockerfile.arm64 index 4f7433f9..9b3b09aa 100644 --- a/Dockerfile.arm64 +++ b/Dockerfile.arm64 @@ -1,9 +1,6 @@ FROM golang:1.15-buster AS builder 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 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 # Copy binary to alpine -FROM arm64v8/alpine:3.11 +FROM arm64v8/alpine:3.12 COPY nsswitch.conf /etc/nsswitch.conf 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 diff --git a/Dockerfile.armv6 b/Dockerfile.armv6 index a69cf318..88bfd58a 100644 --- a/Dockerfile.armv6 +++ b/Dockerfile.armv6 @@ -1,9 +1,6 @@ FROM golang:1.15-buster AS builder 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 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 # Copy binary to alpine -FROM arm32v6/alpine:3.11 +FROM arm32v6/alpine:3.12 COPY nsswitch.conf /etc/nsswitch.conf 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 diff --git a/Makefile b/Makefile index 3b7ea3b4..05c85b86 100644 --- a/Makefile +++ b/Makefile @@ -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_MINOR_VERSION = $(shell $(GO) version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f2) 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) DOCKER_BUILD := docker build --build-arg VERSION=${VERSION}