Skip to content

WIP: Proposal: Configure merge_queue on the repository (to replace tide) #1500

WIP: Proposal: Configure merge_queue on the repository (to replace tide)

WIP: Proposal: Configure merge_queue on the repository (to replace tide) #1500

Workflow file for this run

name: ci
on:
pull_request:
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull-request.number || github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
permissions:
contents: read
checks: write # Used to annotate code in the PR
jobs:
changes:
name: categorize changes
runs-on: ubuntu-latest
outputs:
non-docs: ${{ steps.detect.outputs.non-docs }}
yaml: ${{ steps.detect.outputs.yaml }}
steps:
- name: Get base depth
id: base-depth
run: echo "base-depth=$(expr ${{ github.event.pull_request.commits }} + 1)" >> $GITHUB_OUTPUT
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: ${{ steps.base-depth.outputs.base-depth }}
- name: detect
id: detect
run: |
git fetch origin ${{ github.base_ref }}
CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }} | tr ' ' '\n')
echo -e "Changed files:\n${CHANGED_FILES}"
# If no files are changed at all, then `grep -v` will match even though no change outputs
# should be true. Skipping output on an empty set of changes eliminates the false positive
if [[ -n "${CHANGED_FILES}" ]]; then
echo "non-docs=$(echo \"${CHANGED_FILES}\" | grep -qv '**\.md' && echo 'true' )" | tee -a $GITHUB_OUTPUT
echo "yaml=$(echo \"${CHANGED_FILES}\" | grep -q '**\.ya\?ml' && echo 'true' )" | tee -a $GITHUB_OUTPUT
fi
build:
name: build
runs-on: ubuntu-latest
needs: [changes]
if: ${{ needs.changes.outputs.non-docs == 'true' }}
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version-file: "go.mod"
- name: build
run: |
go build -v ./...
buildFips:
name: buildFips
runs-on: ubuntu-latest
needs: [changes]
if: ${{ needs.changes.outputs.non-docs == 'true' }}
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version-file: "go.mod"
- name: build
run: |
go build -v -tags "disable_spire,disable_tls" ./cmd/entrypoint
echo "Build finished with exit code: $?"
linting:
name: lint
runs-on: ubuntu-latest
needs: [changes]
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version-file: "go.mod"
- name: gofmt
if: ${{ needs.changes.outputs.non-docs == 'true' }}
run: |
gofmt_out=$(gofmt -d $(find * -name '*.go' ! -path 'vendor/*' ! -path 'third_party/*'))
if [[ -n "$gofmt_out" ]]; then
failed=1
fi
echo "$gofmt_out"
- name: golangci-lint
uses: golangci/golangci-lint-action@0a35821d5c230e903fcfe077583637dea1b27b47 # v9.0.0
if: ${{ needs.changes.outputs.non-docs == 'true' }}
with:
version: v2.1.6
only-new-issues: true
args: --timeout=10m
- name: yamllint
if: ${{ needs.changes.outputs.yaml == 'true' }}
run: |
apt-get update && apt-get install -y yamllint
make yamllint
- name: check-license
if: ${{ needs.changes.outputs.non-docs == 'true' }}
run: |
go install github.com/google/[email protected]
go-licenses check ./...
tests:
needs: [build]
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version-file: "go.mod"
- name: unit-test
run: |
make test-unit-verbose-and-race
generated:
needs: [build]
name: Check generated code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version-file: "go.mod"
- name: generated
run: |
./hack/verify-codegen.sh
multi-arch-build:
needs: [build]
name: Multi-arch build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version-file: "go.mod"
- uses: ko-build/setup-ko@d006021bd0c28d1ce33a07e7943d48b079944c8d # v0.9
- name: ko-resolve
run: |
# Use the repository's .ko.yaml for consistent base images
KO_DOCKER_REPO=example.com ko resolve -l 'app.kubernetes.io/component!=resolvers' --platform=all --push=false -R -f config 1>/dev/null
KO_DOCKER_REPO=example.com ko resolve --platform=all --push=false -f config/resolvers 1>/dev/null
e2e-tests:
needs: [build]
uses: ./.github/workflows/e2e-matrix.yml

Check failure on line 151 in .github/workflows/ci.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/ci.yaml

Invalid workflow file

error parsing called workflow ".github/workflows/ci.yaml" -> "./.github/workflows/e2e-matrix.yml" : (Line: 24, Col: 9): Unrecognized named-value: 'matrix'. Located at position 21 within expression: !inputs.minimal || (matrix.os == 'ubuntu-latest' && matrix.k8s-name == 'k8s-latest' && matrix.feature-flags == 'stable')
with:
minimal: ${{ github.event_name == 'merge_group' }}