Skip to content

Commit 2db7cc8

Browse files
authored
Merge pull request #47 from pythonhealthdatascience/dev
Dev
2 parents 17148fd + bfcfb84 commit 2db7cc8

30 files changed

+140656
-595
lines changed

.github/workflows/tests.yaml

Lines changed: 39 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,45 @@
1-
# This file runs the tests in `tests/`
2-
# They will run in parallel, and run on three operating systems:
3-
# Ubuntu, Windows and Mac.
4-
51
name: tests
62

73
on:
84
push:
95
branches: [main]
106
workflow_dispatch:
7+
inputs:
8+
operating_systems:
9+
description: 'Operating systems to test on'
10+
type: choice
11+
default: 'all'
12+
options:
13+
- all
14+
- ubuntu-latest
15+
- windows-latest
16+
- macos-latest
1117

1218
jobs:
13-
14-
# Run tests on Ubuntu
15-
tests-on-ubuntu:
19+
# Generate matrix based on input
20+
setup-matrix:
1621
runs-on: ubuntu-latest
22+
outputs:
23+
matrix: ${{ steps.set-matrix.outputs.matrix }}
1724
steps:
18-
19-
- name: Check out repository
20-
uses: actions/checkout@v4
21-
22-
- name: Install python and dependencies
23-
uses: actions/setup-python@v4
24-
with:
25-
python-version: '3.13'
26-
cache: 'pip'
27-
- run: pip install -r requirements.txt
28-
29-
- name: Run tests
30-
run: pytest
31-
32-
- name: List the environment variables
33-
run: env
34-
35-
# Run tests on Windows
36-
tests-on-windows:
37-
runs-on: windows-latest
25+
- name: Set matrix
26+
id: set-matrix
27+
run: |
28+
if [[ "${{ inputs.operating_systems }}" == "all" || "${{ github.event_name }}" == "push" ]]; then
29+
echo 'matrix=["ubuntu-latest", "windows-latest", "macos-latest"]' >> $GITHUB_OUTPUT
30+
else
31+
echo 'matrix=["${{ inputs.operating_systems }}"]' >> $GITHUB_OUTPUT
32+
fi
33+
34+
# Run tests using matrix strategy
35+
tests:
36+
needs: setup-matrix
37+
runs-on: ${{ matrix.os }}
38+
strategy:
39+
matrix:
40+
os: ${{ fromJSON(needs.setup-matrix.outputs.matrix) }}
41+
3842
steps:
39-
4043
- name: Check out repository
4144
uses: actions/checkout@v4
4245

@@ -45,31 +48,17 @@ jobs:
4548
with:
4649
python-version: '3.13'
4750
cache: 'pip'
48-
- run: python -m pip install -r requirements.txt
51+
52+
- name: Install requirements (Windows)
53+
if: runner.os == 'Windows'
54+
run: python -m pip install -r requirements.txt
55+
56+
- name: Install requirements (Unix)
57+
if: runner.os != 'Windows'
58+
run: pip install -r requirements.txt
4959

5060
- name: Run tests
5161
run: pytest
5262

5363
- name: List the environment variables
5464
run: env
55-
56-
# Run tests on Mac
57-
tests-on-macos:
58-
runs-on: macos-latest
59-
steps:
60-
61-
- name: Check out repository
62-
uses: actions/checkout@v4
63-
64-
- name: Install python and dependencies
65-
uses: actions/setup-python@v4
66-
with:
67-
python-version: '3.13'
68-
cache: 'pip'
69-
- run: pip install -r requirements.txt
70-
71-
- name: Run tests
72-
run: pytest
73-
74-
- name: List the environment variables
75-
run: env

CITATION.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ authors:
2020
affiliation: University of Exeter
2121
orcid: 'https://orcid.org/0000-0003-2631-4481'
2222
repository-code: >-
23-
https://github.com/pythonhealthdatascience/rap_template_python_des
23+
https://github.com/pythonhealthdatascience/pydesrap_mms
2424
abstract: >-
2525
A template for creating discrete-event simulation (DES) models in Python
2626
within a reproducible analytical pipeline (RAP).

0 commit comments

Comments
 (0)