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
37 changes: 20 additions & 17 deletions .github/workflows/consumer_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,29 @@ jobs:
- name: Checkout PR
uses: actions/checkout@v4.2.2

- name: Prepare Python
run: |
bazel run //:ide_support

- name: Prepare report directory
run: |
mkdir -p reports
- name: Build and run dev container task
uses: devcontainers/ci@v0.3
with:
cacheFrom: ghcr.io/eclipse-score/devcontainer@v1.2.0
push: never
# The pipefail ensures that non 0 exit codes inside the pytest execution get carried into the pipe
# & make the tests red in the end. Without this we only would check the exit code of the 'tee' command.
runCmd: |
set -euxo pipefail
uv venv && uv pip install -r src/requirements.txt

# The pipefail ensures that non 0 exit codes inside the pytest execution get carried into the pipe
# & make the tests red in the end. Without this we only would check the exit code of the 'tee' command.
- name: Run Consumer tests
mkdir -p reports

run: |
set -o pipefail
.venv_docs/bin/python -m pytest -s -v src/tests/ --repo="$CONSUMER" --junitxml="reports/${{ matrix.consumer }}.xml" | tee "reports/${{ matrix.consumer }}.log"
env:
FORCE_COLOR: "1"
TERM: xterm-256color
PYTHONUNBUFFERED: "1"
CONSUMER: ${{ matrix.consumer }}
export FORCE_COLOR="1"
export TERM="xterm-256color"
export PYTHONUNBUFFERED="1"
export CONSUMER="${{ matrix.consumer }}"
export PYTHONPATH=.
uv run pytest -s -v src/tests/ \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pytest is preinstalled in the devcontainer and should be accessible without uv. Maybe uv just runs what is already there

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes pytest is there, but the packages this test needs arent'.

So i installe eveyrthing via uv then running it

--repo="$CONSUMER" \
--junitxml="reports/${{ matrix.consumer }}.xml" \
| tee "reports/${{ matrix.consumer }}.log"

- name: Upload consumer test report
if: ${{ always() }}
Expand Down
41 changes: 0 additions & 41 deletions .github/workflows/format.yml

This file was deleted.

16 changes: 5 additions & 11 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,9 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4.2.2

- name: Setup Bazel
uses: bazel-contrib/setup-bazel@0.15.0
- name: Build and run dev container task
uses: devcontainers/ci@v0.3
with:
disk-cache: true
repository-cache: true
bazelisk-cache: true

- name: Install pre-commit
run: pip install pre-commit

- name: Run pre-commit checks
run: pre-commit run -a
cacheFrom: ghcr.io/eclipse-score/devcontainer
push: never
runCmd: ${PIPX_BIN_DIR}/pre-commit run -a
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the current main tag PIPX_BIN_DIR is now part of $PATH

Suggested change
runCmd: ${PIPX_BIN_DIR}/pre-commit run -a
runCmd: pre-commit run -a

34 changes: 9 additions & 25 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,17 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4.2.2
- name: Cache Bazel and pip
uses: actions/cache@v4
with:
path: |
~/.cache/bazel
~/.cache/pip
key: ${{ runner.os }}-test-${{ hashFiles('**/*.bazel', '**/BUILD', '**/*.bzl', 'src/requirements.txt', 'src/**/*.py') }}

- name: Setup Bazel with cache
uses: bazel-contrib/setup-bazel@0.15.0
Comment on lines -33 to -34
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should keep an eye on build times and if we can use a cache with the devcontainer

- name: Build and run dev container task
uses: devcontainers/ci@v0.3
with:
disk-cache: true
repository-cache: true
bazelisk-cache: true
- name: Run test targets
run: |
bazel run //:ide_support
bazel test //src/...

- name: Prepare bundled consumer report
if: always()
# Creating tests-report directory
# Follow Symlinks via '-L' to copy correctly
# Copy everything inside the 'test-reports' folder
run: |
mkdir -p tests-report
rsync -amL --include='*/' --include='test.xml' --include='test.log' --exclude='*' bazel-testlogs/ tests-report/
cacheFrom: ghcr.io/eclipse-score/devcontainer@v1.2.0
push: never
runCmd: |
bazel run //:ide_support
bazel test //src/...
mkdir -p tests-report
rsync -amL --include='*/' --include='test.xml' --include='test.log' --exclude='*' bazel-testlogs/ tests-report/

- name: Upload bundled consumer report
if: always()
Expand Down
52 changes: 48 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,52 @@ repos:
# use LOCAL hooks for python tooling so versions come from the virtualenv
- repo: local
hooks:
- id: Linter Scripts
name: Run linter script
entry: ./scripts/run-linters.sh
language: unsupported_script
- id: ruff
name: ruff
entry: ruff check --fix
language: system
types_or: [python, pyi]

- id: ruff-format
name: ruff format
entry: ruff format
language: system
types_or: [python, pyi]

# Can not get this to run ;/
- id: basedpyright
name: basedpyright
entry: basedpyright
language: system
types_or: [python, pyi]
pass_filenames: false

- id: actionlint
name: actionlint (container)
entry: actionlint
language: system
files: ^\.github/workflows/.*\.ya?ml$

- id: yamlfmt
name: yamlfmt (container)
entry: yamlfmt
language: system
types: [yaml]

- id: shellcheck
name: shellcheck (container)
entry: shellcheck
language: system
types: [shell]

- id: buildifier fix
name: bazel linting fix (container)
entry: buildifier --lint=fix
language: system
files: '(^|/)(BUILD(\.bazel)?|MODULE\.bazel|.*\.bzl)$'

- id: buildifier format
name: bazel formatting (container)
entry: buildifier
language: system
files: '(^|/)(BUILD(\.bazel)?|MODULE\.bazel|.*\.bzl)$'
44 changes: 39 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,58 @@
# This file is at the root level, as it applies to all Python code,
# not only to docs or to tools.
[tool.pyright]
extends = "bazel-bin/ide_support.runfiles/score_tooling+/python_basics/pyproject.toml"
typeCheckingMode = "standard"
pythonVersion = "3.12" # Keep in sync with MODULE.bazel

# Warn if function parameters lack type annotations
reportMissingParameterType = "warning"

# Warn if generic types (e.g. List) are missing type args
reportMissingTypeArgument = "warning"

# Warn when using members marked as private (e.g. _log)
reportPrivateUsage = "warning"

# Warn when variable type can't be inferred or is 'Any'
reportUnknownVariableType = "warning"

# Warn about declared but unused variables
reportUnusedVariable = "warning"

exclude = [
"**/__pycache__",
"**/.*",
"**/bazel-*",
".venv*/**",
]

venvPath = "."
venv = ".venv_docs"

[tool.ruff]
extend = "bazel-bin/ide_support.runfiles/score_tooling+/python_basics/pyproject.toml"

#line-length=59
target-version = "py312" # Keep in sync with MODULE.bazel
extend-exclude = [
"__pycache__",
".*",
"bazel-*",
"**/__pycache__",
"/.*",
"bazel-*",
".venv*/**",
]

# Selected rules for clean code, readability, and bug prevention
lint.select = [
"E", # pycodestyle (PEP8)
"F", # pyflakes (undefined vars, unused imports)
"I", # isort (import sorting)
"B", # flake8-bugbear (likely bugs)
"C90", # mccabe (complexity checks)
"UP", # pyupgrade (modern Python 3.12+ features)
"SIM", # flake8-simplify (simplifies code patterns)
"RET" # flake8-return (consistent return statements)
]

lint.ignore = [
# Rules we want to ignore go in here.
# Always provide a comment explaining why.
]
41 changes: 0 additions & 41 deletions scripts/run-linters.sh

This file was deleted.

12 changes: 6 additions & 6 deletions src/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ iniconfig==2.3.0 \
--hash=sha256:c76315c77db068650d49c5b56314774a7804df16fee4402c1f19d6d15d8c4730 \
--hash=sha256:f631c04d2c48c52b84d0d0549c99ff3859c98df65b3101406327ecc7d53fbf12
# via
# -r /external/score_tooling+/python_basics/requirements.txt
# -r /score_tooling+/python_basics/requirements.txt
# pytest
jinja2==3.1.6 \
--hash=sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d \
Expand Down Expand Up @@ -825,7 +825,7 @@ nodejs-wheel-binaries==24.11.1 \
--hash=sha256:c79a7e43869ccecab1cae8183778249cceb14ca2de67b5650b223385682c6239 \
--hash=sha256:cde41d5e4705266688a8d8071debf4f8a6fcea264c61292782672ee75a6905f9
# via
# -r /external/score_tooling+/python_basics/requirements.txt
# -r /score_tooling+/python_basics/requirements.txt
# basedpyright
numpy==2.4.2 \
--hash=sha256:00ab83c56211a1d7c07c25e3217ea6695e50a3e2f255053686b081dc0b091a82 \
Expand Down Expand Up @@ -907,7 +907,7 @@ packaging==25.0 \
--hash=sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484 \
--hash=sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f
# via
# -r /external/score_tooling+/python_basics/requirements.txt
# -r /score_tooling+/python_basics/requirements.txt
# matplotlib
# pytest
# sphinx
Expand Down Expand Up @@ -1013,7 +1013,7 @@ pluggy==1.6.0 \
--hash=sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3 \
--hash=sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746
# via
# -r /external/score_tooling+/python_basics/requirements.txt
# -r /score_tooling+/python_basics/requirements.txt
# pytest
pycparser==3.0 \
--hash=sha256:600f49d217304a5902ac3c37e1281c9fe94e4d0489de643a9504c5cdfdfc6b29 \
Expand All @@ -1035,7 +1035,7 @@ pygments==2.19.2 \
--hash=sha256:636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887 \
--hash=sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b
# via
# -r /external/score_tooling+/python_basics/requirements.txt
# -r /score_tooling+/python_basics/requirements.txt
# accessible-pygments
# pydata-sphinx-theme
# pytest
Expand Down Expand Up @@ -1083,7 +1083,7 @@ pyspellchecker==0.8.4 \
pytest==9.0.1 \
--hash=sha256:3e9c069ea73583e255c3b21cf46b8d3c56f6e3a1a8f6da94ccb0fcf57b9d73c8 \
--hash=sha256:67be0030d194df2dfa7b556f2e56fb3c3315bd5c8822c6951162b92b32ce7dad
# via -r /external/score_tooling+/python_basics/requirements.txt
# via -r /score_tooling+/python_basics/requirements.txt
python-dateutil==2.9.0.post0 \
--hash=sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3 \
--hash=sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427
Expand Down
Loading