Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,29 @@ jobs:
component: ${{ matrix.component }}
cache_key: ${{ needs.flyteadmin-int-tests-image-build.outputs.cache_key }}

generate-filter:
name: Paths filter for generate
runs-on: ubuntu-latest
outputs:
generate: ${{ steps.filter.outputs.generate }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
generate:
- 'datacatalog/**'
- 'flyteadmin/**'
- 'flytecopilot/**'
- 'flytectl/**'
- 'flytepropeller/**'
- 'boilerplate/flyte/golang_test_targets/**'

generate:
name: Check Go Generate
needs: generate-filter
if: needs.generate-filter.outputs.generate == 'true'
strategy:
fail-fast: false
matrix:
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/flyteidl-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,21 @@ jobs:
component: flyteidl
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
generate-filter:
name: Paths filter for generate
runs-on: ubuntu-latest
outputs:
generate: ${{ steps.filter.outputs.generate }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
generate:
- 'flyteidl/**'
- 'boilerplate/flyte/golang_test_targets/**'

generate:
name: Check Go Generate
strategy:
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/go_generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,12 @@ jobs:
go-version-file: ${{ inputs.component }}/go.mod
- name: Go generate and diff
run: DELTA_CHECK=true make generate
- name: Verify idempotency (second run must not change anything)
run: |
make generate
if [ -n "$(git status --porcelain)" ]; then
echo "FAILED: make generate is not idempotent (second run produced changes)."
git diff --name-only
exit 1
fi
echo "SUCCESS: make generate is idempotent."
5 changes: 4 additions & 1 deletion boilerplate/flyte/golang_test_targets/go-gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ set -ex

echo "Running go generate"
go generate ./...
go mod tidy
# Only run go mod tidy when explicitly requested (avoids incidental go.sum/go.mod churn from make generate)
if [ -n "${RUN_GO_TIDY:-}" ]; then
go mod tidy
fi
# This section is used by GitHub workflow to ensure that the generation step was run
if [ -n "$DELTA_CHECK" ]; then
DIRTY=$(git status --porcelain)
Expand Down
2 changes: 1 addition & 1 deletion flyteidl/clients/go/assets/embed.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ import (

// AdminSwaggerFile is the admin.swagger.json file embedded into the binary.
//
//go:generate cp ../../../gen/pb-go/gateway/flyteidl/service/admin.swagger.json admin.swagger.json
//go:generate sh -c "cmp -s ../../../gen/pb-go/gateway/flyteidl/service/admin.swagger.json admin.swagger.json || cp ../../../gen/pb-go/gateway/flyteidl/service/admin.swagger.json admin.swagger.json"
//go:embed admin.swagger.json
var AdminSwaggerFile []byte
6 changes: 3 additions & 3 deletions flyteidl/generate_protos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ rm -rf $DIR/gen
# Override system locale during protos/docs generation to ensure consistent sorting (differences in system locale could e.g. lead to differently ordered docs)
export LC_ALL=C.UTF-8

# Buf migration
docker run -u $(id -u):$(id -g) -e "BUF_CACHE_DIR=/tmp/cache" --volume "$(pwd):/workspace" --workdir /workspace bufbuild/buf generate
# Buf migration (pinned to version tag for reproducible builds; use digest for stronger pinning)
docker run -u $(id -u):$(id -g) -e "BUF_CACHE_DIR=/tmp/cache" --volume "$(pwd):/workspace" --workdir /workspace bufbuild/buf:v1.65.0 generate

# Unfortunately the python protoc plugin does not add __init__.py files to the generated code
# (as described in https://github.com/protocolbuffers/protobuf/issues/881). One of the
# suggestions is to manually create such files, which is what we do here:
find gen/pb_python -type d -exec touch {}/__init__.py \;

# Generate JS code
# Generate JS code (pinned to version tag for reproducible builds)
docker run --rm -u $(id -u):$(id -g) -v $DIR:/defs schottra/docker-protobufjs:v0.0.2 --module-name flyteidl -d protos/flyteidl/core -d protos/flyteidl/event -d protos/flyteidl/admin -d protos/flyteidl/service -- --root flyteidl -t static-module -w default --no-delimited --force-long --no-convert -p /defs/protos

# This section is used by Travis CI to ensure that the generation step was run
Expand Down
Loading