Skip to content

⭐ gitlab: add protectedEnvironments, integrations, and personal acces… #20209

⭐ gitlab: add protectedEnvironments, integrations, and personal acces…

⭐ gitlab: add protectedEnvironments, integrations, and personal acces… #20209

name: Generated Code Test
## Only trigger tests if source is changing
on:
push:
paths:
- "**.proto"
- "**.lr"
- "**.go"
env:
PROTO_VERSION: "21.7"
concurrency:
group: pr-test-generated-files-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
permissions:
contents: read
jobs:
# Check if there is any dirty change for generated files
generated-files:
runs-on:
group: Default
steps:
- name: Checkout code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
- name: Import environment variables from file
run: cat ".github/env" >> $GITHUB_ENV
- name: Install Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: ">=${{ env.golang-version }}"
check-latest: true
cache: false
# We do not permit sudo on self-hosted runners
- name: "Ensure GCC is installed"
run: |
if gcc --version; then
echo "Good to go";
else
echo "Install GCC on the runner.";
fi
# Note we do not use apt install -y protobuf-compiler` since it is too old
- name: Install Protoc
uses: ./.github/actions/setup-protoc
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: ${{ env.protoc-version }}
- name: Determine changed providers
id: changed
env:
# Empty on push events (this workflow only triggers on push);
# scripts/changed-providers.sh falls back to merge-base with origin/main.
BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: bash scripts/changed-providers.sh
- name: Check generated files
env:
ALL_PROVIDERS: ${{ steps.changed.outputs.all }}
CHANGED_PROVIDERS: ${{ steps.changed.outputs.providers }}
run: |
set -euo pipefail
protoc --version
make prep
# Run all non-provider code generators (these are cheap relative to
# the per-provider work and may affect non-provider source files).
make clean/proto llx/generate shared/generate sbom/generate reporter/generate
# Provider plumbing that every provider relies on.
make providers/proto providers/config providers/lr
# Regenerate provider sources. Skip compile — we only need .lr.go,
# .lr.json, .resources.json to validate against the committed copies.
if [ "$ALL_PROVIDERS" = "true" ] || [ -z "$CHANGED_PROVIDERS" ]; then
echo "--> regenerating all providers"
SKIP_COMPILE=yes make providers/build
else
echo "--> regenerating changed providers: $CHANGED_PROVIDERS"
targets="providers/build/mock providers/build/core"
for p in $CHANGED_PROVIDERS; do
targets="$targets providers/build/$p"
done
SKIP_COMPILE=yes make $targets
fi
git diff --exit-code *.go
git diff --exit-code providers/**/*.lr.json
git diff --exit-code providers/**/*.lr.go
git diff --exit-code providers/**/*.resources.json