Skip to content

Commit

Permalink
Switch from Travis CI to Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
joelanford committed Jun 26, 2020
1 parent 82670d1 commit 997696e
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 15 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:

test:
name: Test
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.13
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Cache go module cache
id: cache-go-mod
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Get dependencies
run: go mod download

- name: Build
run: make build

- name: Lint
uses: golangci/golangci-lint-action@v1
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.27

- name: Test
run: make test

- uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: cover.out

deploy:
name: Deploy
needs: test
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Push helm-operator image to Quay
uses: docker/build-push-action@v1
with:
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
registry: quay.io
repository: joelanford/helm-operator
tags: master

- name: Push example nginx-operator image to Quay
uses: docker/build-push-action@v1
with:
path: example/
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
registry: quay.io
repository: joelanford/nginx-operator
tags: latest
10 changes: 0 additions & 10 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ COPY pkg/ pkg/
COPY version/ version/

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o helm-operator main.go

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot
WORKDIR /
COPY --from=builder /workspace/manager .
COPY --from=builder /workspace/helm-operator .
USER nonroot:nonroot

ENTRYPOINT ["/manager"]
ENTRYPOINT ["/helm-operator"]
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ test: fmt vet testbin
go test -race -covermode atomic -coverprofile cover.out ./...

# Build manager binary
manager: fmt vet
go build -o bin/manager main.go
build: fmt vet
go build -o bin/helm-operator main.go

# Run go fmt against code
fmt:
Expand Down

0 comments on commit 997696e

Please sign in to comment.