Skip to content
Closed
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
66 changes: 50 additions & 16 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,24 @@ jobs:
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false
- name: Mark job start
run: touch "$RUNNER_TEMP/job-start"
- name: Setup Bazel
uses: bazel-contrib/setup-bazel@083175551ceeceebc757ebee2127fde78840ca77 # 0.18.0
with:
# Store build cache per workflow.
disk-cache: ${{ github.workflow }}-${{ github.job }}
# Share repository cache between workflows.
repository-cache: true
bazelrc: |
build --disk_cache=/home/runner/.cache/bazel-disk
# Prevent PRs from polluting cache
cache-save: ${{ github.event_name != 'pull_request' }}
- name: Restore Bazel disk cache
uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0
with:
path: ~/.cache/bazel-disk
key: bazel-disk-${{ runner.os }}-${{ github.job }}-${{ github.sha }}
restore-keys: |
bazel-disk-${{ runner.os }}-${{ github.job }}-
- name: Mark job start
run: touch "$RUNNER_TEMP/job-start"
- name: Bazel Output Version
run: bazelisk --version
- name: Java 8 Build
Expand All @@ -50,9 +59,17 @@ jobs:
# Bazel bumps mtimes on use; drop stale entries so the saved cache doesn't grow unbounded.
if: github.event_name != 'pull_request'
run: |
du -sh ~/.cache/bazel-disk
find ~/.cache/bazel-disk -type f ! -newer "$RUNNER_TEMP/job-start" -delete
du -sh ~/.cache/bazel-disk
if [ -d ~/.cache/bazel-disk ]; then
du -sh ~/.cache/bazel-disk
find ~/.cache/bazel-disk -type f ! -newer "$RUNNER_TEMP/job-start" -delete
du -sh ~/.cache/bazel-disk
fi
- name: Save Bazel disk cache
if: github.event_name != 'pull_request'
uses: actions/cache/save@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0
with:
path: ~/.cache/bazel-disk
key: bazel-disk-${{ runner.os }}-${{ github.job }}-${{ github.sha }}
- run: echo "🍏 This job's status is ${JOB_STATUS}."
env:
JOB_STATUS: ${{ job.status }}
Expand All @@ -68,15 +85,24 @@ jobs:
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false
- name: Mark job start
run: touch "$RUNNER_TEMP/job-start"
- name: Setup Bazel
uses: bazel-contrib/setup-bazel@083175551ceeceebc757ebee2127fde78840ca77 # 0.18.0
with:
# Store build cache per workflow.
disk-cache: ${{ github.workflow }}-${{ github.job }}
# Share repository cache between workflows.
repository-cache: true
bazelrc: |
build --disk_cache=/home/runner/.cache/bazel-disk
# Prevent PRs from polluting cache
cache-save: ${{ github.event_name != 'pull_request' }}
- name: Restore Bazel disk cache
uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0
with:
path: ~/.cache/bazel-disk
key: bazel-disk-${{ runner.os }}-${{ github.job }}-${{ github.sha }}
restore-keys: |
bazel-disk-${{ runner.os }}-${{ github.job }}-
- name: Mark job start
run: touch "$RUNNER_TEMP/job-start"
- name: Bazel Output Version
run: bazelisk --version
- name: Bazel Test
Expand All @@ -87,9 +113,17 @@ jobs:
# Bazel bumps mtimes on use; drop stale entries so the saved cache doesn't grow unbounded.
if: github.event_name != 'pull_request'
run: |
du -sh ~/.cache/bazel-disk
find ~/.cache/bazel-disk -type f ! -newer "$RUNNER_TEMP/job-start" -delete
du -sh ~/.cache/bazel-disk
if [ -d ~/.cache/bazel-disk ]; then
du -sh ~/.cache/bazel-disk
find ~/.cache/bazel-disk -type f ! -newer "$RUNNER_TEMP/job-start" -delete
du -sh ~/.cache/bazel-disk
fi
- name: Save Bazel disk cache
if: github.event_name != 'pull_request'
uses: actions/cache/save@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0
with:
path: ~/.cache/bazel-disk
key: bazel-disk-${{ runner.os }}-${{ github.job }}-${{ github.sha }}
- run: echo "🍏 This job's status is ${JOB_STATUS}."
env:
JOB_STATUS: ${{ job.status }}
Expand Down Expand Up @@ -117,8 +151,8 @@ jobs:
if: steps.changed_file.outputs.any_changed == 'true'
uses: bazel-contrib/setup-bazel@083175551ceeceebc757ebee2127fde78840ca77 # 0.18.0
with:
# Store build cache per workflow.
disk-cache: ${{ github.workflow }}-${{ github.job }}
# Share repository cache between workflows.
repository-cache: true
# Never write to the cache, strictly read-only
cache-save: false
- name: Verify Version Consistency
Expand Down
234 changes: 204 additions & 30 deletions bundle/src/test/java/dev/cel/bundle/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,33 +1,193 @@
load("@rules_java//java:defs.bzl", "java_library")
load("//:testing.bzl", "junit4_test_suites")
load("@rules_java//java:defs.bzl", "java_test")

package(
default_applicable_licenses = [
"//:license",
],
)

java_library(
name = "tests",
testonly = True,
srcs = glob(["*Test.java"]),
java_test(
name = "CelEnvironmentExporterTest",
srcs = ["CelEnvironmentExporterTest.java"],
resources = [
"//testing/environment:dump_env",
"//testing/environment:extended_env",
"//testing/environment:library_subset_env",
],
test_class = "dev.cel.bundle.CelEnvironmentExporterTest",
deps = [
"//:java_truth",
"//bundle:cel",
"//bundle:cel_impl",
"//bundle:environment",
"//bundle:environment_exception",
"//bundle:environment_exporter",
"//bundle:environment_yaml_parser",
"//common/types",
"//common/types:type_providers",
"//common:cel_function_decl",
"//common:cel_overload_decl",
"//common:cel_var_decl",
"//common:container",
"//common:options",
"//compiler:compiler_builder",
"//extensions",
"//runtime",
"@maven//:com_google_guava_guava",
"@maven//:com_google_protobuf_protobuf_java",
"@maven//:com_google_testparameterinjector_test_parameter_injector",
"@maven//:junit_junit",
],
)

java_test(
name = "CelEnvironmentTest",
srcs = ["CelEnvironmentTest.java"],
resources = [
"//testing/environment:dump_env",
"//testing/environment:extended_env",
"//testing/environment:library_subset_env",
],
test_class = "dev.cel.bundle.CelEnvironmentTest",
deps = [
"//:java_truth",
"//bundle:cel",
"//bundle:environment",
"//bundle:environment_exception",
"//common/ast",
"//common/types",
"//common/types:type_providers",
"//common:cel_ast",
"//common:cel_source",
"//common:cel_validation_exception",
"//common:cel_validation_result",
"//common:container",
"//common:options",
"//compiler",
"//compiler:compiler_builder",
"//parser:macro",
"//runtime",
"@maven//:com_google_guava_guava",
"@maven//:com_google_protobuf_protobuf_java",
"@maven//:com_google_testparameterinjector_test_parameter_injector",
"@maven//:junit_junit",
],
)

java_test(
name = "CelEnvironmentYamlParserTest",
srcs = ["CelEnvironmentYamlParserTest.java"],
resources = [
"//testing/environment:dump_env",
"//testing/environment:extended_env",
"//testing/environment:library_subset_env",
],
test_class = "dev.cel.bundle.CelEnvironmentYamlParserTest",
deps = [
"//:java_truth",
"//bundle:cel",
"//bundle:environment",
"//bundle:environment_exception",
"//bundle:environment_yaml_parser",
"//common/ast",
"//common/types",
"//common/types:type_providers",
"//common:cel_ast",
"//common:cel_source",
"//common:cel_validation_exception",
"//common:cel_validation_result",
"//common:container",
"//common:options",
"//compiler:compiler_builder",
"//parser:unparser",
"//runtime",
"//runtime:evaluation_listener",
"//runtime:function_binding",
"@cel_spec//proto/cel/expr:checked_java_proto",
"@com_google_googleapis//google/rpc/context:attribute_context_java_proto",
"@maven//:com_google_guava_guava",
"@maven//:com_google_protobuf_protobuf_java",
"@maven//:com_google_testparameterinjector_test_parameter_injector",
"@maven//:junit_junit",
],
)

java_test(
name = "CelEnvironmentYamlSerializerTest",
srcs = ["CelEnvironmentYamlSerializerTest.java"],
resources = [
"//testing/environment:dump_env",
"//testing/environment:extended_env",
"//testing/environment:library_subset_env",
],
test_class = "dev.cel.bundle.CelEnvironmentYamlSerializerTest",
deps = [
"//:java_truth",
"//bundle:environment",
"//bundle:environment_exception",
"//bundle:environment_yaml_parser",
"//common:container",
"@maven//:com_google_guava_guava",
"@maven//:junit_junit",
],
)

java_test(
name = "CelFunctionTest",
srcs = ["CelFunctionTest.java"],
resources = [
"//testing/environment:dump_env",
"//testing/environment:extended_env",
"//testing/environment:library_subset_env",
],
test_class = "dev.cel.bundle.CelFunctionTest",
deps = [
"//:java_truth",
"//bundle:cel",
"//common/types",
"//common/types:type_providers",
"//common:cel_ast",
"//common:cel_function_decl",
"//common:cel_overload_decl",
"//common:cel_validation_exception",
"//common:cel_validation_result",
"//compiler:compiler_builder",
"//runtime",
"//testing:cel_runtime_flavor",
"@cel_spec//proto/cel/expr:checked_java_proto",
"@maven//:com_google_guava_guava",
"@maven//:com_google_protobuf_protobuf_java",
"@maven//:com_google_testparameterinjector_test_parameter_injector",
"@maven//:junit_junit",
],
)

java_test(
name = "CelImplTest",
srcs = ["CelImplTest.java"],
resources = [
"//testing/environment:dump_env",
"//testing/environment:extended_env",
"//testing/environment:library_subset_env",
],
test_class = "dev.cel.bundle.CelImplTest",
deps = [
"//:java_truth",
"//bundle:cel",
"//bundle:cel_impl",
"//checker",
"//checker:proto_type_mask",
"//checker:standard_decl",
"//checker:type_provider_legacy",
"//common/ast",
"//common/resources/testdata/proto3:standalone_global_enum_java_proto",
"//common/testing",
"//common/types",
"//common/types:cel_proto_message_types",
"//common/types:cel_proto_types",
"//common/types:message_type_provider",
"//common/types:type_providers",
"//common/values",
"//common/values:cel_byte_string",
"//common:cel_ast",
"//common:cel_descriptor_util",
"//common:cel_function_decl",
Expand All @@ -42,35 +202,23 @@ java_library(
"//common:options",
"//common:proto_ast",
"//common:source_location",
"//common/ast",
"//common/resources/testdata/proto3:standalone_global_enum_java_proto",
"//common/testing",
"//common/types",
"//common/types:cel_proto_message_types",
"//common/types:cel_proto_types",
"//common/types:message_type_provider",
"//common/types:type_providers",
"//common/values",
"//common/values:cel_byte_string",
"//compiler",
"//compiler:compiler_builder",
"//extensions",
"//parser",
"//parser:macro",
"//parser:unparser",
"//runtime",
"//runtime:evaluation_exception_builder",
"//runtime:evaluation_listener",
"//runtime:function_binding",
"//runtime:standard_functions",
"//runtime:unknown_attributes",
"//testing:cel_runtime_flavor",
"//testing/protos:single_file_extension_java_proto",
"//testing/protos:single_file_java_proto",
"@cel_spec//proto/cel/expr:checked_java_proto",
"@cel_spec//proto/cel/expr:syntax_java_proto",
"//testing:cel_runtime_flavor",
"@cel_spec//proto/cel/expr/conformance/proto2:test_all_types_java_proto",
"@cel_spec//proto/cel/expr/conformance/proto3:test_all_types_java_proto",
"@cel_spec//proto/cel/expr:checked_java_proto",
"@cel_spec//proto/cel/expr:syntax_java_proto",
"@com_google_googleapis//google/rpc/context:attribute_context_java_proto",
"@com_google_googleapis//google/type:type_java_proto",
"@maven//:com_google_guava_guava",
Expand All @@ -82,12 +230,38 @@ java_library(
],
)

junit4_test_suites(
name = "test_suites",
shard_count = 4,
sizes = [
"small",
],
src_dir = "src/test/java",
deps = [":tests"],
java_test(
name = "CelOverloadDeclParserTest",
srcs = ["CelOverloadDeclParserTest.java"],
resources = [
"//testing/environment:dump_env",
"//testing/environment:extended_env",
"//testing/environment:library_subset_env",
],
test_class = "dev.cel.bundle.CelOverloadDeclParserTest",
deps = [
"//:java_truth",
"//bundle:environment",
"@maven//:com_google_guava_guava",
"@maven//:com_google_testparameterinjector_test_parameter_injector",
"@maven//:junit_junit",
],
)

java_test(
name = "TypeSpecifierParserTest",
srcs = ["TypeSpecifierParserTest.java"],
resources = [
"//testing/environment:dump_env",
"//testing/environment:extended_env",
"//testing/environment:library_subset_env",
],
test_class = "dev.cel.bundle.TypeSpecifierParserTest",
deps = [
"//:java_truth",
"//bundle:environment",
"@maven//:com_google_guava_guava",
"@maven//:com_google_testparameterinjector_test_parameter_injector",
"@maven//:junit_junit",
],
)
Loading
Loading