2020-07-17 21:59:51 +00:00
|
|
|
name: Main CI
|
2020-05-27 23:34:12 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2020-07-17 21:59:51 +00:00
|
|
|
branches: [ main ]
|
2020-05-27 23:34:12 +00:00
|
|
|
tags:
|
|
|
|
- '*'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
|
|
|
build:
|
|
|
|
name: Build
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
|
2020-10-13 19:42:06 +00:00
|
|
|
- name: Set up Go
|
2020-05-27 23:34:12 +00:00
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2020-10-13 19:42:06 +00:00
|
|
|
go-version: 1.15
|
2020-05-27 23:34:12 +00:00
|
|
|
id: go
|
|
|
|
|
|
|
|
- name: Check out code into the Go module directory
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2020-11-30 19:19:07 +00:00
|
|
|
- name: Set up QEMU
|
|
|
|
id: qemu
|
|
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
with:
|
|
|
|
platforms: all
|
|
|
|
|
2020-08-04 18:40:05 +00:00
|
|
|
- name: Set up Docker Buildx
|
|
|
|
id: buildx
|
2020-11-30 19:19:07 +00:00
|
|
|
uses: docker/setup-buildx-action@v1
|
2020-08-04 18:40:05 +00:00
|
|
|
with:
|
2020-11-30 19:19:07 +00:00
|
|
|
version: latest
|
2020-08-04 18:40:05 +00:00
|
|
|
|
2020-05-27 23:34:12 +00:00
|
|
|
- name: Build
|
|
|
|
run: make local
|
|
|
|
|
|
|
|
- name: Test
|
|
|
|
run: make test
|
|
|
|
|
2020-09-22 22:04:50 +00:00
|
|
|
# Only try to publish the container image from the root repo; forks don't have permission to do so and will always get failures.
|
2020-11-30 19:19:07 +00:00
|
|
|
- name: Login to DockerHub
|
|
|
|
if: github.repository == 'vmware-tanzu/velero'
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USER }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
|
|
|
|
2020-05-27 23:34:12 +00:00
|
|
|
- name: Publish container image
|
2020-09-22 22:04:50 +00:00
|
|
|
if: github.repository == 'vmware-tanzu/velero'
|
2020-11-30 19:19:07 +00:00
|
|
|
run: ./hack/docker-push.sh
|