Skip to content

feat: new workload plugin version and controller-gen logic #204

feat: new workload plugin version and controller-gen logic

feat: new workload plugin version and controller-gen logic #204

Workflow file for this run

---
name: Test
on:
- pull_request
- push
jobs:
#
# unit testing
#
unit-test:
name: Unit Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# NOTE: we may test on multiple versions here when a future version of go releases, but
# for now we can leave this as a single array.
- go-version: "1.22"
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Run Test
uses: ./.github/common-actions/unit-test
#
# build and store artifact
#
build:
name: Build
runs-on: ubuntu-latest
needs: unit-test
strategy:
fail-fast: false
matrix:
include:
# NOTE: we may test on multiple versions here when a future version of go releases, but
# for now we can leave this as a single array.
- go-version: "1.22"
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Build Binary Artifact (operator-builder)
run: make build
- name: Store Artifact
uses: actions/upload-artifact@v4
with:
name: operator-builder-${{ matrix.go-version }}
path: bin/operator-builder
#
# functional test
#
functional-test:
name: Functional Test
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix:
include:
- name: Standalone Operator (Current Go Version)
artifact: standalone-codebase
test-workload-path: test/cases/standalone
go-version: "1.22"
binary-go-version: "1.22"
- name: Standalone Edge Cases Operator (Current Go Version - 1)
artifact: standalone-edge-codebase
test-workload-path: test/cases/edge-standalone
go-version: "1.21"
binary-go-version: "1.22"
- name: Workload Collection Operator (Current Go Version)
artifact: collection-codebase
test-workload-path: test/cases/collection
go-version: "1.22"
binary-go-version: "1.22"
- name: Workload Collection Edge Cases Operator (Current Go Version - 1)
artifact: collection-edge-codebase
test-workload-path: test/cases/edge-collection
go-version: "1.21"
binary-go-version: "1.22"
env:
TEST_WORKLOAD_PATH: "${{ matrix.test-workload-path }}"
TEST_PATH: "/tmp/operator-builder-func-test"
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download operator-builder Binary
uses: actions/download-artifact@v4
with:
name: operator-builder-${{ matrix.binary-go-version }}
path: bin
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Initialize ${{ matrix.name }} Codebase
run: |
chmod +x bin/operator-builder
make func-test-clean
# NOTE: do not rebuild the binary here since we just downloaded above
INIT_BUILD=false make func-test-init
- name: Create ${{ matrix.name }} Codebase
run: make func-test-create
- name: Store ${{ matrix.name }} Codebase
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: ${{ env.TEST_PATH }}
#
# e2e test
#
e2e-test:
name: E2E Test
runs-on: ubuntu-latest
needs: functional-test
if: github.event_name == 'pull_request'
strategy:
fail-fast: false
matrix:
include:
# NOTE: at this time we should only test the standalone CLI as the
# inputs to the collection CLI become much more complicated to test.
- name: Standalone Operator (Current Go Version)
artifact: standalone-codebase
test-build: "true"
test-deploy: "true"
go-version: "1.22"
- name: Standalone Edge Cases Operator (Current Go Version - 1)
artifact: standalone-edge-codebase
test-build: "false"
test-deploy: "false"
go-version: "1.21"
- name: Workload Collection Operator (Current Go Version)
artifact: collection-codebase
test-build: "true"
test-deploy: "false"
go-version: "1.22"
- name: Workload Collection Edge Cases Operator (Current Go Version - 1)
artifact: collection-edge-codebase
test-build: "true"
test-deploy: "false"
go-version: "1.21"
services:
registry:
image: registry:2
ports:
- 5000:5000
defaults:
run:
working-directory: /tmp/operator-builder-test
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Download ${{ matrix.name }} Codebase
uses: actions/download-artifact@v4
with:
name: ${{ matrix.artifact }}
path: /tmp/operator-builder-test
- name: Run E2E Tests
uses: ./.github/common-actions/e2e-test
with:
codebase-artifact: ${{ matrix.artifact }}
- name: Run CLI Integration Tests
uses: ./.github/common-actions/e2e-test-cli
with:
test-build: ${{ matrix.test-build }}
test-deploy: ${{ matrix.test-deploy }}