Repository navigation
[WIP] Add Java conformance runner for the types surface #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
nssalian
wants to merge
1
commit into
apache:main
Choose a base branch
from
nssalian:runners
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,450
−1
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| <!-- | ||
| ~ Licensed to the Apache Software Foundation (ASF) under one | ||
| ~ or more contributor license agreements. See the NOTICE file | ||
| ~ distributed with this work for additional information | ||
| ~ regarding copyright ownership. The ASF licenses this file | ||
| ~ to you under the Apache License, Version 2.0 (the | ||
| ~ "License"); you may not use this file except in compliance | ||
| ~ with the License. You may obtain a copy of the License at | ||
| ~ | ||
| ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
| ~ | ||
| ~ Unless required by applicable law or agreed to in writing, | ||
| ~ software distributed under the License is distributed on an | ||
| ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| ~ KIND, either express or implied. See the License for the | ||
| ~ specific language governing permissions and limitations | ||
| ~ under the License. | ||
| --> | ||
|
|
||
| # Type-surface conformance status | ||
|
|
||
| Generated by `dev/build-status-matrix.py` from the type-surface runners | ||
| (`table-spec/types/`). It reports; it does not block: | ||
|
|
||
| - **PASS** - matches the spec-derived fixture. | ||
| - **FAIL** - a genuine divergence from the spec-derived fixture. | ||
| - **UNSUPPORTED** - a type the implementation has not built yet (a skip-list candidate). | ||
|
|
||
|
|
||
| | Implementation | Pass | Fail | Unsupported | Skip | Status | | ||
| |---|---|---|---|---|---| | ||
|
|
||
| ## Divergences and gaps | ||
|
|
||
| None reported. | ||
|
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| name: "Conformance (Java)" | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }} | ||
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| build: | ||
| name: build ${{ matrix.os }} | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| max-parallel: 15 | ||
| fail-fast: false | ||
| matrix: | ||
| os: | ||
| - 'ubuntu-latest' | ||
| - 'macos-latest' | ||
| steps: | ||
| - name: Checkout fixtures | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Check runner deps are release-clean | ||
| run: bash dev/check-runner-deps.sh | ||
| - name: Install Java | ||
| uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0 | ||
| with: | ||
| distribution: zulu | ||
| java-version: '17' | ||
| - name: Set up Gradle | ||
| uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0 | ||
| - name: Format check and grader self-test | ||
| working-directory: runners/java | ||
| run: ./gradlew spotlessCheck test | ||
|
|
||
| conformance-java: | ||
| name: iceberg-java type conformance ${{ matrix.os }} | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: | ||
| - 'ubuntu-latest' | ||
| - 'macos-latest' | ||
| # Advisory: never blocks this repo's CI (tracks a moving upstream SNAPSHOT). | ||
| continue-on-error: true | ||
| steps: | ||
| - name: Checkout fixtures | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Install Java | ||
| uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0 | ||
| with: | ||
| distribution: zulu | ||
| java-version: '17' | ||
| - name: Set up Gradle | ||
| uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0 | ||
| - name: Run type conformance | ||
| id: run | ||
| working-directory: runners/java | ||
| run: | | ||
| set +e | ||
| meta="https://repository.apache.org/content/repositories/snapshots/org/apache/iceberg/iceberg-api/maven-metadata.xml" | ||
| version="$(curl -fsSL "$meta" | grep -o '<latest>[^<]*</latest>' | sed -e 's/<[^>]*>//g' | head -1)" | ||
| if [ -z "$version" ]; then | ||
| version="1.12.0-SNAPSHOT" | ||
| echo "WARN: could not resolve latest SNAPSHOT from $meta; using fallback $version" >&2 | ||
| fi | ||
| echo "resolved=iceberg-api:$version" >> "$GITHUB_OUTPUT" | ||
| if ./gradlew installDist --quiet -PicebergVersion="$version"; then | ||
| build/install/conformance-java/bin/conformance-java --surface types 2>&1 | tee "$GITHUB_WORKSPACE/runner-output.txt" | ||
| code=${PIPESTATUS[0]} | ||
| else | ||
| code=2 | ||
| fi | ||
| echo "code=$code" >> "$GITHUB_OUTPUT" | ||
| - name: Report results (step summary + annotations) | ||
| if: always() | ||
| env: | ||
| RUN_CODE: ${{ steps.run.outputs.code }} | ||
| RUN_RESOLVED: ${{ steps.run.outputs.resolved }} | ||
| run: > | ||
| bash "$GITHUB_WORKSPACE/dev/ci-report.sh" | ||
| iceberg-java "$GITHUB_WORKSPACE/runner-output.txt" | ||
| snapshot "$RUN_CODE" | ||
| "$RUN_RESOLVED" |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
| # | ||
| # Fail if a committed runner dependency file carries a local source override. | ||
| set -uo pipefail | ||
| root="$(cd "$(dirname "$0")/.." && pwd)" | ||
| fail=0 | ||
|
|
||
| check() { # <file> <extended-regex> <message> | ||
| hits="$(grep -nE "$2" "$root/$1" 2>/dev/null)" | ||
| if [ -n "$hits" ]; then | ||
| echo "FAIL: $1 - $3" | ||
| printf '%s\n' "$hits" | sed 's/^/ /' | ||
| fail=1 | ||
| fi | ||
| } | ||
|
|
||
| check runners/java/build.gradle 'mavenLocal|includeBuild' "committed local build reference - leaked" | ||
| check runners/java/settings.gradle 'includeBuild' "committed composite-build reference - leaked" | ||
|
|
||
| if [ "$fail" -eq 0 ]; then | ||
| echo "runner deps are release-clean" | ||
| else | ||
| exit 1 | ||
| fi |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
| # | ||
| # Render a runner's exit code and output to the CI step summary and annotations. | ||
| # Usage: ci-report.sh <impl> <runner-output-file> <lane> <exit-code> [<resolved-version>] | ||
| set -uo pipefail | ||
|
|
||
| impl="${1:?usage: ci-report.sh <impl> <out> <lane> <exit-code> [<resolved>]}" | ||
| out="${2:?usage: ci-report.sh <impl> <out> <lane> <exit-code> [<resolved>]}" | ||
| lane="${3:-release}" | ||
| # Missing code = the run step was skipped; default to ERROR, never PASS. | ||
| code="${4:-2}" | ||
| resolved="${5:-unknown}" | ||
|
|
||
| totals="$(grep -m1 '^TOTALS:' "$out" 2>/dev/null || echo 'TOTALS: (runner produced no summary - see the step log)')" | ||
| fails="$(grep -m1 '^FAIL ids:' "$out" 2>/dev/null || true)" | ||
| advisory="$(grep -m1 '^ADVISORY_FAIL ids:' "$out" 2>/dev/null || true)" | ||
| skip="$(grep -m1 '^SKIP ids:' "$out" 2>/dev/null || true)" | ||
|
|
||
| case "$code" in | ||
| 0) verdict="PASS" ;; | ||
| 1) verdict="FAIL" ;; | ||
| *) verdict="ERROR" ;; | ||
| esac | ||
|
|
||
| if [ "$verdict" = "FAIL" ]; then level="error"; else level="warning"; fi | ||
|
|
||
| # Step summary (no-op when not in CI). | ||
| if [ -n "${GITHUB_STEP_SUMMARY:-}" ]; then | ||
| { | ||
| echo "### ${impl} - types conformance (${lane} lane)" | ||
| echo | ||
| echo "- result: **${verdict}**" | ||
| echo "- tested against: \`${resolved}\`" | ||
| echo | ||
| echo '```' | ||
| echo "${totals}" | ||
| [ -n "${fails}" ] && echo "${fails}" | ||
| [ -n "${advisory}" ] && echo "${advisory}" | ||
| [ -n "${skip}" ] && echo "${skip}" | ||
| echo '```' | ||
| echo | ||
| } >> "${GITHUB_STEP_SUMMARY}" | ||
| fi | ||
|
|
||
| # Inline annotations. | ||
| case "$verdict" in | ||
| FAIL) echo "::${level} title=${impl} ${lane} divergence::${fails:-conformance FAIL} (tested ${resolved})" ;; | ||
| ERROR) echo "::warning title=${impl} ${lane} runner error::runner exited ${code} before a verdict - see the step log" ;; | ||
| esac | ||
| [ -n "${advisory}" ] && echo "::notice title=${impl} advisory_fail (unmet SHOULD, non-blocking)::${advisory}" | ||
| [ -n "${skip}" ] && echo "::notice title=${impl} skip (skip-list candidate)::${skip}" | ||
|
|
||
| echo "RESULT: ${impl} [${lane}] ${verdict} (${resolved}) - ${totals}" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| <!-- | ||
| ~ Licensed to the Apache Software Foundation (ASF) under one | ||
| ~ or more contributor license agreements. See the NOTICE file | ||
| ~ distributed with this work for additional information | ||
| ~ regarding copyright ownership. The ASF licenses this file | ||
| ~ to you under the Apache License, Version 2.0 (the | ||
| ~ "License"); you may not use this file except in compliance | ||
| ~ with the License. You may obtain a copy of the License at | ||
| ~ | ||
| ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
| ~ | ||
| ~ Unless required by applicable law or agreed to in writing, | ||
| ~ software distributed under the License is distributed on an | ||
| ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| ~ KIND, either express or implied. See the License for the | ||
| ~ specific language governing permissions and limitations | ||
| ~ under the License. | ||
| --> | ||
|
|
||
| # Runners | ||
|
|
||
| A runner parses each fixture `input` with one implementation's own type parser and | ||
| grades the result. Each lives under `runners/<language>/` with its own workflow, so | ||
| one runner's break can't redden another's. | ||
|
|
||
| ## Support | ||
|
|
||
| | Runner | Surfaces | CI | | ||
| | --- | --- | --- | | ||
| | [Java](java/) | `types` | [](https://github.com/nssalian/iceberg-verification/actions/workflows/conformance-java.yml) | | ||
| | Go | _planned_ | - | | ||
| | Rust | _planned_ | - | | ||
| | Python | _planned_ | - | | ||
|
|
||
| Surfaces are the fixture sets a runner opts into (`table-spec/manifest.json`); `schema` | ||
| has fixtures but no runner yet. The CI column is this repo's own run status, not a | ||
| conformance ranking of the implementations. | ||
|
|
||
| Each case grades into four states (full contract in `table-spec/types/README.md`): | ||
|
|
||
| - **pass** - matches the expectation. | ||
| - **fail** - a `must` violation; the only state that exits non-zero. | ||
| - **advisory_fail** - a failed `normative_level: should` case; reported, never blocks. | ||
| - **skip** - not run here (surface not subscribed, or the type isn't modeled). | ||
|
|
||
| `--surface <name>` (or `CONFORMANCE_SURFACES`) limits the run to a surface in | ||
| `table-spec/manifest.json`; the default runs every surface the runner implements. A | ||
| build or setup failure exits 2 (ERROR), distinct from a conformance `fail`. Output is | ||
| one line per case plus a summary: | ||
|
|
||
| ``` | ||
| TOTALS: N cases | pass=.. fail=.. advisory_fail=.. skip=.. | ||
| FAIL ids: [...] | ||
| ADVISORY_FAIL ids: [...] | ||
| SKIP ids: [...] | ||
| ``` | ||
|
|
||
| The Java runner implements the `types` surface against the latest `iceberg-api` | ||
| SNAPSHOT (no release carries the v3 types yet). Go, Rust, Python, and a nightly lane | ||
| are not part of this change. | ||
|
|
||
| ## Consuming the fixtures | ||
|
|
||
| Vendor this repo as a pinned git submodule and run the fixtures in your own CI: | ||
|
|
||
| ``` | ||
| git submodule add https://github.com/apache/iceberg-verification conformance | ||
| ``` | ||
|
|
||
| Then reuse a runner here (pointed at your build via `--include-build`, scoped with | ||
| `--surface`) or write your own check over `conformance/table-spec/<surface>/**/cases.json`: | ||
| parse `input`, compare to `decoded` (and `canonical` if present), report the four | ||
| states. Only `fail` blocks. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # Local-only: an iceberg clone for `--include-build` (CI resolves the Maven SNAPSHOT). | ||
| /iceberg-src/ | ||
|
|
||
| /.gradle/ | ||
| /build/ |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd drop this section. Runners hosted here can only test published artifacts, so conformance never gates the Iceberg commit that breaks it. Per the proposal, each implementation pins this repo and runs the fixtures in its own CI, so I'd move the Java runner into apache/iceberg as a regular test.