Skip to content

[INCOMPTIBLE CHANGE] Refactor force-reconcile #918

[INCOMPTIBLE CHANGE] Refactor force-reconcile

[INCOMPTIBLE CHANGE] Refactor force-reconcile #918

Workflow file for this run

name: Run Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
check-generate:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Check that generated artifacts are up-to-date
run: |
make generate
echo "Running 'git status' ..."
git status --porcelain | tee status.out
if [[ -s status.out ]]; then
echo "Generated artifacts are not up-to-date; probably 'make generate' was not run before committing"
exit 1
else
echo "Generated artifacts are up-to-date"
fi
unit-and-integration-tests:
runs-on: ubuntu-24.04
needs: check-generate
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Run tests
run: |
make test
test-scaffold:
runs-on: ubuntu-24.04
needs:
- check-generate
- unit-and-integration-tests
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Build scaffold
run: |
LDFLAGS=""
LDFLAGS+=" -X \"github.com/sap/component-operator-runtime/internal/version.version=$(pwd)\""
LDFLAGS+=" -X \"github.com/sap/component-operator-runtime/internal/version.gitCommit=${{ github.sha }}\""
LDFLAGS+=" -X \"github.com/sap/component-operator-runtime/internal/version.gitTreeState=clean\""
go build -o bin/scaffold -ldflags "$LDFLAGS" ./scaffold
echo "Running 'scaffold --version' ..."
bin/scaffold --version
- name: Run scaffold (without admission webhooks)
run: |
rm -rf $RUNNER_TEMP/src
mkdir $RUNNER_TEMP/src
./bin/scaffold \
--group-name example.io \
--group-version v1alpha1 \
--kind MyComponent \
--operator-name mycomponent-operator.example.io \
--go-module example.io/mycomponent-operator \
--image mycomponent-operator:latest \
$RUNNER_TEMP/src
- name: Build generated operator (without admission webhooks)
run: |
cd $RUNNER_TEMP/src
make build
- name: Test generated operator (without admission webhooks)
run: |
cd $RUNNER_TEMP/src
make test
- name: Validate generation of typed client (without admission webhooks)
run: |
cd $RUNNER_TEMP/src
make generate-client
- name: Run scaffold (with admission webhooks)
run: |
rm -rf $RUNNER_TEMP/src
mkdir $RUNNER_TEMP/src
./bin/scaffold \
--group-name example.io \
--group-version v1alpha1 \
--kind MyComponent \
--with-validating-webhook \
--with-mutating-webhook \
--operator-name mycomponent-operator.example.io \
--go-module example.io/mycomponent-operator \
--image mycomponent-operator:latest \
$RUNNER_TEMP/src
- name: Build generated operator (with admission webhooks)
run: |
cd $RUNNER_TEMP/src
make build
- name: Test generated operator (with admission webhooks)
run: |
cd $RUNNER_TEMP/src
make test
- name: Validate generation of typed client (with admission webhooks)
run: |
cd $RUNNER_TEMP/src
make generate-client
# commented out until github runners have docker 23.0
# - name: Validate docker build
# run: |
# cd $RUNNER_TEMP/src
# make docker-build
test-clm:
runs-on: ubuntu-24.04
needs:
- check-generate
- unit-and-integration-tests
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Build clm
run: |
LDFLAGS=""
LDFLAGS+=" -X \"github.com/sap/component-operator-runtime/internal/version.version=$(pwd)\""
LDFLAGS+=" -X \"github.com/sap/component-operator-runtime/internal/version.gitCommit=${{ github.sha }}\""
LDFLAGS+=" -X \"github.com/sap/component-operator-runtime/internal/version.gitTreeState=clean\""
go build -o bin/clm -ldflags "$LDFLAGS" ./clm
echo "Running 'clm version -o json' ..."
bin/clm version -o json