2020-04-30 17:37:41 +02:00
|
|
|
name: Continuous integration
|
|
|
|
|
2020-09-28 12:29:59 +02:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2021-08-31 18:53:24 +02:00
|
|
|
- v2
|
2020-09-28 12:29:59 +02:00
|
|
|
pull_request:
|
2020-05-14 13:35:55 +02:00
|
|
|
|
2020-04-30 17:37:41 +02:00
|
|
|
jobs:
|
2020-05-14 13:35:55 +02:00
|
|
|
lint:
|
|
|
|
name: Lint
|
|
|
|
runs-on: ubuntu-latest
|
2020-05-14 22:13:35 +02:00
|
|
|
env:
|
|
|
|
GO111MODULE: "on"
|
2020-05-14 13:35:55 +02:00
|
|
|
steps:
|
2021-11-03 11:14:54 +01:00
|
|
|
- name: Set up Go 1.17
|
2021-02-17 17:51:14 +01:00
|
|
|
uses: actions/setup-go@v2
|
2020-05-14 22:13:35 +02:00
|
|
|
with:
|
2021-11-03 11:14:54 +01:00
|
|
|
go-version: 1.17
|
2020-05-14 22:13:35 +02:00
|
|
|
id: go
|
|
|
|
|
2020-05-14 13:35:55 +02:00
|
|
|
- name: Checkout code into the Go module directory
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2022-03-16 23:03:51 +01:00
|
|
|
- name: Validate go-mod, license headers and docs are up-to-date
|
2020-08-17 15:18:47 +02:00
|
|
|
run: make validate
|
|
|
|
|
2020-05-14 13:35:55 +02:00
|
|
|
- name: Run golangci-lint
|
2021-01-26 17:35:21 +01:00
|
|
|
env:
|
2021-08-31 18:53:24 +02:00
|
|
|
BUILD_TAGS: e2e
|
2022-02-17 18:01:46 +01:00
|
|
|
uses: golangci/golangci-lint-action@v2
|
|
|
|
with:
|
|
|
|
args: --timeout=180s
|
2020-05-14 22:13:35 +02:00
|
|
|
|
2021-02-26 11:31:35 +01:00
|
|
|
# only on main branch, costs too much for the gain on every PR
|
|
|
|
validate-cross-build:
|
2021-04-13 15:19:20 +02:00
|
|
|
name: Validate cross build
|
2021-02-26 11:31:35 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
if: github.ref == 'refs/heads/main'
|
|
|
|
env:
|
|
|
|
GO111MODULE: "on"
|
|
|
|
steps:
|
2021-11-03 11:14:54 +01:00
|
|
|
- name: Set up Go 1.17
|
2021-02-26 11:31:35 +01:00
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2021-11-03 11:14:54 +01:00
|
|
|
go-version: 1.17
|
2021-02-26 11:31:35 +01:00
|
|
|
id: go
|
|
|
|
|
|
|
|
- name: Checkout code into the Go module directory
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: go-${{ hashFiles('**/go.sum') }}
|
|
|
|
|
|
|
|
# Ensure we don't discover cross platform build issues at release time.
|
|
|
|
# Time used to build linux here is gained back in the build for local E2E step
|
|
|
|
- name: Build packages
|
2021-08-31 18:53:24 +02:00
|
|
|
run: make -f builder.Makefile cross
|
2021-02-26 11:31:35 +01:00
|
|
|
|
2021-12-09 10:30:05 +01:00
|
|
|
build-plugin:
|
|
|
|
name: Build and tests in plugin mode
|
2020-04-30 17:37:41 +02:00
|
|
|
runs-on: ubuntu-latest
|
2020-05-14 13:35:55 +02:00
|
|
|
env:
|
|
|
|
GO111MODULE: "on"
|
2020-04-30 17:37:41 +02:00
|
|
|
steps:
|
2021-11-03 11:14:54 +01:00
|
|
|
- name: Set up Go 1.17
|
2021-02-17 17:51:14 +01:00
|
|
|
uses: actions/setup-go@v2
|
2020-04-30 17:41:59 +02:00
|
|
|
with:
|
2021-11-03 11:14:54 +01:00
|
|
|
go-version: 1.17
|
2020-04-30 17:41:59 +02:00
|
|
|
id: go
|
2021-02-22 14:24:29 +01:00
|
|
|
|
2021-01-07 19:44:10 +01:00
|
|
|
- name: Setup docker CLI
|
|
|
|
run: |
|
2021-02-18 13:53:00 +01:00
|
|
|
curl https://download.docker.com/linux/static/stable/x86_64/docker-20.10.3.tgz | tar xz
|
2021-01-07 19:44:10 +01:00
|
|
|
sudo cp ./docker/docker /usr/bin/ && rm -rf docker && docker version
|
|
|
|
|
2020-04-30 17:41:59 +02:00
|
|
|
- name: Checkout code into the Go module directory
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2020-06-18 09:44:34 +02:00
|
|
|
- uses: actions/cache@v2
|
2020-05-14 13:35:55 +02:00
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
2020-06-18 09:44:34 +02:00
|
|
|
key: go-${{ hashFiles('**/go.sum') }}
|
2020-04-30 17:37:41 +02:00
|
|
|
|
2020-04-30 17:41:59 +02:00
|
|
|
- name: Test
|
2020-05-14 13:35:55 +02:00
|
|
|
run: make -f builder.Makefile test
|
|
|
|
|
2020-10-01 12:21:25 +02:00
|
|
|
- name: Build for local E2E
|
2020-06-15 17:41:59 +02:00
|
|
|
env:
|
2021-01-18 18:35:03 +01:00
|
|
|
BUILD_TAGS: e2e
|
2021-12-14 10:48:57 +01:00
|
|
|
run: make GIT_TAG=e2e-PR-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }} -f builder.Makefile compose-plugin
|
2020-05-04 15:10:28 +02:00
|
|
|
|
2021-12-09 10:30:05 +01:00
|
|
|
- name: E2E Test in plugin mode
|
2021-06-25 17:08:40 +02:00
|
|
|
run: make e2e-compose
|
2021-12-09 10:30:05 +01:00
|
|
|
|
|
|
|
build-standalone:
|
|
|
|
name: Build and tests in standalone mode
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
|
|
GO111MODULE: "on"
|
|
|
|
steps:
|
|
|
|
- name: Set up Go 1.17
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
|
|
|
go-version: 1.17
|
|
|
|
id: go
|
|
|
|
|
|
|
|
- name: Setup docker CLI
|
|
|
|
run: |
|
|
|
|
curl https://download.docker.com/linux/static/stable/x86_64/docker-20.10.3.tgz | tar xz
|
|
|
|
sudo cp ./docker/docker /usr/bin/ && rm -rf docker && docker version
|
|
|
|
|
|
|
|
- name: Checkout code into the Go module directory
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: go-${{ hashFiles('**/go.sum') }}
|
|
|
|
|
|
|
|
- name: Build for local E2E
|
|
|
|
env:
|
|
|
|
BUILD_TAGS: e2e
|
2021-12-14 10:48:57 +01:00
|
|
|
run: make GIT_TAG=e2e-PR-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }} -f builder.Makefile compose-plugin
|
2021-12-09 10:30:05 +01:00
|
|
|
|
|
|
|
- name: E2E Test in standalone mode
|
|
|
|
run: make e2e-compose-standalone
|