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:
|
2022-03-28 14:38:27 +02:00
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
debug_enabled:
|
|
|
|
description: 'To run with tmate enter "debug_enabled"'
|
|
|
|
required: false
|
|
|
|
default: "false"
|
2022-07-25 23:20:35 +02:00
|
|
|
env:
|
2022-08-02 19:39:42 +02:00
|
|
|
GO_VERSION: 1.18.5
|
2022-08-05 10:07:59 +02:00
|
|
|
DOCKER_CLI_VERSION: 20.10.17
|
2020-04-30 17:37:41 +02:00
|
|
|
jobs:
|
2020-05-14 13:35:55 +02:00
|
|
|
lint:
|
|
|
|
name: Lint
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout code into the Go module directory
|
2022-07-25 23:20:35 +02:00
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Set up Go ${{ env.GO_VERSION }}
|
|
|
|
uses: actions/setup-go@v3
|
|
|
|
with:
|
|
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
cache: true
|
2020-05-14 13:35:55 +02:00
|
|
|
|
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-08-05 10:27:32 +02:00
|
|
|
uses: golangci/golangci-lint-action@v3
|
2022-02-17 18:01:46 +01:00
|
|
|
with:
|
2022-08-05 10:27:32 +02:00
|
|
|
version: v1.47.3
|
2022-02-17 18:01:46 +01:00
|
|
|
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'
|
|
|
|
steps:
|
|
|
|
- name: Checkout code into the Go module directory
|
2022-07-25 23:20:35 +02:00
|
|
|
uses: actions/checkout@v3
|
2021-02-26 11:31:35 +01:00
|
|
|
|
2022-07-25 23:20:35 +02:00
|
|
|
- name: Set up Go ${{ env.GO_VERSION }}
|
|
|
|
uses: actions/setup-go@v3
|
2021-02-26 11:31:35 +01:00
|
|
|
with:
|
2022-07-25 23:20:35 +02:00
|
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
cache: true
|
2021-02-26 11:31:35 +01:00
|
|
|
|
|
|
|
# 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
|
|
|
|
steps:
|
2022-07-25 23:20:35 +02:00
|
|
|
- name: Checkout code into the Go module directory
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Set up Go ${{ env.GO_VERSION }}
|
|
|
|
uses: actions/setup-go@v3
|
2020-04-30 17:41:59 +02:00
|
|
|
with:
|
2022-07-25 23:20:35 +02:00
|
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
cache: true
|
2021-02-22 14:24:29 +01:00
|
|
|
|
2021-01-07 19:44:10 +01:00
|
|
|
- name: Setup docker CLI
|
|
|
|
run: |
|
2022-08-05 10:07:59 +02:00
|
|
|
curl https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_CLI_VERSION}.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: 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
|
|
|
|
steps:
|
2022-07-25 23:20:35 +02:00
|
|
|
- name: Checkout code into the Go module directory
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Set up Go ${{ env.GO_VERSION }}
|
|
|
|
uses: actions/setup-go@v3
|
2021-12-09 10:30:05 +01:00
|
|
|
with:
|
2022-07-25 23:20:35 +02:00
|
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
cache: true
|
2021-12-09 10:30:05 +01:00
|
|
|
|
|
|
|
- name: Setup docker CLI
|
|
|
|
run: |
|
2022-08-05 10:07:59 +02:00
|
|
|
curl https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_CLI_VERSION}.tgz | tar xz
|
2021-12-09 10:30:05 +01:00
|
|
|
sudo cp ./docker/docker /usr/bin/ && rm -rf docker && docker version
|
|
|
|
|
|
|
|
- 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
|
|
|
|
2022-03-28 14:38:27 +02:00
|
|
|
- name: Setup tmate session
|
|
|
|
uses: mxschmitt/action-tmate@v3
|
|
|
|
with:
|
|
|
|
limit-access-to-actor: true
|
|
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
|
|
|
|
|
2021-12-09 10:30:05 +01:00
|
|
|
- name: E2E Test in standalone mode
|
2022-05-20 21:31:16 +02:00
|
|
|
run: |
|
|
|
|
rm -f /usr/local/bin/docker-compose
|
|
|
|
cp bin/docker-compose /usr/local/bin
|
|
|
|
make e2e-compose-standalone
|