Skip to content

Commit 7e78d47

Browse files
committed
ci(github): check ESLint in the CI and run all tests in the dev container
The code-quality job now runs ESLint as the pre-commit hook does. The dev container moves to Ubuntu 26.04 and installs a JDK 21 and xvfb, so that the tests of the PyCharm plugin and the VS Code extension run in it and in Codespaces; the pre-commit hooks take any Python 3, since the container has no Python 3.10.
1 parent 909be3b commit 7e78d47

5 files changed

Lines changed: 17 additions & 12 deletions

File tree

‎.devcontainer/devcontainer.json‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
33
{
44
"name": "robotcode devcontainer",
5-
"image": "mcr.microsoft.com/devcontainers/base:jammy",
5+
"image": "mcr.microsoft.com/devcontainers/base:resolute",
66
// Features to add to the dev container. More info: https://containers.dev/features.
77
"features": {
88
"ghcr.io/devcontainers/features/common-utils:2": {
@@ -27,7 +27,9 @@
2727
// Use 'forwardPorts' to make a list of ports inside the container available locally.
2828
// "forwardPorts": [],
2929
// Use 'postCreateCommand' to run commands after the container is created.
30-
"postCreateCommand": "bash -i -c 'sudo apt update -y && sudo apt upgrade -y && sudo apt install gdb -y && npm install --also-dev && pipx install hatch && hatch env create devel'",
30+
// a JDK for the Gradle build of the PyCharm plugin, and xvfb with the libraries VS Code needs to start, for
31+
// `xvfb-run -a npm test`
32+
"postCreateCommand": "bash -i -c 'sudo apt update -y && sudo apt upgrade -y && sudo apt install gdb openjdk-21-jdk-headless xvfb libasound2t64 libgbm1 libgtk-3-0t64 libnss3 -y && npm install --also-dev && pipx install hatch && hatch env create devel'",
3133
// Configure tool-specific properties.
3234
// "customizations": {},
3335
// Uncomment to connect as root instead. More info: https://aka.ms/dev-je+-containers-non-root.

‎.github/PULL_REQUEST_TEMPLATE.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
- [ ] I have read the [Contribution Guide](../CONTRIBUTING.md) and the [AI and Automated Contribution Policy](../AI_POLICY.md).
2121
- [ ] The change is focused on a single concern (no unrelated refactors or formatting noise).
2222
- [ ] Tests for the change have been added or updated, and the tests of every changed part pass locally: `hatch run test:test` for the Python packages (RF matrix against the default Python), `npm test` for the VS Code extension, `./gradlew test` in `intellij-client/` for the PyCharm plugin — *or N/A for documentation-only / non-code changes*. See [Running Tests](../CONTRIBUTING.md#running-tests) for faster iteration options and the full matrix.
23-
- [ ] `hatch run lint:all` passes (also enforced by the [pre-commit hooks](../CONTRIBUTING.md#pre-commit-hooks) if installed) — *or N/A for documentation-only / non-code changes*.
23+
- [ ] `hatch run lint:all` passes, and `npm run lint` for changes to the VS Code extension (also enforced by the [pre-commit hooks](../CONTRIBUTING.md#pre-commit-hooks) if installed) — *or N/A for documentation-only / non-code changes*.
2424
- [ ] Documentation has been updated where relevant (user docs, code comments, README).
2525
- [ ] Generated files (if any) were regenerated with the documented script, not edited by hand.
2626
- [ ] Commits follow [Conventional Commits](../CONTRIBUTING.md#commit-messages) and are [cryptographically signed](../CONTRIBUTING.md#signed-commits-required) (`git commit -S`, GPG/SSH).

‎.github/workflows/build-test-package.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,9 @@ jobs:
280280
- run: hatch run lint:typing
281281
if: always()
282282

283+
- run: npm run lint
284+
if: always()
285+
283286
- name: Verify JetBrains Plugin (released IDE versions)
284287
if: always()
285288
working-directory: intellij-client

‎.pre-commit-config.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
fail_fast: true
22
default_language_version:
3-
python: python3.10
3+
python: python3
44
default_stages:
55
- commit-msg
66
- pre-commit
@@ -12,7 +12,7 @@ default_install_hook_types:
1212

1313
repos:
1414
- repo: https://github.com/compilerla/conventional-pre-commit
15-
rev: v4.0.0
15+
rev: v4.4.0
1616
hooks:
1717
- id: conventional-pre-commit
1818
stages: [commit-msg]

‎CONTRIBUTING.md‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ For local development with containers:
197197
- Clone the repository: `git clone https://github.com/robotcodedev/robotcode.git`.
198198
- Open the project in VS Code.
199199
- When prompted, click "Reopen in Container" — or use the Command Palette (`Cmd+Shift+P` / `Ctrl+Shift+P`) and run "Dev Containers: Reopen in Container".
200-
- The container automatically installs all dependencies (Python, Node.js, etc.).
200+
- The container automatically installs all dependencies: Python, Node.js and Hatch, a JDK 21 for the PyCharm plugin, and xvfb for the VS Code extension's tests. All three test suites run in it, in Codespaces as well; start the VS Code extension's tests there with `xvfb-run -a npm test`, since the container has no display.
201201

202202
**Option 3: Local Development**
203203

@@ -261,8 +261,8 @@ This installs the `pre-commit`, `commit-msg` and `pre-push` hooks. To run all ho
261261
1. **Create a branch:** `git checkout -b feature/your-feature-name`
262262
2. **Make your changes** following the project's coding standards
263263
3. **Run tests:** the tests of every part you changed, before committing or pushing, and not only the tests you added or changed — `hatch run test:test` for the Python packages (the full test suite against all supported Robot Framework versions with the default Python), `npm test` for the VS Code extension, `./gradlew test` in `intellij-client/` for the PyCharm plugin (see [Running Tests](#running-tests))
264-
4. **Run linting:** `hatch run lint:all` (or use the VS Code task) — the [pre-commit hooks](#pre-commit-hooks) run style and typing checks automatically if installed
265-
5. **Fix linting issues:** `hatch run lint:style` for formatting
264+
4. **Run linting:** `hatch run lint:all` (or use the VS Code task) for the Python code and `npm run lint` for the VS Code extension — the [pre-commit hooks](#pre-commit-hooks) run these checks automatically if installed
265+
5. **Fix linting issues:** `hatch run lint:fix` for the Python code and `npm run lint-fix` for the VS Code extension; both fix what they can, formatting included
266266
6. **Commit your changes** with a descriptive commit message
267267
7. **Push and create a pull request**
268268

@@ -276,7 +276,7 @@ Before submitting your pull request, make sure that:
276276

277277
- [ ] The change is **focused** on a single concern (no unrelated refactors or formatting noise).
278278
- [ ] **Tests** for the change have been added or updated, and the tests of every changed part pass locally: `hatch run test:test` for the Python packages (RF matrix against the default Python), `npm test` for the VS Code extension, `./gradlew test` in `intellij-client/` for the PyCharm plugin — *not required for documentation-only or other non-code changes; note that in the PR*. See [Running Tests](#running-tests) for faster iteration options and the full matrix.
279-
- [ ] **Linting** passes: `hatch run lint:all` (also enforced by the [pre-commit hooks](#pre-commit-hooks) if installed) — *not applicable to documentation-only or other non-code changes; there is no Markdown linter*.
279+
- [ ] **Linting** passes: `hatch run lint:all`, and `npm run lint` for changes to the VS Code extension (also enforced by the [pre-commit hooks](#pre-commit-hooks) if installed) — *not applicable to documentation-only or other non-code changes; there is no Markdown linter*.
280280
- [ ] **Documentation** has been updated where relevant (user docs, code comments, README).
281281
- [ ] **Generated files** (if any) were regenerated with the documented script, not edited by hand.
282282
- [ ] **Commits** follow [Conventional Commits](#commit-messages) and are [cryptographically signed](#signed-commits-required) (`git commit -S`, GPG/SSH).
@@ -311,7 +311,7 @@ This runs the full test suite across all supported Robot Framework versions usin
311311
`test:test` runs every Robot Framework version with your default Python, also the versions that do not officially support it (see "Supported Python and Robot Framework versions" below). Robot Framework itself may fail in such a combination: for example, Robot Framework 7.2 and older cannot load their XML library on Python 3.15. The CI, which runs only the supported combinations, is authoritative.
312312

313313
> [!NOTE]
314-
> **Documentation-only or other non-code changes** (typo fixes, prose, Markdown docs) need neither the test matrix nor linting: `hatch run lint:all` only checks source code (ruff/mypy for Python, eslint for JS/TS), there is no Markdown linter, and the pre-commit hooks skip automatically when no code files are staged. Run the tests and linting whenever you touch source code, even slightly.
314+
> **Documentation-only or other non-code changes** (typo fixes, prose, Markdown docs) need neither the test matrix nor linting: `hatch run lint:all` and `npm run lint` only check source code (ruff/mypy for Python, ESLint for JS/TS), there is no Markdown linter, and the pre-commit hooks skip automatically when no code files are staged. Run the tests and linting whenever you touch source code, even slightly.
315315
316316
**Fast iteration during development:**
317317

@@ -367,7 +367,7 @@ cd intellij-client
367367
The CI workflow `build test and package` (`.github/workflows/build-test-package.yml`) runs for pull requests and pushes to `main`:
368368

369369
- on Linux, Windows and macOS: the Python tests with every supported Python and Robot Framework combination, the VS Code extension's tests with the minimum and the newest stable VS Code, and the PyCharm plugin's tests;
370-
- on Linux: `hatch run lint:style`, `hatch run lint:typing` and the plugin verifier.
370+
- on Linux: `hatch run lint:style`, `hatch run lint:typing`, `npm run lint` and the plugin verifier.
371371

372372
The packages are only built when all tests pass. Since every test suite runs on all three systems, write tests that pass on each of them: create files in a temporary directory, such as pytest's `tmp_path`, instead of fixed paths like `/tmp/...`, and don't depend on path separators, line endings or the form of file URIs.
373373

@@ -402,7 +402,7 @@ These commands are mainly used by maintainers, but contributors may need some of
402402

403403
**Code Quality & Linting:**
404404
- `hatch run lint:typing` — Type checking with mypy.
405-
- `hatch run lint:style` — Code style check and formatting.
405+
- `hatch run lint:style` — Code style and formatting check.
406406
- `hatch run lint:all` — Run all linting checks.
407407

408408
**Code Generation:**

0 commit comments

Comments
 (0)