Skip to content

Commit bafd5cf

Browse files
authored
Merge pull request #62 from haasad/dynamic-requirements
Generate requirements.txt and environment.yml dynamically
2 parents ba79c42 + 4660182 commit bafd5cf

File tree

3 files changed

+45
-11
lines changed

3 files changed

+45
-11
lines changed

.github/workflows/tests.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,46 @@ on:
1212
- cron: '0 7 * * *'
1313

1414
jobs:
15+
16+
generate-requirement-files:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: create empty environment.yml
21+
run: |
22+
cat > environment.yml <<EOF
23+
name: pypardiso
24+
channels:
25+
- conda-forge
26+
dependencies:
27+
EOF
28+
- name: generate requirements
29+
uses: mikefarah/yq@master
30+
with:
31+
cmd: |
32+
yq '.project.dependencies' pyproject.toml -oy > reqs.yml
33+
cat reqs.yml >> environment.yml
34+
yq '.[]' reqs.yml > requirements.txt
35+
- name: Show requirement files
36+
run: |
37+
cat environment.yml
38+
echo
39+
cat requirements.txt
40+
- name: Upload environment.yml
41+
uses: actions/upload-artifact@v3
42+
with:
43+
name: environment.yml
44+
path: environment.yml
45+
- name: Upload requirements.txt
46+
uses: actions/upload-artifact@v3
47+
with:
48+
name: requirements.txt
49+
path: requirements.txt
50+
51+
1552
conda-tests:
1653
runs-on: ${{ matrix.os }}
54+
needs: generate-requirement-files
1755
strategy:
1856
fail-fast: false
1957
matrix:
@@ -22,6 +60,9 @@ jobs:
2260

2361
steps:
2462
- uses: actions/checkout@v4
63+
- uses: actions/download-artifact@v3
64+
with:
65+
name: environment.yml
2566
- name: Set up miniconda with python ${{ matrix.python-version }}
2667
uses: conda-incubator/setup-miniconda@v2
2768
with:
@@ -50,6 +91,7 @@ jobs:
5091
5192
pip-tests:
5293
runs-on: ${{ matrix.os }}
94+
needs: generate-requirement-files
5395
strategy:
5496
fail-fast: false
5597
matrix:
@@ -60,6 +102,9 @@ jobs:
60102
- uses: actions/setup-python@v4
61103
with:
62104
python-version: ${{ matrix.python-version }}
105+
- uses: actions/download-artifact@v3
106+
with:
107+
name: requirements.txt
63108
- name: Install dependencies
64109
run: |
65110
pip install -r requirements.txt

environment.yml

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

requirements.txt

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

0 commit comments

Comments
 (0)