Merge pull request #1187 from crossplane-contrib/renovate/tj-actions-… #2745
This file contains hidden or 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
| # SPDX-FileCopyrightText: 2024 The Crossplane Authors <https://crossplane.io> | |
| # | |
| # SPDX-License-Identifier: CC0-1.0 | |
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - release-* | |
| pull_request: {} | |
| workflow_dispatch: {} | |
| jobs: | |
| detect-noop: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| noop: ${{ steps.noop.outputs.should_skip }} | |
| steps: | |
| - name: Detect No-op Changes | |
| id: noop | |
| uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf # v5.3.1 | |
| with: | |
| paths_ignore: '["**.md", "**.png", "**.jpg"]' | |
| do_not_skip: '["workflow_dispatch", "schedule", "push"]' | |
| report-breaking-changes: | |
| runs-on: ubuntu-latest | |
| needs: detect-noop | |
| if: needs.detect-noop.outputs.noop != 'true' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| submodules: true | |
| - name: Fetch base branch for PR | |
| if: github.event_name == 'pull_request' | |
| run: git fetch origin ${{ github.base_ref }}:${{ github.base_ref }} | |
| - name: Get modified CRDs | |
| id: modified-crds | |
| uses: tj-actions/changed-files@22103cc46bda19c2b464ffe86db46df6922fd323 # v47.0.5 | |
| with: | |
| files: | | |
| package/crds/** | |
| - name: Report breaking CRD OpenAPI v3 schema changes | |
| if: steps.modified-crds.outputs.any_changed == 'true' | |
| env: | |
| MODIFIED_CRD_LIST: ${{ steps.modified-crds.outputs.all_changed_files }} | |
| run: | | |
| make crddiff | |
| - name: Report native schema version changes | |
| run: | | |
| make schema-version-diff | |
| lint: | |
| runs-on: ${{ (github.repository_owner == 'crossplane-contrib' && 'oracle-vm-16cpu-64gb-x86-64' || 'Ubuntu-Jumbo-Runner') }} | |
| needs: detect-noop | |
| if: needs.detect-noop.outputs.noop != 'true' | |
| steps: | |
| - name: Cleanup Disk | |
| uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1 | |
| with: | |
| large-packages: false | |
| swap-storage: false | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| submodules: true | |
| - name: Setup Go | |
| uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version-file: go.mod | |
| - name: Find the Analysis Cache | |
| id: analysis_cache | |
| run: | | |
| echo "analysis_cache=$HOME/.cache/golangci-lint" >> $GITHUB_OUTPUT && \ | |
| echo "analysis_cache_key=$(make go.lint.analysiskey)" >> $GITHUB_OUTPUT && \ | |
| echo "analysis_cache_key_int=$(make go.lint.analysiskey-interval)" >> $GITHUB_OUTPUT | |
| - name: Cache Linter Analysis | |
| uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5 | |
| id: cache-analysis | |
| with: | |
| path: ${{ steps.analysis_cache.outputs.analysis_cache }} | |
| key: ${{ steps.analysis_cache.outputs.analysis_cache_key }} | |
| restore-keys: | | |
| ${{ steps.analysis_cache.outputs.analysis_cache_key_int }} | |
| - name: Vendor Dependencies | |
| run: make vendor vendor.check | |
| - name: Lint | |
| env: | |
| GOLANGCI_LINT_CACHE: ${{ steps.go_cache.outputs.analysis_cache }} | |
| SKIP_LINTER_ANALYSIS: false | |
| RUN_BUILDTAGGER: true | |
| GOGC: "50" | |
| run: make lint | |
| check-diff: | |
| runs-on: ubuntu-latest | |
| needs: detect-noop | |
| if: needs.detect-noop.outputs.noop != 'true' | |
| steps: | |
| - name: Cleanup Disk | |
| uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1 | |
| with: | |
| large-packages: false | |
| swap-storage: false | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| submodules: true | |
| - name: Setup Go | |
| uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version-file: go.mod | |
| - name: Install goimports | |
| run: go install golang.org/x/tools/cmd/goimports | |
| - name: Vendor Dependencies | |
| run: make vendor vendor.check | |
| - name: Check Diff | |
| id: check-diff | |
| run: | | |
| mkdir _output | |
| make check-diff | |
| env: | |
| # check-diff depends on the generate Make target, and we would like | |
| # to save a skipped resource list | |
| SKIPPED_RESOURCES_CSV: ../_output/skipped_resources.csv | |
| - name: Show diff | |
| if: failure() && steps.check-diff.outcome == 'failure' | |
| run: git diff | |
| - name: Report Statistics | |
| run: head -1 _output/skipped_resources.csv | |
| - name: Publish skipped resources CSV to Github | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: skipped_resources | |
| path: _output/skipped_resources.csv | |
| unit-tests: | |
| runs-on: ${{ (github.repository_owner == 'crossplane-contrib' && 'oracle-vm-16cpu-64gb-x86-64' || 'ubuntu-latest') }} | |
| needs: detect-noop | |
| if: needs.detect-noop.outputs.noop != 'true' | |
| steps: | |
| - name: Cleanup Disk | |
| uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1 | |
| with: | |
| large-packages: false | |
| swap-storage: false | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| submodules: true | |
| - name: Fetch History | |
| run: git fetch --prune --unshallow | |
| - name: Setup Go | |
| uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version-file: go.mod | |
| - name: Vendor Dependencies | |
| run: make vendor vendor.check | |
| - name: Run Unit Tests | |
| run: make -j2 test | |
| local-deploy: | |
| runs-on: ${{ (github.repository_owner == 'crossplane-contrib' && 'oracle-vm-16cpu-64gb-x86-64' || 'ubuntu-latest') }} | |
| needs: detect-noop | |
| if: needs.detect-noop.outputs.noop != 'true' | |
| steps: | |
| - name: Cleanup Disk | |
| uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1 | |
| with: | |
| large-packages: false | |
| swap-storage: false | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| submodules: true | |
| - name: Fetch History | |
| run: git fetch --prune --unshallow | |
| - name: Setup Go | |
| uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version-file: go.mod | |
| - name: Vendor Dependencies | |
| run: make vendor vendor.check | |
| - name: Deploying locally built provider package | |
| run: make local-deploy | |
| check-examples: | |
| runs-on: ubuntu-latest | |
| needs: detect-noop | |
| if: ${{ needs.detect-noop.outputs.noop != 'true' }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| submodules: true | |
| - name: Check Example Manifests | |
| run: | | |
| ./scripts/check-examples.py package/crds examples |