Skip to content

Commit

Permalink
add docker build and push to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Yusuf Kanchwala committed Jul 31, 2020
1 parent 4d2f837 commit 96cb4de
Showing 1 changed file with 32 additions and 10 deletions.
42 changes: 32 additions & 10 deletions .github/workflows/gobuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
push:
pull_request:
jobs:
build:
validate:
runs-on: ubuntu-latest
env:
GO111MODULE: on
Expand All @@ -12,22 +12,44 @@ jobs:
steps:
- name: Checkout Terrascan
uses: actions/checkout@v1

- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: 1.14

- name: Install golint
run: |
go get -u golang.org/x/lint/golint
run: go get -u golang.org/x/lint/golint

- name: Go validations
run: |
echo Workflow trigger - ${{ github.event_name }}
make validate
run: make validate

- name: Build Terrascan
run: |
make build
run: make build

- name: Run unit tests
run: |
make unit-tests
run: make unit-tests

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1

# push image to Docker Hub
push:
# Ensure "validate" job passes before pushing image.
needs: validate

runs-on: ubuntu-latest
if: github.event_name == 'push'

steps:
- name: Checkout Terrascan
uses: actions/checkout@v1

- name: Build Terrascan docker image
run: make docker-build

- name: Login to docker hub
run: echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u accurics --password-stdin

- name: Push Terrascan docker image
run: make docker-push

0 comments on commit 96cb4de

Please sign in to comment.