Skip to content

Commit d14d66f

Browse files
GitHub Actions test
1 parent 359e2c8 commit d14d66f

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

.github/workflows/ci-tests.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: CI Tests
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Check out repository
15+
uses: actions/checkout@v3
16+
17+
- name: Set up Python 3.12
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: "3.12"
21+
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install -r requirements.txt
26+
27+
- name: Run pytest
28+
run: pytest --maxfail=1 --disable-warnings -v
29+
30+
env:
31+
XDOC_OPENAI_API_KEY: ${{ secrets.XDOC_OPENAI_API_KEY }}

tests/test_all.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@
5858
from xdoc.internal.loggers import logger, DISABLE_LOGGER_ENV_VAR_NAME
5959

6060

61-
load_dotenv()
61+
# If .env exists locally, it’ll be loaded. If it doesn’t exist (e.g. in CI),
62+
# no error is raised. Then fallback to environment variables set by the workflow.
63+
64+
load_dotenv() # This will silently skip if no .env is present
6265

6366

6467
@pytest.fixture(scope="module")

0 commit comments

Comments
 (0)