feat: basic implementation for inclusions #1169
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test and build | |
on: | |
push: | |
branches: | |
- "main" | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- "main" | |
jobs: | |
tests: | |
name: Test k8s ${{ matrix.k8s_version }} on os ${{matrix.os}} - go version ${{ matrix.go_version }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
go_version: ['1.22'] | |
os: [ubuntu-latest] | |
k8s_version: | |
- 'v1.30.0' | |
- 'v1.29.4' | |
- 'v1.28.9' | |
- 'v1.27.13' | |
- 'v1.26.15' | |
- 'v1.25.16' | |
- 'v1.24.17' | |
- 'v1.23.17' | |
env: | |
KIND_K8S_VERSION: ${{matrix.k8s_version}} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use golang ${{ matrix.go_version }} | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go_version }} | |
- name: docker version | |
run: docker version | |
- name: Go version | |
run: go version | |
- name: Go get dependencies | |
run: go get -v -t -d ./... | |
- name: Run lint | |
run: make lint | |
- name: Run tests with coverage | |
run: make coverage | |
- name: Vet and Build | |
run: make | |
- name: Send the coverage output | |
uses: shogo82148/actions-goveralls@v1 | |
with: | |
path-to-profile: cover.out | |
flag-name: go-${{matrix.go_version}}-k8s-${{matrix.k8s_version}} | |
parallel: true | |
finish: | |
needs: tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: shogo82148/actions-goveralls@v1 | |
with: | |
parallel-finished: true | |
e2e: | |
name: e2e test with kind | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use golang | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.22' | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Run tests | |
run: make e2e-test | |
chart: | |
name: Test Chart | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run tests | |
run: make chart-test | |
docker-build: | |
name: Build docker | |
needs: [tests, e2e] | |
runs-on: ubuntu-latest | |
if: ${{ startsWith(github.ref, 'refs/tags/') || github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/kube-green/kube-green | |
docker.io/kubegreen/kube-green | |
tags: | | |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} | |
type=semver,pattern={{version}} | |
flavor: | | |
latest=false | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Docker Login to ghcr.io | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Cache build | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.context }}build | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: '${{ env.context }}' | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
release-community-operators: | |
name: Release community operator | |
uses: ./.github/workflows/community-operators.yml | |
needs: docker-build | |
with: | |
community-operator-fork: kube-green/community-operators | |
community-operator-repo: k8s-operatorhub/community-operators | |
secrets: | |
PERSONAL_ACCESS_TOKEN: ${{ secrets.PAT_UPDATE_OPERATORS }} | |
release-community-operators-prod: | |
name: Release community operator prod | |
uses: ./.github/workflows/community-operators.yml | |
needs: docker-build | |
with: | |
community-operator-fork: kube-green/community-operators-prod | |
community-operator-repo: redhat-openshift-ecosystem/community-operators-prod | |
secrets: | |
PERSONAL_ACCESS_TOKEN: ${{ secrets.PAT_UPDATE_OPERATORS }} |