Skip to content

Commit 8c0a8b8

Browse files
authored
Adds CI tests to the github runners for the emap-setup directory
Adding emap-setup tests to CI, tidy up and update tests and coverage.
1 parent 4883804 commit 8c0a8b8

14 files changed

+141
-36
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: emap setup tests
2+
on:
3+
push:
4+
branches: [ main, develop ]
5+
pull_request:
6+
branches: [ main, develop, sk/waveform-dev ]
7+
repository_dispatch:
8+
permissions:
9+
contents: read
10+
checks: write
11+
id-token: write
12+
pull-requests: read # needed by paths-filter
13+
jobs:
14+
filter:
15+
runs-on: ubuntu-latest
16+
outputs:
17+
emap-setup: ${{ steps.filter.outputs.emap-setup }}
18+
steps:
19+
- uses: actions/checkout@v3
20+
- uses: dorny/paths-filter@v2
21+
id: filter
22+
with:
23+
filters: |
24+
emap-setup:
25+
- '.github/**'
26+
- 'emap-checker.xml'
27+
- 'emap-setup/**'
28+
emap-setup-tests:
29+
needs: [filter]
30+
runs-on: ubuntu-latest
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GH_PAT_READ_AND_COMMENT }}
33+
if: needs.filter.outputs.emap-setup == 'true'
34+
steps:
35+
- uses: actions/checkout@v3
36+
- name: Set up python
37+
uses: actions/setup-python@v5
38+
with:
39+
python-version: '3.11'
40+
cache: "pip"
41+
- name: Install Python Dependencies
42+
run: |
43+
python -m pip install -r emap-setup/requirements.txt
44+
- name: Run tests
45+
run: |
46+
cd emap-setup
47+
pytest --cov=./ --cov-report=term

emap-setup/.coveragerc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[run]
2+
omit =
3+
__init__.py
4+
tests/*

emap-setup/emap_runner/setup/repos.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import git
2+
import os
23
import shutil
34

45
from pathlib import Path
@@ -118,6 +119,9 @@ def path(self) -> Path:
118119
@property
119120
def https_git_url(self) -> str:
120121
"""Generate a https URL. e.g. https://github.com/../emap-setup.git"""
122+
gh_token = os.environ.get('GITHUB_TOKEN', False)
123+
if gh_token:
124+
return f"https://{gh_token}@{self._base_git_url}/{self.name}"
121125
return f"https://{self._base_git_url}/{self.name}"
122126

123127
@property

emap-setup/requirements.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
pytest
2+
pytest-cov
3+
PyYAML
4+
gitpython
5+
black
6+
tqdm
7+
setuptools

emap-setup/requirements.txt

Lines changed: 57 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,57 @@
1-
pytest
2-
PyYAML
3-
gitpython
4-
black
5-
tqdm
1+
# This file was autogenerated by uv via the following command:
2+
# uv pip compile requirements.in -o requirements.txt
3+
black==25.9.0
4+
# via -r requirements.in
5+
click==8.3.0
6+
# via black
7+
coverage==7.10.7
8+
# via pytest-cov
9+
exceptiongroup==1.3.0
10+
# via pytest
11+
gitdb==4.0.12
12+
# via gitpython
13+
gitpython==3.1.45
14+
# via -r requirements.in
15+
iniconfig==2.1.0
16+
# via pytest
17+
mypy-extensions==1.1.0
18+
# via black
19+
packaging==25.0
20+
# via
21+
# black
22+
# pytest
23+
pathspec==0.12.1
24+
# via black
25+
platformdirs==4.4.0
26+
# via black
27+
pluggy==1.6.0
28+
# via
29+
# pytest
30+
# pytest-cov
31+
pygments==2.19.2
32+
# via pytest
33+
pytest==8.4.2
34+
# via
35+
# -r requirements.in
36+
# pytest-cov
37+
pytest-cov==7.0.0
38+
# via -r requirements.in
39+
pytokens==0.1.10
40+
# via black
41+
pyyaml==6.0.2
42+
# via -r requirements.in
43+
setuptools==80.9.0
44+
# via -r requirements.in
45+
smmap==5.0.2
46+
# via gitdb
47+
tomli==2.2.1
48+
# via
49+
# black
50+
# coverage
51+
# pytest
52+
tqdm==4.67.1
53+
# via -r requirements.in
54+
typing-extensions==4.15.0
55+
# via
56+
# black
57+
# exceptiongroup

emap-setup/tests/data/config/config/.empty

Whitespace-only changes.

emap-setup/tests/data/Emap-Core/Emap-Core-config-envs.EXAMPLE renamed to emap-setup/tests/data/emap/Emap-Core-config-envs.EXAMPLE

File renamed without changes.

emap-setup/tests/data/Emap-Core/global-config-envs.EXAMPLE renamed to emap-setup/tests/data/emap/global-config-envs.EXAMPLE

File renamed without changes.

emap-setup/tests/data/Emap-Core/rabbitmq-config-envs.EXAMPLE renamed to emap-setup/tests/data/emap/rabbitmq-config-envs.EXAMPLE

File renamed without changes.

emap-setup/tests/data/test-global-configuration-only-docs.yaml

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

88
repositories:
9-
emap_documentation:
9+
internal_emap_documentation:
1010
branch: main
1111
# For testing outside the GAE, you can enable a fake UDS
1212
fake_uds:

0 commit comments

Comments
 (0)