Skip to content

Commit 5d57c1e

Browse files
🚀 Simplify environments in actions and doc building (unique dev env reference) (#73)
Co-authored-by: Fabien Casenave <fabien.casenave@safrangroup.com>
1 parent 80a1a4e commit 5d57c1e

10 files changed

Lines changed: 40 additions & 142 deletions

File tree

‎.github/workflows/conda_envs/python3.11.yml‎

Lines changed: 0 additions & 17 deletions
This file was deleted.

‎.github/workflows/conda_envs/python3.12.yml‎

Lines changed: 0 additions & 17 deletions
This file was deleted.

‎.github/workflows/doc.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626

2727
- name: Create environment
2828
run: |
29-
mamba env create -f docs/requirements.yml
29+
mamba env create -f environment.yml
3030
mamba run -n plaid pip install -e .
3131
3232
- name: Compile documentation

‎.github/workflows/publish-pypi.yml‎

Lines changed: 3 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -5,59 +5,8 @@ on:
55
types: [created]
66

77
jobs:
8-
test:
9-
name: test
10-
permissions:
11-
contents: read
12-
runs-on: ${{ matrix.os }}
13-
strategy:
14-
matrix:
15-
os: [ubuntu-latest, macos-latest, windows-latest]
16-
python-version: [3.11, 3.12]
17-
18-
steps:
19-
- name: Checkout code
20-
uses: actions/checkout@v3
21-
22-
- name: Set up Conda with Mamba
23-
uses: conda-incubator/setup-miniconda@v2
24-
with:
25-
use-mamba: true
26-
auto-activate-base: false
27-
miniforge-variant: Miniforge3
28-
29-
- name: Create environment
30-
run: |
31-
mamba env create -f .github/workflows/conda_envs/python${{ matrix.python-version }}.yml
32-
mamba run -n plaid_python${{ matrix.python-version }} pip install -e .
33-
34-
- name: Run tests on Unix
35-
if: runner.os != 'Windows'
36-
run: |
37-
mamba run -n plaid_python${{ matrix.python-version }} pytest tests
38-
39-
- name: Run tests on Windows
40-
if: runner.os == 'Windows'
41-
shell: powershell
42-
run: |
43-
mamba run -n plaid_python${{ matrix.python-version }} pytest tests
44-
45-
- name: Run examples on Unix
46-
if: runner.os != 'Windows'
47-
run: |
48-
cd examples
49-
mamba run -n plaid_python${{ matrix.python-version }} bash run_examples.sh
50-
51-
- name: Run examples on Windows
52-
if: runner.os == 'Windows'
53-
shell: powershell
54-
run: |
55-
cd examples
56-
mamba run -n plaid_python${{ matrix.python-version }} run_examples.bat
57-
588
build:
59-
name: Build wheels for multiple Python versions
60-
needs: test
9+
name: Build wheels
6110
permissions:
6211
contents: read
6312
runs-on: ubuntu-latest
@@ -73,7 +22,7 @@ jobs:
7322
- name: Set up Python
7423
uses: actions/setup-python@v4
7524
with:
76-
python-version: "3.12"
25+
python-version: "3.11"
7726

7827
- name: Install build tools
7928
run: |
@@ -96,7 +45,7 @@ jobs:
9645
9746
- uses: actions/upload-artifact@v4
9847
with:
99-
name: wheels-3.12
48+
name: wheels-3.11
10049
path: dist/*.whl
10150

10251
publish:

‎.github/workflows/testing.yml‎

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,41 +22,61 @@ jobs:
2222
- name: Checkout code
2323
uses: actions/checkout@v3
2424

25-
- name: Set up Conda with Mamba
25+
- name: Set up Conda
2626
uses: conda-incubator/setup-miniconda@v2
2727
with:
28-
use-mamba: true
28+
use-mamba: false
29+
python-version: 3.11
2930
auto-activate-base: false
3031
miniforge-variant: Miniforge3
3132

33+
- name: Modify environment.yml with matrix Python version (Linux/macOS)
34+
if: runner.os != 'Windows'
35+
run: |
36+
python_version=${{ matrix.python-version }}
37+
sed -i.bak "s/^ - python=.*/ - python=${python_version}/" environment.yml
38+
39+
- name: Modify environment.yml with matrix Python version (Windows)
40+
if: runner.os == 'Windows'
41+
shell: powershell
42+
run: |
43+
$python_version = '${{ matrix.python-version }}'
44+
$file = 'environment.yml'
45+
(Get-Content $file) -replace '^\s+- python=.*', " - python=$python_version" | Set-Content $file
46+
3247
- name: Create environment
3348
run: |
34-
mamba env create -f .github/workflows/conda_envs/python${{ matrix.python-version }}.yml
35-
mamba run -n plaid_python${{ matrix.python-version }} pip install -e .
49+
conda env create -n plaid-dev -f environment.yml
50+
conda run -n plaid-dev pip install -e .
3651
37-
- name: Run tests on Unix
38-
if: runner.os != 'Windows'
52+
- name: Run tests on Linux
53+
if: runner.os == 'Linux'
3954
run: |
40-
mamba run -n plaid_python${{ matrix.python-version }} pytest tests --cov=src --cov-report=xml --cov-report=term
55+
conda run -n plaid-dev pytest tests --cov=src --cov-report=xml --cov-report=term
56+
57+
- name: Run tests on macOS
58+
if: runner.os == 'macOS'
59+
run: |
60+
conda run -n plaid-dev pytest tests
4161
4262
- name: Run tests on Windows
4363
if: runner.os == 'Windows'
4464
shell: powershell
4565
run: |
46-
mamba run -n plaid_python${{ matrix.python-version }} pytest tests
66+
conda run -n plaid-dev pytest tests
4767
4868
- name: Run examples on Unix
4969
if: runner.os != 'Windows'
5070
run: |
5171
cd examples
52-
mamba run -n plaid_python${{ matrix.python-version }} bash run_examples.sh
72+
conda run -n plaid-dev bash run_examples.sh
5373
5474
- name: Run examples on Windows
5575
if: runner.os == 'Windows'
5676
shell: powershell
5777
run: |
5878
cd examples
59-
mamba run -n plaid_python${{ matrix.python-version }} run_examples.bat
79+
conda run -n plaid-dev run_examples.bat
6080
6181
- name: Upload coverage to Codecov (Linux only)
6282
if: runner.os == 'Linux'
@@ -65,15 +85,4 @@ jobs:
6585
files: coverage.xml
6686
token: ${{ secrets.CODECOV_TOKEN }}
6787
name: python-${{ matrix.python-version }}
68-
verbose: true
69-
70-
# - name: Set up Miniconda
71-
# uses: conda-incubator/setup-miniconda@v2
72-
# with:
73-
# miniforge-variant: Miniforge3
74-
# miniforge-version: latest
75-
# use-mamba: true
76-
# auto-activate-base: false
77-
# auto-update-conda: true
78-
# activate-environment: plaid_python${{ matrix.python-version }}
79-
# environment-file: .github/workflows/conda_envs/python${{ matrix.python-version }}.yml
88+
verbose: true

‎.readthedocs.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ sphinx:
88
configuration: docs/conf.py
99

1010
conda:
11-
environment: docs/requirements.yml
11+
environment: environment.yml
1212

1313
build:
14-
os: "ubuntu-20.04"
14+
os: "ubuntu-22.04"
1515
tools:
1616
python: "mambaforge-4.10"
1717

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ conda env create -f environment.yml
7373
Then, to install the library:
7474

7575
```bash
76-
pip install -e .[dev]
76+
pip install -e .
7777
```
7878

7979
**Note**

‎docs/requirements.yml‎

Lines changed: 0 additions & 26 deletions
This file was deleted.

‎docs/source/getting_started.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ conda env create -f environment.yml
4444
Then, to install the library:
4545

4646
```bash
47-
pip install -e .[dev]
47+
pip install -e .
4848
```
4949

5050
**Note**

‎environment.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ channels:
33
- conda-forge
44
- nodefaults
55
dependencies:
6-
- python=3.11
6+
- python=3.12
77
##### RUN #####
88
#---# base
99
- tqdm

0 commit comments

Comments
 (0)