Skip to content

Commit a19c097

Browse files
Enabeling devcontainer
1 parent f8e0176 commit a19c097

8 files changed

Lines changed: 127 additions & 150 deletions

File tree

.github/workflows/consumer_test.yml

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,29 @@ jobs:
3131
- name: Checkout PR
3232
uses: actions/checkout@v4.2.2
3333

34-
- name: Prepare Python
35-
run: |
36-
bazel run //:ide_support
3734

38-
- name: Prepare report directory
39-
run: |
40-
mkdir -p reports
35+
- name: Build and run dev container task
36+
uses: devcontainers/ci@v0.3
37+
with:
38+
cacheFrom: ghcr.io/eclipse-score/devcontainer@v1.2.0
39+
push: never
40+
# The pipefail ensures that non 0 exit codes inside the pytest execution get carried into the pipe
41+
# & make the tests red in the end. Without this we only would check the exit code of the 'tee' command.
42+
runCmd: |
43+
set -euxo pipefail
44+
uv venv && uv pip install -r src/requirements.txt
4145
42-
# The pipefail ensures that non 0 exit codes inside the pytest execution get carried into the pipe
43-
# & make the tests red in the end. Without this we only would check the exit code of the 'tee' command.
44-
- name: Run Consumer tests
46+
mkdir -p reports
4547
46-
run: |
47-
set -o pipefail
48-
.venv_docs/bin/python -m pytest -s -v src/tests/ --repo="$CONSUMER" --junitxml="reports/${{ matrix.consumer }}.xml" | tee "reports/${{ matrix.consumer }}.log"
49-
env:
50-
FORCE_COLOR: "1"
51-
TERM: xterm-256color
52-
PYTHONUNBUFFERED: "1"
53-
CONSUMER: ${{ matrix.consumer }}
48+
export FORCE_COLOR="1"
49+
export TERM="xterm-256color"
50+
export PYTHONUNBUFFERED="1"
51+
export CONSUMER="${{ matrix.consumer }}"
52+
export PYTHONPATH=.
53+
uv run pytest -s -v src/tests/ \
54+
--repo="$CONSUMER" \
55+
--junitxml="reports/${{ matrix.consumer }}.xml" \
56+
| tee "reports/${{ matrix.consumer }}.log"
5457
5558
- name: Upload consumer test report
5659
if: ${{ always() }}

.github/workflows/format.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.github/workflows/lint.yml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,9 @@ jobs:
2727
- name: Checkout repository
2828
uses: actions/checkout@v4.2.2
2929

30-
- name: Setup Bazel
31-
uses: bazel-contrib/setup-bazel@0.15.0
30+
- name: Build and run dev container task
31+
uses: devcontainers/ci@v0.3
3232
with:
33-
disk-cache: true
34-
repository-cache: true
35-
bazelisk-cache: true
36-
37-
- name: Install pre-commit
38-
run: pip install pre-commit
39-
40-
- name: Run pre-commit checks
41-
run: pre-commit run -a
33+
cacheFrom: ghcr.io/eclipse-score/devcontainer
34+
push: never
35+
runCmd: ${PIPX_BIN_DIR}/pre-commit run -a

.github/workflows/test.yml

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,33 +22,17 @@ jobs:
2222
steps:
2323
- name: Checkout repository
2424
uses: actions/checkout@v4.2.2
25-
- name: Cache Bazel and pip
26-
uses: actions/cache@v4
27-
with:
28-
path: |
29-
~/.cache/bazel
30-
~/.cache/pip
31-
key: ${{ runner.os }}-test-${{ hashFiles('**/*.bazel', '**/BUILD', '**/*.bzl', 'src/requirements.txt', 'src/**/*.py') }}
3225

33-
- name: Setup Bazel with cache
34-
uses: bazel-contrib/setup-bazel@0.15.0
26+
- name: Build and run dev container task
27+
uses: devcontainers/ci@v0.3
3528
with:
36-
disk-cache: true
37-
repository-cache: true
38-
bazelisk-cache: true
39-
- name: Run test targets
40-
run: |
41-
bazel run //:ide_support
42-
bazel test //src/...
43-
44-
- name: Prepare bundled consumer report
45-
if: always()
46-
# Creating tests-report directory
47-
# Follow Symlinks via '-L' to copy correctly
48-
# Copy everything inside the 'test-reports' folder
49-
run: |
50-
mkdir -p tests-report
51-
rsync -amL --include='*/' --include='test.xml' --include='test.log' --exclude='*' bazel-testlogs/ tests-report/
29+
cacheFrom: ghcr.io/eclipse-score/devcontainer@v1.2.0
30+
push: never
31+
runCmd: |
32+
bazel run //:ide_support
33+
bazel test //src/...
34+
mkdir -p tests-report
35+
rsync -amL --include='*/' --include='test.xml' --include='test.log' --exclude='*' bazel-testlogs/ tests-report/
5236
5337
- name: Upload bundled consumer report
5438
if: always()

.pre-commit-config.yaml

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,52 @@ repos:
1818
# use LOCAL hooks for python tooling so versions come from the virtualenv
1919
- repo: local
2020
hooks:
21-
- id: Linter Scripts
22-
name: Run linter script
23-
entry: ./scripts/run-linters.sh
24-
language: unsupported_script
21+
- id: ruff
22+
name: ruff
23+
entry: ruff check --fix
24+
language: system
25+
types_or: [python, pyi]
26+
27+
- id: ruff-format
28+
name: ruff format
29+
entry: ruff format
30+
language: system
31+
types_or: [python, pyi]
32+
33+
# Can not get this to run ;/
34+
- id: basedpyright
35+
name: basedpyright
36+
entry: basedpyright
37+
language: system
38+
types_or: [python, pyi]
2539
pass_filenames: false
40+
41+
- id: actionlint
42+
name: actionlint (container)
43+
entry: actionlint
44+
language: system
45+
files: ^\.github/workflows/.*\.ya?ml$
46+
47+
- id: yamlfmt
48+
name: yamlfmt (container)
49+
entry: yamlfmt
50+
language: system
51+
types: [yaml]
52+
53+
- id: shellcheck
54+
name: shellcheck (container)
55+
entry: shellcheck
56+
language: system
57+
types: [shell]
58+
59+
- id: buildifier fix
60+
name: bazel linting fix (container)
61+
entry: buildifier --lint=fix
62+
language: system
63+
files: '(^|/)(BUILD(\.bazel)?|MODULE\.bazel|.*\.bzl)$'
64+
65+
- id: buildifier format
66+
name: bazel formatting (container)
67+
entry: buildifier
68+
language: system
69+
files: '(^|/)(BUILD(\.bazel)?|MODULE\.bazel|.*\.bzl)$'

pyproject.toml

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,58 @@
11
# This file is at the root level, as it applies to all Python code,
22
# not only to docs or to tools.
33
[tool.pyright]
4-
extends = "bazel-bin/ide_support.runfiles/score_tooling+/python_basics/pyproject.toml"
4+
typeCheckingMode = "standard"
5+
pythonVersion = "3.12" # Keep in sync with MODULE.bazel
6+
7+
# Warn if function parameters lack type annotations
8+
reportMissingParameterType = "warning"
9+
10+
# Warn if generic types (e.g. List) are missing type args
11+
reportMissingTypeArgument = "warning"
12+
13+
# Warn when using members marked as private (e.g. _log)
14+
reportPrivateUsage = "warning"
15+
16+
# Warn when variable type can't be inferred or is 'Any'
17+
reportUnknownVariableType = "warning"
18+
19+
# Warn about declared but unused variables
20+
reportUnusedVariable = "warning"
521

622
exclude = [
723
"**/__pycache__",
824
"**/.*",
925
"**/bazel-*",
10-
".venv*/**",
1126
]
1227

1328
venvPath = "."
1429
venv = ".venv_docs"
1530

1631
[tool.ruff]
17-
extend = "bazel-bin/ide_support.runfiles/score_tooling+/python_basics/pyproject.toml"
18-
32+
#line-length=59
33+
target-version = "py312" # Keep in sync with MODULE.bazel
1934
extend-exclude = [
35+
"__pycache__",
36+
".*",
37+
"bazel-*",
2038
"**/__pycache__",
2139
"/.*",
22-
"bazel-*",
2340
".venv*/**",
2441
]
42+
43+
# Selected rules for clean code, readability, and bug prevention
44+
lint.select = [
45+
"E", # pycodestyle (PEP8)
46+
"F", # pyflakes (undefined vars, unused imports)
47+
"I", # isort (import sorting)
48+
"B", # flake8-bugbear (likely bugs)
49+
"C90", # mccabe (complexity checks)
50+
"UP", # pyupgrade (modern Python 3.12+ features)
51+
"SIM", # flake8-simplify (simplifies code patterns)
52+
"RET" # flake8-return (consistent return statements)
53+
]
54+
55+
lint.ignore = [
56+
# Rules we want to ignore go in here.
57+
# Always provide a comment explaining why.
58+
]

scripts/run-linters.sh

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/requirements.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ iniconfig==2.3.0 \
512512
--hash=sha256:c76315c77db068650d49c5b56314774a7804df16fee4402c1f19d6d15d8c4730 \
513513
--hash=sha256:f631c04d2c48c52b84d0d0549c99ff3859c98df65b3101406327ecc7d53fbf12
514514
# via
515-
# -r /external/score_tooling+/python_basics/requirements.txt
515+
# -r /score_tooling+/python_basics/requirements.txt
516516
# pytest
517517
jinja2==3.1.6 \
518518
--hash=sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d \
@@ -825,7 +825,7 @@ nodejs-wheel-binaries==24.11.1 \
825825
--hash=sha256:c79a7e43869ccecab1cae8183778249cceb14ca2de67b5650b223385682c6239 \
826826
--hash=sha256:cde41d5e4705266688a8d8071debf4f8a6fcea264c61292782672ee75a6905f9
827827
# via
828-
# -r /external/score_tooling+/python_basics/requirements.txt
828+
# -r /score_tooling+/python_basics/requirements.txt
829829
# basedpyright
830830
numpy==2.4.2 \
831831
--hash=sha256:00ab83c56211a1d7c07c25e3217ea6695e50a3e2f255053686b081dc0b091a82 \
@@ -907,7 +907,7 @@ packaging==25.0 \
907907
--hash=sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484 \
908908
--hash=sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f
909909
# via
910-
# -r /external/score_tooling+/python_basics/requirements.txt
910+
# -r /score_tooling+/python_basics/requirements.txt
911911
# matplotlib
912912
# pytest
913913
# sphinx
@@ -1013,7 +1013,7 @@ pluggy==1.6.0 \
10131013
--hash=sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3 \
10141014
--hash=sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746
10151015
# via
1016-
# -r /external/score_tooling+/python_basics/requirements.txt
1016+
# -r /score_tooling+/python_basics/requirements.txt
10171017
# pytest
10181018
pycparser==3.0 \
10191019
--hash=sha256:600f49d217304a5902ac3c37e1281c9fe94e4d0489de643a9504c5cdfdfc6b29 \
@@ -1035,7 +1035,7 @@ pygments==2.19.2 \
10351035
--hash=sha256:636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887 \
10361036
--hash=sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b
10371037
# via
1038-
# -r /external/score_tooling+/python_basics/requirements.txt
1038+
# -r /score_tooling+/python_basics/requirements.txt
10391039
# accessible-pygments
10401040
# pydata-sphinx-theme
10411041
# pytest
@@ -1083,7 +1083,7 @@ pyspellchecker==0.8.4 \
10831083
pytest==9.0.1 \
10841084
--hash=sha256:3e9c069ea73583e255c3b21cf46b8d3c56f6e3a1a8f6da94ccb0fcf57b9d73c8 \
10851085
--hash=sha256:67be0030d194df2dfa7b556f2e56fb3c3315bd5c8822c6951162b92b32ce7dad
1086-
# via -r /external/score_tooling+/python_basics/requirements.txt
1086+
# via -r /score_tooling+/python_basics/requirements.txt
10871087
python-dateutil==2.9.0.post0 \
10881088
--hash=sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3 \
10891089
--hash=sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427

0 commit comments

Comments
 (0)