Skip to content

Commit b89fc7d

Browse files
authored
Merge pull request #45 from europanite/feature/wsl
Feature/wsl
2 parents 1c1ee4b + 87d5c9f commit b89fc7d

File tree

10 files changed

+136
-7
lines changed

10 files changed

+136
-7
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ concurrency:
1010
cancel-in-progress: true
1111
jobs:
1212
build-test-images:
13-
runs-on: ubuntu-latest
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
os: [ ubuntu-latest ]
1418
steps:
1519
- uses: actions/checkout@v4
1620
- name: Set up Docker Buildx
@@ -31,7 +35,11 @@ jobs:
3135
name: test-images
3236
path: service-test.tar.gz
3337
service-tests:
34-
runs-on: ubuntu-latest
38+
runs-on: ${{ matrix.os }}
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
os: [ ubuntu-latest ]
3543
needs: build-test-images
3644
steps:
3745
- uses: actions/checkout@v4

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ on:
1717
pull_request:
1818
branches: [ "main" ]
1919
schedule:
20-
- cron: '32 14 * * 1'
20+
- cron: '0 0 * * *'
2121

2222
jobs:
2323
analyze:

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
os: [ ubuntu-latest ]
17+
os: [ ubuntu-latest, windows-latest ]
1818
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
1919
steps:
2020
- uses: actions/checkout@v4

.github/workflows/pytest.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Pytest
2+
on:
3+
push:
4+
pull_request:
5+
workflow_dispatch:
6+
schedule:
7+
- cron: '0 0 * * *'
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
jobs:
12+
tests:
13+
name: pytest - ${{ matrix.os }} - py${{ matrix.python-version }}
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
os: [ ubuntu-latest, windows-latest ]
19+
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
20+
env:
21+
PYTHONUTF8: "1"
22+
PYTHONPATH: ${{ github.workspace }}/service
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Set up Python
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
cache: "pip"
32+
33+
- name: Install deps (Ubuntu)
34+
if: matrix.os == 'ubuntu-latest'
35+
shell: bash
36+
run: |
37+
set -eux
38+
python -m pip install -U pip
39+
pip install -r service/requirements.test.txt
40+
if [ -f service/pyproject.toml ] || [ -f service/setup.cfg ] || [ -f service/setup.py ]; then
41+
pip install -e service
42+
fi
43+
- name: Install deps (Windows)
44+
if: matrix.os == 'windows-latest'
45+
shell: pwsh
46+
run: |
47+
$ErrorActionPreference = "Stop"
48+
python -m pip install -U pip
49+
pip install -r service/requirements.test.txt
50+
$hasPythonProject = (Test-Path -Path 'service/pyproject.toml') -or
51+
(Test-Path -Path 'service/setup.cfg') -or
52+
(Test-Path -Path 'service/setup.py')
53+
if ($hasPythonProject) {
54+
python -m pip install -e service
55+
} else {
56+
Write-Host 'service packaging files not found; skipping'
57+
}
58+
- name: Show versions
59+
shell: bash
60+
run: |
61+
python --version
62+
pip --version
63+
pytest --version
64+
python -c "import sys,platform,os;print(platform.platform());print(sys.version);print('PYTHONPATH=',os.environ.get('PYTHONPATH'))"
65+
- name: Run tests with coverage
66+
shell: bash
67+
run: |
68+
python -m coverage run -m pytest -q
69+
python -m coverage xml -o coverage.xml
70+
- name: Upload coverage.xml
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: coverage-${{ matrix.os }}-py${{ matrix.python-version }}
74+
path: coverage.xml
75+
if-no-files-found: error
76+

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
[![CI](https://github.com/europanite/standard_python_environment/actions/workflows/ci.yml/badge.svg)](https://github.com/europanite/standard_python_environment/actions/workflows/ci.yml)
44
[![Python Lint](https://github.com/europanite/standard_python_environment/actions/workflows/lint.yml/badge.svg)](https://github.com/europanite/standard_python_environment/actions/workflows/lint.yml)
5+
[![Pytest](https://github.com/europanite/standard_python_environment/actions/workflows/pytest.yml/badge.svg)](https://github.com/europanite/standard_python_environment/actions/workflows/pytest.yml)
56
[![pages-build-deployment](https://github.com/europanite/standard_python_environment/actions/workflows/pages/pages-build-deployment/badge.svg)](https://github.com/europanite/standard_python_environment/actions/workflows/pages/pages-build-deployment)
67
[![CodeQL Advanced](https://github.com/europanite/standard_python_environment/actions/workflows/codeql.yml/badge.svg)](https://github.com/europanite/standard_python_environment/actions/workflows/codeql.yml)
78

docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ services:
2020
--port=8888
2121
--no-browser
2222
--NotebookApp.token=''
23-
--notebook-dir=/NotebookApp
2423
volumes:
2524
- /tmp/.X11-unix:/tmp/.X11-unix
2625
- ./service/app:/app

service/app/main.ipynb

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,38 @@
1818
"# write your code.\n",
1919
"print(\"Hello Jupyter\")"
2020
]
21+
},
22+
{
23+
"cell_type": "code",
24+
"execution_count": null,
25+
"id": "c9833438-76bb-4358-8771-9ee2f0e96c18",
26+
"metadata": {},
27+
"outputs": [],
28+
"source": []
29+
},
30+
{
31+
"cell_type": "code",
32+
"execution_count": null,
33+
"id": "5acecb0d-c4a4-4108-946a-9d4bd59cd45c",
34+
"metadata": {},
35+
"outputs": [],
36+
"source": []
37+
},
38+
{
39+
"cell_type": "code",
40+
"execution_count": null,
41+
"id": "3fd2a5e2-5a62-4159-ab9a-385476aee2c9",
42+
"metadata": {},
43+
"outputs": [],
44+
"source": []
45+
},
46+
{
47+
"cell_type": "code",
48+
"execution_count": null,
49+
"id": "934e26ad-62df-4b70-b531-992684787463",
50+
"metadata": {},
51+
"outputs": [],
52+
"source": []
2153
}
2254
],
2355
"metadata": {
@@ -36,7 +68,7 @@
3668
"name": "python",
3769
"nbconvert_exporter": "python",
3870
"pygments_lexer": "ipython3",
39-
"version": "3.12.11"
71+
"version": "3.12.12"
4072
}
4173
},
4274
"nbformat": 4,

service/app/tests/test_notebook.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
def test_workspace_notebook_runs_and_prints_hello():
9-
nb_path = Path("/app/main.ipynb")
9+
nb_path = Path(__file__).resolve().parents[1] / "main.ipynb"
1010
assert nb_path.exists(), f"Notebook not found: {nb_path}"
1111

1212
nb = nbformat.read(str(nb_path), as_version=4)

service/pyproject.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,15 @@ exclude = [
1414
[tool.ruff.lint]
1515
select = ["E", "F", "I"]
1616
ignore = []
17+
18+
[build-system]
19+
requires = ["setuptools>=68", "wheel"]
20+
build-backend = "setuptools.build_meta"
21+
22+
[project]
23+
name = "standard_python_environment"
24+
version = "0.0.0"
25+
requires-python = ">=3.9"
26+
27+
[tool.setuptools]
28+
packages = ["app", "data"]

service/requirements.test.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# write required libraries.
2+
-r requirements.txt
23
pytest==8.4.2
34
pytest-cov==5.0.0
45
ruff==0.13.1

0 commit comments

Comments
 (0)