analyze all expressions including those in function definitions for bad user function refs #267
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
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - release-* | |
| tags: | |
| - '*' | |
| pull_request: {} | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: Package version (e.g. v0.1.0) | |
| required: false | |
| env: | |
| # Common versions | |
| GO_VERSION: '1.25.4' | |
| GOLANGCI_VERSION: 'v2.6.2' | |
| DOCKER_BUILDX_VERSION: 'v0.23.0' | |
| # These environment variables are important to the Crossplane CLI install.sh | |
| # script. They determine what version it installs. | |
| # XP_CHANNEL: master # TODO(negz): Pin to stable once v1.14 is released. | |
| # XP_VERSION: current # TODO(negz): Pin to a version once v1.14 is released. | |
| # This CI job will automatically push new builds to xpkg.upbound.io if the | |
| # XPKG_ACCESS_ID and XPKG_TOKEN secrets are set in the GitHub respository (or | |
| # organization) settings. Create a token at https://accounts.upbound.io. | |
| XPKG_ACCESS_ID: ${{ secrets.XPKG_ACCESS_ID }} | |
| # The package to push, without a version tag. The default matches GitHub. For | |
| # example xpkg.upbound.io/crossplane/function-template-go. | |
| XPKG: xpkg.upbound.io/${{ github.repository}} | |
| CROSSPLANE_REGORG: ghcr.io/${{ github.repository}} # xpkg.crossplane.io/crossplane-contrib | |
| # The package version to push. The default is 0.0.0-gitsha. | |
| XPKG_VERSION: ${{ inputs.version }} | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-24.04 | |
| defaults: | |
| run: | |
| working-directory: function | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache: false # The golangci-lint action does its own caching. | |
| - name: Check go mod tidy | |
| run: go mod tidy && git diff --exit-code go.mod go.sum | |
| - name: Lint | |
| uses: golangci/golangci-lint-action@v7 | |
| with: | |
| version: ${{ env.GOLANGCI_VERSION }} | |
| working-directory: function | |
| unit-test: | |
| runs-on: ubuntu-24.04 | |
| defaults: | |
| run: | |
| working-directory: function | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Run Unit Tests | |
| run: go test -v -cover ./... | |
| lint-ls: | |
| runs-on: ubuntu-24.04 | |
| defaults: | |
| run: | |
| working-directory: language-server | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache: false | |
| - name: Check go mod tidy | |
| run: go mod tidy && git diff --exit-code go.mod go.sum | |
| - name: Lint | |
| uses: golangci/golangci-lint-action@v7 | |
| with: | |
| version: ${{ env.GOLANGCI_VERSION }} | |
| working-directory: language-server | |
| unit-test-ls: | |
| runs-on: ubuntu-24.04 | |
| defaults: | |
| run: | |
| working-directory: language-server | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Run Unit Tests | |
| run: go test -v -cover ./... | |
| build-vscode: | |
| runs-on: ubuntu-24.04 | |
| defaults: | |
| run: | |
| working-directory: vscode | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Install dependencies | |
| run: npm ci --ignore-scripts | |
| - name: Compile | |
| run: npm run compile | |
| build-jetbrains: | |
| runs-on: ubuntu-24.04 | |
| defaults: | |
| run: | |
| working-directory: jetbrains | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 21 | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Build and verify plugin | |
| run: ./gradlew build | |
| # We want to build most packages for the amd64 and arm64 architectures. To | |
| # speed this up we build single-platform packages in parallel. We then upload | |
| # those packages to GitHub as a build artifact. The push job downloads those | |
| # artifacts and pushes them as a single multi-platform package. | |
| build: | |
| runs-on: ubuntu-24.04 | |
| defaults: | |
| run: | |
| working-directory: function | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| arch: | |
| - amd64 | |
| - arm64 | |
| steps: | |
| - name: Setup QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| platforms: all | |
| - name: Setup Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| version: ${{ env.DOCKER_BUILDX_VERSION }} | |
| install: true | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: setup LDFLAGS | |
| run: | | |
| LDFLAGS="$(make ci-print-ldflags)" | |
| echo "LDFLAGS=${LDFLAGS}">>$GITHUB_ENV | |
| # We ask Docker to use GitHub Action's native caching support to speed up | |
| # the build, per https://docs.docker.com/build/cache/backends/gha/. | |
| - name: Build Runtime | |
| id: image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: function | |
| platforms: linux/${{ matrix.arch }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| target: image | |
| build-args: | | |
| GO_VERSION=${{ env.GO_VERSION }} | |
| LDFLAGS=${{ env.LDFLAGS }} | |
| outputs: type=docker,dest=runtime-${{ matrix.arch }}.tar | |
| - name: Setup the Crossplane CLI | |
| working-directory: . | |
| run: "curl -sL https://raw.githubusercontent.com/crossplane/crossplane/master/install.sh | sh" | |
| - name: remove examples from tree | |
| run: rm -rf examples/ | |
| - name: Build Package | |
| run: ../crossplane xpkg build --package-file=${{ matrix.arch }}.xpkg --package-root=package/ --embed-runtime-image-tarball=../runtime-${{ matrix.arch }}.tar | |
| - name: Upload Single-Platform Package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: package-${{ matrix.arch }} | |
| path: "function/*.xpkg" | |
| if-no-files-found: error | |
| retention-days: 1 | |
| # This job downloads the single-platform packages built by the build job, and | |
| # pushes them as a multi-platform package. We only push the package it the | |
| # XPKG_ACCESS_ID and XPKG_TOKEN secrets were provided. | |
| push: | |
| runs-on: ubuntu-24.04 | |
| needs: | |
| - lint | |
| - unit-test | |
| - lint-ls | |
| - unit-test-ls | |
| - build | |
| - build-vscode | |
| - build-jetbrains | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download Single-Platform Packages | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: . | |
| merge-multiple: true | |
| pattern: "!*.dockerbuild" # This gets uploaded by docker/build-push-action but must be skipped: https://github.com/actions/toolkit/pull/1874 | |
| - name: Setup the Crossplane CLI | |
| run: "curl -sL https://raw.githubusercontent.com/crossplane/crossplane/master/install.sh | sh" | |
| - name: Set Multi-Platform Package Version | |
| run: echo XPKG_VERSION=$(cd function;make ci-print-version) >> $GITHUB_ENV | |
| - name: Login to Upbound | |
| uses: docker/login-action@v3 | |
| if: env.XPKG_ACCESS_ID != '' | |
| with: | |
| registry: xpkg.upbound.io | |
| username: ${{ secrets.XPKG_ACCESS_ID }} | |
| password: ${{ secrets.XPKG_TOKEN }} | |
| - name: Push Multi-Platform Package to Upbound | |
| if: env.XPKG_ACCESS_ID != '' | |
| run: "./crossplane --verbose xpkg push --package-files $(echo *.xpkg|tr ' ' ,) ${{ env.XPKG }}:${{ env.XPKG_VERSION }}" | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3.3.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Push Multi-Platform Package to GHCR | |
| if: github.token != '' | |
| run: "./crossplane --verbose xpkg push --package-files $(echo *.xpkg|tr ' ' ,) ${{ env.CROSSPLANE_REGORG }}:${{ env.XPKG_VERSION }}" |