Skip to content

Commit 457b49d

Browse files
committed
Refactor GitHub Actions workflow for testing with PyTest
- Updated Python versions to test on 3.9, 3.10, and 3.11, replacing older versions (3.6, 3.7, 3.8). - Migrated from `setup-python@v2` to `setup-python@v4` for improved support and compatibility. - Introduced virtual environment (`venv`) for isolating dependencies in each job. - Adding a java installation with `setup-java@v3` for consistent JDK 21 setup. - Added verification steps for installed dependencies and environment details. - Updated the runner to Ubuntu 22.04 for a more modern and supported environment.
1 parent deadcbc commit 457b49d

File tree

1 file changed

+29
-10
lines changed

1 file changed

+29
-10
lines changed

.github/workflows/test.yml

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,49 @@ on:
1212
jobs:
1313
build:
1414

15-
runs-on: ubuntu-20.04
15+
runs-on: ubuntu-22.04
1616
strategy:
1717
matrix:
18-
python-version: [3.6, 3.7, 3.8]
18+
python-version: ["3.9", "3.10", "3.11"]
1919

2020
steps:
2121
- uses: actions/checkout@v2
22+
2223
- name: Set up Python ${{ matrix.python-version }}
23-
uses: actions/setup-python@v2
24+
uses: actions/setup-python@v4
2425
with:
2526
python-version: ${{ matrix.python-version }}
27+
28+
- name: Set up JDK 21
29+
uses: actions/setup-java@v3
30+
with:
31+
distribution: 'temurin'
32+
java-version: '21'
33+
34+
- name: Create and activate virtualenv
35+
run: |
36+
python -m venv venv
37+
source venv/bin/activate
38+
python -m pip install --upgrade pip
39+
2640
- name: Install dependencies
2741
run: |
28-
python -m pip install --upgrade pip setuptools wheel build
29-
pip install pytest pytest-xdist # Testing packages
42+
source venv/bin/activate
43+
pip install setuptools wheel build pytest pytest-xdist
3044
python -m build --sdist --wheel
31-
pip install dist/*.whl # Run pytest
45+
pip install dist/*.whl
46+
47+
- name: Verify installed packages
48+
run: |
49+
source venv/bin/activate
50+
pip list
51+
3252
- name: Import language_tool_python
3353
run: |
54+
source venv/bin/activate
3455
printf "import language_tool_python\n" | python
56+
3557
- name: Test with pytest
3658
run: |
59+
source venv/bin/activate
3760
pytest -vx --dist=loadfile -n auto
38-
#- name: Run command-line tests
39-
# run: |
40-
# ./tests/test_local.bash # Test command-line with local server
41-
# ./tests/test_remote.bash # Test command-line with remote server

0 commit comments

Comments
 (0)