Skip to content

Migrate CRDs from enterprise-contract/enterprise-contract-controller #4

Migrate CRDs from enterprise-contract/enterprise-contract-controller

Migrate CRDs from enterprise-contract/enterprise-contract-controller #4

Workflow file for this run

# Copyright The Conforma Contributors
#
# 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.
#
# SPDX-License-Identifier: Apache-2.0
---
name: CRD Validation
"on":
pull_request:
paths:
- "api/v1alpha1/**"
- "schema/**"
- "config/crd/**"
- "tools/crd/**"
- ".github/workflows/crd-schema.yaml"
push:
branches:
- main
paths:
- "api/v1alpha1/**"
- "schema/**"
- "config/crd/**"
- "tools/crd/**"
- ".github/workflows/crd-schema.yaml"
workflow_dispatch:
permissions:
contents: read
defaults:
run:
shell: bash
jobs:
crd-validation:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
with:
egress-policy: audit
disable-telemetry: true
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Go environment
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
with:
cache: true
go-version-file: go.mod
- name: Download CRD dependencies
run: |
(cd tools/crd && go mod download)
(cd api && go mod download)
(cd schema && go mod download)
- name: Generate CRD manifests
run: make crd-generate
- name: Test CRDs
run: make crd-test
- name: Generate CRD documentation
run: make crd-docs
- name: Export CRD Schema
run: make crd-export-schema
- name: Check for uncommitted changes
run: |
if ! git diff --exit-code -s; then
for f in $(git diff --exit-code --name-only); do
echo "::error file=$f,line=1,col=1,endColumn=1::CRD file was modified during build"
echo -e "\033[1;33mHint:\033[0m Maybe you need to run \033[1;32mmake crd-generate\033[0m or \033[1;32mmake crd-docs\033[0m"
done
exit 1
fi
- name: Upload generated artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: crd-artifacts
path: |
config/crd/bases/
docs/modules/ROOT/pages/crd-reference.adoc
dist/