Skip to content
Merged
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
25 changes: 25 additions & 0 deletions .github/workflows/tests-main-workspace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# *******************************************************************************
# Copyright (c) 2025 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

name: Run all tests of the main workspace
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
run-all-tests:
name: run main workspace tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bazelbuild/setup-bazelisk@v3
- run: ./scripts/run_all_tests.sh main
25 changes: 25 additions & 0 deletions .github/workflows/tests-test-workspace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# *******************************************************************************
# Copyright (c) 2025 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

name: Run tests in test workspace
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
run-all-tests:
name: run test workspace tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bazelbuild/setup-bazelisk@v3
- run: ./scripts/run_all_tests.sh test
102 changes: 55 additions & 47 deletions scripts/run_all_tests.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
# *******************************************************************************
# Copyright (c) 2025 Contributors to the Eclipse Foundation
#
Expand All @@ -10,7 +11,7 @@
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
#!/usr/bin/env bash

set -u

GREEN='\033[0;32m'
Expand All @@ -21,6 +22,7 @@ RESET='\033[0m'
declare -A command_status
declare -a command_order
exit_code=0
[ $# -gt 0 ] && workspace=$1 || workspace="all"


interrupt_handler(){
Expand Down Expand Up @@ -48,51 +50,57 @@ run_command(){
command_order+=("$name")
}

# Run bazel test with workspace mode and python 3.9.
# TODO re-enable once the score targets (like //:docs) support bazel workspace mode and more than python 3.12
# run_command "bazel --output_base=$HOME/.cache/bazel_tools_python/workspace_output_base test --config=use_workspace_mode --config=python_3_9 //..." "tests (workspace mode and python 3.9)"

# Run bazel test with bzlmod mode and python 3.12.
run_command "bazel --output_base=$HOME/.cache/bazel_tools_python/python_3_12_output_base test --config=python_3_12 //..." "tests (bzlmod mode and python 3.12)"

# Run bazel test with bzlmod mode.
run_command "bazel test //..." "tests (bzlmod mode)"

# Run python quality tools.
run_command "bazel build --config=ruff_check --keep_going //..." "ruff_check"
run_command "bazel build --config=ruff_format --keep_going //..." "ruff_format"
run_command "bazel build --config=pylint --keep_going //..." "pylint"
run_command "bazel build --config=black --keep_going //..." "black"
run_command "bazel build --config=isort --keep_going //..." "isort"
run_command "bazel build --config=mypy --keep_going //..." "mypy"

# Run test workspace tests.
run_command "test/run_all_tests.sh" "tests (in test workspace)"

# Run buildifier.
run_command "bazel run bazel/buildifier:check" "buildifier"

# Run Eclipse-specific checks.
run_command "bazel run //:copyright.check -- --fix" "eclipse copyright check"
run_command "bazel test //:format.check" "eclipse format check"

# Run security vulnerability scan.
run_command "third_party/pip/check_vulnerabilities.sh" "security scan"

# Print execution summary
printf '%-37s | %-10s\n' "Command Name" "Status"
printf '%-37s | %-10s\n' "-------------------------------------" "----------"

for name in "${command_order[@]}"; do
status="${command_status[$name]}"

if [[ "$status" == "SUCCEEDED" ]]; then
printf "%-37s | ${GREEN}%-10s${RESET}\n" "$name" "$status"
else
printf "%-37s | ${RED}%-10s${RESET}\n" "$name" "$status"
fi
done

printf '%-37s | %-10s\n' "-------------------------------------" "----------"
if [ "${workspace}" == "all" -o "${workspace}" == "main" ];then
# Run bazel test with workspace mode and python 3.9.
# TODO re-enable once the score targets (like //:docs) support bazel workspace mode and more than python 3.12
# run_command "bazel --output_base=$HOME/.cache/bazel_tools_python/workspace_output_base test --config=use_workspace_mode --config=python_3_9 //..." "tests (workspace mode and python 3.9)"

# Run bazel test with bzlmod mode and python 3.12.
run_command "bazel --output_base=$HOME/.cache/bazel_tools_python/python_3_12_output_base test --config=python_3_12 //..." "tests (bzlmod mode and python 3.12)"

# Run bazel test with bzlmod mode.
run_command "bazel test //..." "tests (bzlmod mode)"

# Run python quality tools.
run_command "bazel build --config=ruff_check --keep_going //..." "ruff_check"
run_command "bazel build --config=ruff_format --keep_going //..." "ruff_format"
run_command "bazel build --config=pylint --keep_going //..." "pylint"
run_command "bazel build --config=black --keep_going //..." "black"
run_command "bazel build --config=isort --keep_going //..." "isort"
run_command "bazel build --config=mypy --keep_going //..." "mypy"

# Run buildifier.
run_command "bazel run bazel/buildifier:check" "buildifier"

# Run Eclipse-specific checks.
run_command "bazel run //:copyright.check -- --fix" "eclipse copyright check"
run_command "bazel test //:format.check" "eclipse format check"

# Run security vulnerability scan.
run_command "third_party/pip/check_vulnerabilities.sh" "security scan"
fi

if [ "${workspace}" == "all" -o "${workspace}" == "test" ];then
# Run test workspace tests.
run_command "test/run_all_tests.sh" "tests (in test workspace)"
fi

if [ "${workspace}" == "all" -o "${workspace}" == "main" ];then
# Print execution summary
printf '%-37s | %-10s\n' "Command Name" "Status"
printf '%-37s | %-10s\n' "-------------------------------------" "----------"

for name in "${command_order[@]}"; do
status="${command_status[$name]}"

if [[ "$status" == "SUCCEEDED" ]]; then
printf "%-37s | ${GREEN}%-10s${RESET}\n" "$name" "$status"
else
printf "%-37s | ${RED}%-10s${RESET}\n" "$name" "$status"
fi
done

printf '%-37s | %-10s\n' "-------------------------------------" "----------"
fi

exit $exit_code
3 changes: 2 additions & 1 deletion test/run_all_tests.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
# *******************************************************************************
# Copyright (c) 2025 Contributors to the Eclipse Foundation
#
Expand All @@ -10,7 +11,7 @@
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
#!/usr/bin/env bash

set -u

GREEN='\033[0;32m'
Expand Down
Loading