2021-01-30 20:26:46 +00:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2021-02-26 09:46:31 +00:00
|
|
|
branches: [ main ]
|
2021-06-29 12:29:35 +00:00
|
|
|
tags:
|
|
|
|
- "*"
|
2021-01-30 20:26:46 +00:00
|
|
|
pull_request:
|
|
|
|
schedule:
|
|
|
|
- cron: '0 0 * * *'
|
2021-02-08 18:49:07 +00:00
|
|
|
workflow_dispatch:
|
2021-01-30 20:26:46 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
2021-09-30 09:54:00 +00:00
|
|
|
vendor:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2021-09-30 15:26:50 +00:00
|
|
|
go-version: 1.17.1
|
2021-09-30 09:54:00 +00:00
|
|
|
- name: Vendor
|
|
|
|
run: |
|
|
|
|
make vendor
|
|
|
|
git diff --exit-code
|
|
|
|
|
2021-01-30 20:26:46 +00:00
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2021-09-30 15:26:50 +00:00
|
|
|
go-version: 1.17.1
|
2021-01-30 20:26:46 +00:00
|
|
|
- name: Build
|
|
|
|
run: make
|
|
|
|
|
2022-04-20 14:11:07 +00:00
|
|
|
docs:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
|
|
|
go-version: 1.17.1
|
|
|
|
- name: Build docs
|
|
|
|
run: |
|
|
|
|
make gen-docs
|
|
|
|
git diff --exit-code
|
|
|
|
|
2021-01-30 20:26:46 +00:00
|
|
|
linux:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2021-09-30 15:26:50 +00:00
|
|
|
go-version: 1.17.1
|
2021-01-30 20:26:46 +00:00
|
|
|
- name: Build kg and kgctl for all Linux Architectures
|
|
|
|
run: make all-build
|
|
|
|
|
|
|
|
darwin:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2021-09-30 15:26:50 +00:00
|
|
|
go-version: 1.17.1
|
2021-06-14 10:56:20 +00:00
|
|
|
- name: Build kgctl for Darwin amd64
|
|
|
|
run: make OS=darwin ARCH=amd64
|
|
|
|
- name: Build kgctl for Darwin arm64
|
|
|
|
run: make OS=darwin ARCH=arm64
|
2021-01-30 20:26:46 +00:00
|
|
|
|
|
|
|
windows:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2021-09-30 15:26:50 +00:00
|
|
|
go-version: 1.17.1
|
2021-01-30 20:26:46 +00:00
|
|
|
- name: Build kgctl for Windows
|
|
|
|
run: make OS=windows
|
|
|
|
|
|
|
|
unit:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2021-09-30 15:26:50 +00:00
|
|
|
go-version: 1.17.1
|
2021-01-30 20:26:46 +00:00
|
|
|
- name: Run Unit Tests
|
|
|
|
run: make unit
|
|
|
|
|
2021-05-20 08:38:11 +00:00
|
|
|
e2e:
|
|
|
|
if: github.event_name == 'pull_request'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2021-09-30 15:26:50 +00:00
|
|
|
go-version: 1.17.1
|
2021-05-20 08:38:11 +00:00
|
|
|
- name: Run e2e Tests
|
|
|
|
run: make e2e
|
|
|
|
|
2021-01-30 20:26:46 +00:00
|
|
|
lint:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2021-09-30 15:26:50 +00:00
|
|
|
go-version: 1.17.1
|
2021-01-30 20:26:46 +00:00
|
|
|
- name: Lint Code
|
|
|
|
run: make lint
|
|
|
|
|
|
|
|
container:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2021-09-30 15:26:50 +00:00
|
|
|
go-version: 1.17.1
|
2021-01-30 20:26:46 +00:00
|
|
|
- name: Enable Experimental Docker CLI
|
|
|
|
run: |
|
|
|
|
echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
|
|
|
|
mkdir -p ~/.docker
|
|
|
|
echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json
|
|
|
|
sudo service docker restart
|
|
|
|
docker version -f '{{.Client.Experimental}}'
|
|
|
|
docker version -f '{{.Server.Experimental}}'
|
|
|
|
docker buildx version
|
|
|
|
- name: Container
|
|
|
|
run: make container
|
|
|
|
|
|
|
|
push:
|
|
|
|
if: github.event_name != 'pull_request'
|
|
|
|
needs:
|
2021-09-30 09:54:00 +00:00
|
|
|
- vendor
|
2021-01-30 20:26:46 +00:00
|
|
|
- build
|
|
|
|
- linux
|
|
|
|
- darwin
|
|
|
|
- windows
|
|
|
|
- unit
|
|
|
|
- lint
|
|
|
|
- container
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2021-09-30 15:26:50 +00:00
|
|
|
go-version: 1.17.1
|
2021-01-30 20:26:46 +00:00
|
|
|
- name: Enable Experimental Docker CLI
|
|
|
|
run: |
|
|
|
|
echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
|
|
|
|
mkdir -p ~/.docker
|
|
|
|
echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json
|
|
|
|
sudo service docker restart
|
|
|
|
docker version -f '{{.Client.Experimental}}'
|
|
|
|
docker version -f '{{.Server.Experimental}}'
|
|
|
|
docker buildx version
|
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@master
|
|
|
|
with:
|
|
|
|
platforms: all
|
|
|
|
- name: Login to DockerHub
|
|
|
|
if: github.event_name != 'pull_request'
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Build and push
|
|
|
|
if: github.event_name != 'pull_request'
|
|
|
|
run: make manifest
|
|
|
|
- name: Build and push latest
|
2021-02-26 09:46:31 +00:00
|
|
|
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
|
2021-01-30 20:26:46 +00:00
|
|
|
run: make manifest-latest
|