Skip to content

Moved from self-hosted runners to Github runners #7117

Moved from self-hosted runners to Github runners

Moved from self-hosted runners to Github runners #7117

Workflow file for this run

# Copyright © 2021 - 2023 SUSE LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: CI
on:
workflow_dispatch:
push:
branches: [ main ]
paths-ignore:
- 'docs/**'
- 'README.md'
- '.goreleaser.yml'
pull_request:
branches: [ main ]
paths-ignore:
- 'docs/**'
- 'README.md'
- '.goreleaser.yml'
env:
SETUP_GO_VERSION: '1.20.4'
GOLANGCI_LINT_VERSION: v1.56
GINKGO_NODES: 8
INGRESS_CONTROLLER: traefik
jobs:
linter:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
timeout-minutes: 5
with:
cache: false
go-version: ${{ env.SETUP_GO_VERSION }}
- name: Setup Ginkgo Test Framework
run: go install github.com/onsi/ginkgo/v2/ginkgo@v2.11.0
- name: Lint Epinio
uses: golangci/golangci-lint-action@v4
timeout-minutes: 10
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
args: --timeout=10m --skip-files docs.go
skip-cache: true
- name: Unit Tests
run: make test
- uses: actions/upload-artifact@v3
with:
name: unittests
path: ./coverprofile.out
acceptance-cli:
needs:
- linter
- acceptance-cli-apps
runs-on: ubuntu-latest
env:
GOCOVERDIR: /tmp
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
with:
limit-access-to-actor: true
detached: true
- name: Setup Go
uses: actions/setup-go@v4
timeout-minutes: 5
with:
cache: false
go-version: ${{ env.SETUP_GO_VERSION }}
- name: Setup Ginkgo Test Framework
run: go install github.com/onsi/ginkgo/v2/ginkgo@v2.11.0
- name: Cache Tools
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/tools
key: ${{ runner.os }}-tools
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Install Tools
run: make tools-install
- name: Add Tools to PATH
run: |
echo "`pwd`/output/bin" >> $GITHUB_PATH
- name: Deploy k3d cluster with Epinio
env:
REGISTRY_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
REGISTRY_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
EPINIO_TIMEOUT_MULTIPLIER: 3
run: |
make acceptance-cluster-setup
export KUBECONFIG=$PWD/tmp/acceptance-kubeconfig
make install-cert-manager
make prepare_environment_k3d
- name: CLI Acceptance Tests
run: make test-acceptance-cli-other
- name: Dump logs
if: always()
run: |
export KUBECONFIG=$PWD/tmp/acceptance-kubeconfig
kubectl events -A >> ./logs.out || true
kubectl logs -n epinio -l 'app.kubernetes.io/name=epinio-server' >> ./logs.out || true
- name: Collect coverage
run: ./scripts/collect-coverage.sh
- uses: actions/upload-artifact@v3
with:
name: acceptance-cli
path: ./coverprofile.out
- uses: actions/upload-artifact@v3
if: always()
with:
name: acceptance-cli-logs
path: ./logs.out
- name: Cleanup k3d cluster
if: always()
run: make acceptance-cluster-delete
acceptance-cli-apps:
needs:
- linter
runs-on: ubuntu-latest
env:
GOCOVERDIR: /tmp
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
with:
limit-access-to-actor: true
detached: true
- name: Setup Go
uses: actions/setup-go@v4
timeout-minutes: 5
with:
cache: false
go-version: ${{ env.SETUP_GO_VERSION }}
- name: Setup Ginkgo Test Framework
run: go install github.com/onsi/ginkgo/v2/ginkgo@v2.11.0
- name: Cache Tools
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/tools
key: ${{ runner.os }}-tools
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Install Tools
run: make tools-install
- name: Add Tools to PATH
run: |
echo "`pwd`/output/bin" >> $GITHUB_PATH
- name: Deploy k3d cluster with Epinio
env:
REGISTRY_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
REGISTRY_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
EPINIO_TIMEOUT_MULTIPLIER: 3
run: |
make acceptance-cluster-setup
export KUBECONFIG=$PWD/tmp/acceptance-kubeconfig
make install-cert-manager
make prepare_environment_k3d
- name: CLI Apps Acceptance Tests
env:
REGISTRY_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
REGISTRY_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
PRIVATE_REPO_IMPORT_PAT: ${{ secrets.PRIVATE_REPO_IMPORT_PAT }}
run: |
export KUBECONFIG=$PWD/tmp/acceptance-kubeconfig
make test-acceptance-cli-apps
- name: Dump logs
if: always()
run: |
export KUBECONFIG=$PWD/tmp/acceptance-kubeconfig
kubectl events -A >> ./logs.out || true
kubectl logs -n epinio -l 'app.kubernetes.io/name=epinio-server' >> ./logs.out || true
- name: Collect coverage
run: ./scripts/collect-coverage.sh
- uses: actions/upload-artifact@v3
with:
name: acceptance-cli
path: ./coverprofile.out
- uses: actions/upload-artifact@v3
if: always()
with:
name: acceptance-cli-apps-logs
path: ./logs.out
- name: Cleanup k3d cluster
if: always()
run: make acceptance-cluster-delete
acceptance-cli-services:
needs:
- linter
- acceptance-cli-apps
runs-on: ubuntu-latest
env:
GOCOVERDIR: /tmp
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
with:
limit-access-to-actor: true
detached: true
- name: Setup Go
uses: actions/setup-go@v4
timeout-minutes: 5
with:
cache: false
go-version: ${{ env.SETUP_GO_VERSION }}
- name: Setup Ginkgo Test Framework
run: go install github.com/onsi/ginkgo/v2/ginkgo@v2.11.0
- name: Cache Tools
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/tools
key: ${{ runner.os }}-tools
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Install Tools
run: make tools-install
- name: Add Tools to PATH
run: |
echo "`pwd`/output/bin" >> $GITHUB_PATH
- name: Deploy k3d cluster with Epinio
env:
REGISTRY_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
REGISTRY_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
EPINIO_TIMEOUT_MULTIPLIER: 3
run: |
make acceptance-cluster-setup
export KUBECONFIG=$PWD/tmp/acceptance-kubeconfig
make install-cert-manager
make prepare_environment_k3d
- name: CLI Services Acceptance Tests
run: make test-acceptance-cli-services
- name: Collect coverage
run: ./scripts/collect-coverage.sh
- uses: actions/upload-artifact@v3
with:
name: acceptance-cli-services
path: ./coverprofile.out
- name: Cleanup k3d cluster
if: always()
run: make acceptance-cluster-delete
acceptance-api:
needs:
- linter
- acceptance-api-services
runs-on: ubuntu-latest
env:
GOCOVERDIR: /tmp
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
with:
limit-access-to-actor: true
detached: true
- name: Setup Go
uses: actions/setup-go@v4
timeout-minutes: 5
with:
cache: false
go-version: ${{ env.SETUP_GO_VERSION }}
- name: Setup Ginkgo Test Framework
run: go install github.com/onsi/ginkgo/v2/ginkgo@v2.11.0
- name: Cache Tools
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/tools
key: ${{ runner.os }}-tools
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Install Tools
run: make tools-install
- name: Add Tools to PATH
run: |
echo "`pwd`/output/bin" >> $GITHUB_PATH
- name: Deploy k3d cluster with Epinio
env:
REGISTRY_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
REGISTRY_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
EPINIO_TIMEOUT_MULTIPLIER: 3
run: |
make acceptance-cluster-setup
export KUBECONFIG=$PWD/tmp/acceptance-kubeconfig
make install-cert-manager
make prepare_environment_k3d
- name: API Acceptance Tests
run: make test-acceptance-api-other
- name: Collect coverage
run: ./scripts/collect-coverage.sh
- uses: actions/upload-artifact@v3
with:
name: acceptance-api
path: ./coverprofile.out
- name: Cleanup k3d cluster
if: always()
run: make acceptance-cluster-delete
acceptance-api-apps:
needs:
- linter
- acceptance-cli-services
runs-on: ubuntu-latest
env:
GOCOVERDIR: /tmp
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
with:
limit-access-to-actor: true
detached: true
- name: Setup Go
uses: actions/setup-go@v4
timeout-minutes: 5
with:
cache: false
go-version: ${{ env.SETUP_GO_VERSION }}
- name: Setup Ginkgo Test Framework
run: go install github.com/onsi/ginkgo/v2/ginkgo@v2.11.0
- name: Cache Tools
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/tools
key: ${{ runner.os }}-tools
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Install Tools
run: make tools-install
- name: Add Tools to PATH
run: |
echo "`pwd`/output/bin" >> $GITHUB_PATH
- name: Deploy k3d cluster with Epinio
env:
REGISTRY_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
REGISTRY_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
EPINIO_TIMEOUT_MULTIPLIER: 3
run: |
make acceptance-cluster-setup
export KUBECONFIG=$PWD/tmp/acceptance-kubeconfig
make install-cert-manager
make prepare_environment_k3d
- name: API Acceptance Tests
run: make test-acceptance-api-apps
- name: Collect coverage
run: ./scripts/collect-coverage.sh
- uses: actions/upload-artifact@v3
with:
name: acceptance-api-apps
path: ./coverprofile.out
- name: Cleanup k3d cluster
if: always()
run: make acceptance-cluster-delete
acceptance-api-cep-different-k8s:
needs:
- linter
- acceptance-cli-apps
runs-on: ubuntu-latest
env:
GOCOVERDIR: /tmp
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
with:
limit-access-to-actor: true
detached: true
- name: Setup Go
uses: actions/setup-go@v4
timeout-minutes: 5
with:
cache: false
go-version: ${{ env.SETUP_GO_VERSION }}
- name: Setup Ginkgo Test Framework
run: go install github.com/onsi/ginkgo/v2/ginkgo@v2.11.0
- name: Cache Tools
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/tools
key: ${{ runner.os }}-tools
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Install Tools
run: make tools-install
- name: Add Tools to PATH
run: |
echo "`pwd`/output/bin" >> $GITHUB_PATH
- name: Deploy k3d (with LATEST K3S) cluster with Epinio
env:
REGISTRY_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
REGISTRY_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
EPINIO_TIMEOUT_MULTIPLIER: 3
run: |
export K3S_KIND=latest
make acceptance-cluster-setup-several-k8s-versions
export KUBECONFIG=$PWD/tmp/acceptance-kubeconfig
make install-cert-manager
make prepare_environment_k3d
- name: API Acceptance Tests on LATEST K3S version
run: make test-acceptance-api-apps-critical-endpoints
- name: Collect coverage
run: ./scripts/collect-coverage.sh
- uses: actions/upload-artifact@v3
with:
name: acceptance-api-apps
path: ./coverprofile.out
- name: Cleanup k3d cluster
if: always()
run: make acceptance-cluster-delete
- name: Deploy k3d (with OLDEST K3S) cluster with Epinio
env:
REGISTRY_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
REGISTRY_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
EPINIO_TIMEOUT_MULTIPLIER: 3
run: |
export K3S_KIND=oldest
make acceptance-cluster-setup-several-k8s-versions
export KUBECONFIG=$PWD/tmp/acceptance-kubeconfig
make install-cert-manager
make prepare_environment_k3d
- name: API Acceptance Tests on OLDEST K3S version
run: make test-acceptance-api-apps-critical-endpoints
- name: Collect coverage
run: ./scripts/collect-coverage.sh
- uses: actions/upload-artifact@v3
with:
name: acceptance-api-apps
path: ./coverprofile.out
- name: Cleanup k3d cluster
if: always()
run: make acceptance-cluster-delete
acceptance-api-services:
needs:
- linter
- acceptance-cli-apps
runs-on: ubuntu-latest
env:
GOCOVERDIR: /tmp
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
with:
limit-access-to-actor: true
detached: true
- name: Setup Go
uses: actions/setup-go@v4
timeout-minutes: 5
with:
cache: false
go-version: ${{ env.SETUP_GO_VERSION }}
- name: Setup Ginkgo Test Framework
run: go install github.com/onsi/ginkgo/v2/ginkgo@v2.11.0
- name: Cache Tools
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/tools
key: ${{ runner.os }}-tools
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Install Tools
run: make tools-install
- name: Add Tools to PATH
run: |
echo "`pwd`/output/bin" >> $GITHUB_PATH
- name: Deploy k3d cluster with Epinio
env:
REGISTRY_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
REGISTRY_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
EPINIO_TIMEOUT_MULTIPLIER: 3
run: |
make acceptance-cluster-setup
export KUBECONFIG=$PWD/tmp/acceptance-kubeconfig
make install-cert-manager
make prepare_environment_k3d
- name: API Services Acceptance Tests
run: make test-acceptance-api-services
- name: Collect coverage
run: ./scripts/collect-coverage.sh
- uses: actions/upload-artifact@v3
with:
name: acceptance-api-services
path: ./coverprofile.out
- name: Cleanup k3d cluster
if: always()
run: make acceptance-cluster-delete
acceptance-apps:
needs:
- linter
- acceptance-cli
runs-on: ubuntu-latest
env:
GOCOVERDIR: /tmp
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
with:
limit-access-to-actor: true
detached: true
- name: Setup Go
uses: actions/setup-go@v4
timeout-minutes: 5
with:
cache: false
go-version: ${{ env.SETUP_GO_VERSION }}
- name: Setup Ginkgo Test Framework
run: go install github.com/onsi/ginkgo/v2/ginkgo@v2.11.0
- name: Cache Tools
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/tools
key: ${{ runner.os }}-tools
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Install Tools
run: make tools-install
- name: Add Tools to PATH
run: |
echo "`pwd`/output/bin" >> $GITHUB_PATH
- name: Deploy k3d cluster with Epinio
env:
REGISTRY_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
REGISTRY_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
EPINIO_TIMEOUT_MULTIPLIER: 3
run: |
make acceptance-cluster-setup
export KUBECONFIG=$PWD/tmp/acceptance-kubeconfig
make install-cert-manager
make prepare_environment_k3d
- name: Apps Acceptance Tests
run: make test-acceptance-apps
- name: Collect coverage
run: ./scripts/collect-coverage.sh
- uses: actions/upload-artifact@v3
with:
name: acceptance-apps
path: ./coverprofile.out
- name: Failure Logs
if: failure()
run: |
mkdir -p tmp
kubectl get -A pod,service,ingress -o json > tmp/cluster.json
kubectl get -A events > tmp/events.log
docker logs k3d-epinio-acceptance-server-0 &> tmp/k3s.log
docker exec k3d-epinio-acceptance-server-0 sh -c 'cd /var/log/containers; grep -r "." .' > tmp/containers.log
- name: Upload Logs
uses: actions/upload-artifact@v3
if: failure()
with:
name: acceptance-logs-${{ github.sha }}-${{ github.run_id }}
path: |
tmp/*.json
tmp/*.log
retention-days: 2
- name: Cleanup k3d cluster
if: always()
run: make acceptance-cluster-delete
upload-coverage:
needs:
- acceptance-api
- acceptance-api-apps
- acceptance-apps
- acceptance-cli-apps
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Upload unittests coverage to Codecov
uses: codecov/codecov-action@v3
with:
name: codecov-epinio
files: ./unittests/coverprofile.out
flags: unittests
verbose: true
fail_ci_if_error: true
- name: Upload acceptance-api coverage to Codecov
uses: codecov/codecov-action@v3
with:
name: codecov-epinio
files: ./acceptance-api/coverprofile.out,./acceptance-api-apps/coverprofile.out,./acceptance-api-services/coverprofile.out
flags: acceptance-api
verbose: true
fail_ci_if_error: true
- name: Upload acceptance-cli coverage to Codecov
uses: codecov/codecov-action@v3
with:
name: codecov-epinio
files: ./acceptance-cli/coverprofile.out,./acceptance-cli-apps/coverprofile.out,./acceptance-cli-services/coverprofile.out
flags: acceptance-cli
verbose: true
fail_ci_if_error: true
- name: Upload acceptance-apps coverage to Codecov
uses: codecov/codecov-action@v3
with:
name: codecov-epinio
files: ./acceptance-apps/coverprofile.out
flags: acceptance-apps
verbose: true
fail_ci_if_error: true