Skip to content

Commit dcc3791

Browse files
committed
Add tests
1 parent e331cb8 commit dcc3791

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

.github/workflows/test_pyprima.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Test Python
2+
3+
on:
4+
# Trigger the workflow on push or pull request
5+
#push:
6+
pull_request: # DANGEROUS! MUST be disabled for self-hosted runners!
7+
# Trigger the workflow by cron. The default time zone of GitHub Actions is UTC.
8+
schedule:
9+
- cron: '0 16 4-31/4 * *'
10+
# Trigger the workflow manually
11+
workflow_dispatch:
12+
13+
14+
jobs:
15+
16+
test:
17+
name: Run PyPRIMA tests
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
os: [ubuntu-latest, windows-latest, macos-latest]
23+
solver: [cobyla]
24+
testdim: [small]
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/[email protected]
29+
with:
30+
submodules: recursive
31+
# ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS
32+
# As of 230425, checkout with ssh fails frequently on Windows runners.
33+
34+
- name: Setup Python
35+
uses: actions/setup-python@v3
36+
with:
37+
python-version: "3.12"
38+
39+
- name: Install dependencies
40+
run: |
41+
python -m pip install --upgrade pip
42+
pip install numpy pytest scipy
43+
44+
- name: Conduct the test
45+
# shell: bash # Important; otherwise, `<` will not work on Windows.
46+
run: |
47+
cd "$ROOT_DIR"/pyprima
48+
pytest --cov=src --cov-report=html tests/
49+
PRIMA_DEBUGGING=1 pytest --cov=src --cov-append tests/test_end_to_end.py
50+
51+
52+
- name: Store artifacts
53+
uses: actions/[email protected]
54+
if: always() # Always run even if the workflow is canceled manually or due to overtime.
55+
# Note that `$TEST_DIR` does not work on Windows, where its equivalent is `$env:TEST_DIR`.
56+
# In the following, we enquire `$TEST_DIR` by using the `env` context, which is platform independent.
57+
with:
58+
path: ${{ env.TEST_DIR }}/pyprima/htmlcov/*

0 commit comments

Comments
 (0)