Skip to content

Commit bbf342f

Browse files
authored
ci: add matrix & fix conda (#1257)
2 parents 0c3544a + 7fddb18 commit bbf342f

File tree

25 files changed

+578
-196
lines changed

25 files changed

+578
-196
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
numpy:
2+
- 1.24
3+
- 1.25
4+
- 1.26
5+
6+
python:
7+
- 3.9
8+
- 3.10
9+
- 3.11

.conda/meta.yaml renamed to .conda/openfisca-core/meta.yaml

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ package:
1212
version: {{ version }}
1313

1414
source:
15-
path: ..
15+
path: ../..
1616

1717
build:
1818
noarch: python
@@ -24,34 +24,23 @@ build:
2424

2525
requirements:
2626
host:
27-
- python
27+
- numpy
2828
- pip
29+
- python
30+
- setuptools >=61.0
2931
run:
30-
{% for req in data.get('install_requires', []) %}
32+
- numpy
33+
- python
34+
{% for req in data['install_requires'] %}
35+
{% if not req.startswith('numpy') %}
3136
- {{ req }}
37+
{% endif %}
3238
{% endfor %}
33-
# - PyYAML >=6.0,<7.0
34-
# - dpath >=2.1.4,<3.0.0
35-
# - importlib-metadata >=6.1.0,<7.0
36-
# - numexpr >=2.8.4,<=3.0
37-
# - numpy >=1.24.2,<1.25.0
38-
# - pendulum >=2.1.2,<3.0.0
39-
# - psutil >=5.9.4,<6.0.0
40-
# - pytest >=7.2.2,<8.0.0
41-
# - python >=3.9,<4.0
42-
# - sortedcontainers >=2.4.0
43-
# - typing-extensions >=4.5.0,<5.0
4439

4540
test:
4641
imports:
4742
- openfisca_core
4843
- openfisca_core.commons
49-
requires:
50-
- pip
51-
commands:
52-
- pip check
53-
- openfisca --help
54-
- openfisca-run-test --help
5544

5645
outputs:
5746
- name: openfisca-core
@@ -61,28 +50,27 @@ outputs:
6150
noarch: python
6251
requirements:
6352
host:
53+
- numpy
6454
- python
6555
run:
66-
- python >=3.9,<4.0
67-
{% for req in data.get('api_requirements', []) %}
56+
- numpy
57+
- python
58+
{% for req in data['extras_require']['web-api'] %}
6859
- {{ req }}
6960
{% endfor %}
70-
#
71-
# - flask >=2.2.3,<3.0
72-
# - flask-cors >=3.0.10,<4.0
73-
# - gunicorn >=20.1.0,<21.0.0
74-
# - werkzeug >=2.2.3,<3.0.0
7561
- {{ pin_subpackage('openfisca-core', exact=True) }}
7662

7763
- name: openfisca-core-dev
7864
build:
7965
noarch: python
8066
requirements:
8167
host:
68+
- numpy
8269
- python
8370
run:
84-
- python >=3.9,<4.0
85-
{% for req in data.get('dev_requirements', []) %}
71+
- numpy
72+
- python
73+
{% for req in data['extras_require']['dev'] %}
8674
- {{ req }}
8775
{% endfor %}
8876
- {{ pin_subpackage('openfisca-core-api', exact=True) }}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
schema_version: 1
2+
3+
context:
4+
name: openfisca-country-template
5+
version: 7.1.5
6+
7+
package:
8+
name: ${{ name|lower }}
9+
version: ${{ version }}
10+
11+
source:
12+
url: https://pypi.org/packages/source/${{ name[0] }}/${{ name }}/openfisca_country_template-${{ version }}.tar.gz
13+
sha256: b2f2ac9945d9ccad467aed0925bd82f7f4d5ce4e96b212324cd071b8bee46914
14+
15+
build:
16+
noarch: python
17+
script: pip install . -v
18+
19+
requirements:
20+
host:
21+
- numpy
22+
- pip
23+
- python
24+
- setuptools >=61.0
25+
run:
26+
- numpy
27+
- python
28+
- openfisca-core >=42,<43
29+
30+
tests:
31+
- python:
32+
imports:
33+
- openfisca_country_template
34+
35+
about:
36+
summary: OpenFisca Rules as Code model for Country-Template.
37+
license: AGPL-3.0
38+
license_file: LICENSE
39+
40+
extra:
41+
recipe-maintainers:
42+
- bonjourmauko
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
numpy:
2+
- "1.26"
3+
4+
python:
5+
- "3.9"
6+
- "3.10"
7+
- "3.11"
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
schema_version: 1
2+
3+
context:
4+
name: openfisca-extension-template
5+
version: 1.3.15
6+
7+
package:
8+
name: ${{ name|lower }}
9+
version: ${{ version }}
10+
11+
source:
12+
url: https://pypi.org/packages/source/${{ name[0] }}/${{ name }}/openfisca_extension_template-${{ version }}.tar.gz
13+
sha256: e16ee9cbefdd5e9ddc1c2c0e12bcd74307c8cb1be55353b3b2788d64a90a5df9
14+
15+
build:
16+
noarch: python
17+
script: pip install . -v
18+
19+
requirements:
20+
host:
21+
- numpy
22+
- pip
23+
- python
24+
- setuptools >=61.0
25+
run:
26+
- numpy
27+
- python
28+
- openfisca-country-template >=7,<8
29+
30+
tests:
31+
- python:
32+
imports:
33+
- openfisca_extension_template
34+
35+
about:
36+
summary: An OpenFisca extension that adds some variables to an already-existing
37+
tax and benefit system.
38+
license: AGPL-3.0
39+
license_file: LICENSE
40+
41+
extra:
42+
recipe-maintainers:
43+
- bonjourmauko
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
numpy:
2+
- "1.26"
3+
4+
python:
5+
- "3.9"
6+
- "3.10"
7+
- "3.11"
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
schema_version: 1
2+
3+
context:
4+
name: pylint-per-file-ignores
5+
version: 1.3.2
6+
7+
package:
8+
name: ${{ name|lower }}
9+
version: ${{ version }}
10+
11+
source:
12+
url: https://pypi.org/packages/source/${{ name[0] }}/${{ name }}/pylint_per_file_ignores-${{ version }}.tar.gz
13+
sha256: 3c641f69c316770749a8a353556504dae7469541cdaef38e195fe2228841451e
14+
15+
build:
16+
noarch: python
17+
script: pip install . -v
18+
19+
requirements:
20+
host:
21+
- python
22+
- poetry-core >=1.0.0
23+
- pip
24+
run:
25+
- pylint >=3.3.1,<4.0
26+
- python
27+
- tomli >=2.0.1,<3.0.0
28+
29+
tests:
30+
- python:
31+
imports:
32+
- pylint_per_file_ignores
33+
34+
about:
35+
summary: A pylint plugin to ignore error codes per file.
36+
license: MIT
37+
homepage: https://github.com/christopherpickering/pylint-per-file-ignores.git
38+
39+
extra:
40+
recipe-maintainers:
41+
- bonjourmauko
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
python:
2+
- "3.9"
3+
- "3.10"
4+
- "3.11"

.github/get_pypi_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def replace_in_file(filepath: str, info: dict) -> None:
7171
"-f",
7272
"--filename",
7373
type=str,
74-
default=".conda/meta.yaml",
74+
default=".conda/openfisca-core/meta.yaml",
7575
help="Path to meta.yaml, with filename",
7676
)
7777
args = parser.parse_args()
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: Setup conda
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
os:
7+
required: true
8+
type: string
9+
10+
numpy:
11+
required: true
12+
type: string
13+
14+
python:
15+
required: true
16+
type: string
17+
18+
defaults:
19+
run:
20+
shell: bash -l {0}
21+
22+
jobs:
23+
setup:
24+
runs-on: ${{ inputs.os }}
25+
name: conda-setup-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}
26+
env:
27+
# To colorize output of make tasks.
28+
TERM: xterm-256color
29+
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
34+
- name: Cache conda env
35+
uses: actions/cache@v4
36+
with:
37+
path: |
38+
/usr/share/miniconda/envs/openfisca
39+
~/.conda/envs/openfisca
40+
.env.yaml
41+
key: conda-env-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{ hashFiles('setup.py') }}
42+
restore-keys: conda-env-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-
43+
id: cache-env
44+
45+
- name: Cache conda deps
46+
uses: actions/cache@v4
47+
with:
48+
path: ~/conda_pkgs_dir
49+
key: conda-deps-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{ hashFiles('setup.py') }}
50+
restore-keys: conda-deps-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-
51+
id: cache-deps
52+
53+
- name: Cache release
54+
uses: actions/cache@v4
55+
with:
56+
path: ~/conda-rel
57+
key: conda-release-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{ hashFiles('setup.py') }}-${{ github.sha }}
58+
59+
- name: Setup conda
60+
uses: conda-incubator/setup-miniconda@v3
61+
with:
62+
activate-environment: openfisca
63+
miniforge-version: latest
64+
python-version: ${{ inputs.python }}
65+
use-mamba: true
66+
if: steps.cache-env.outputs.cache-hit != 'true'
67+
68+
- name: Install dependencies
69+
run: mamba install boa rattler-build anaconda-client
70+
if: steps.cache-env.outputs.cache-hit != 'true'
71+
72+
- name: Update conda & dependencies
73+
uses: conda-incubator/setup-miniconda@v3
74+
with:
75+
activate-environment: openfisca
76+
environment-file: .env.yaml
77+
miniforge-version: latest
78+
use-mamba: true
79+
if: steps.cache-env.outputs.cache-hit == 'true'
80+
81+
- name: Build pylint plugin package
82+
run: |
83+
rattler-build build \
84+
--recipe .conda/pylint-per-file-ignores \
85+
--output-dir ~/conda-rel
86+
87+
- name: Build core package
88+
run: |
89+
conda mambabuild .conda/openfisca-core \
90+
--use-local \
91+
--no-anaconda-upload \
92+
--output-folder ~/conda-rel \
93+
--numpy ${{ inputs.numpy }} \
94+
--python ${{ inputs.python }}
95+
96+
- name: Build country template package
97+
run: |
98+
rattler-build build \
99+
--recipe .conda/openfisca-country-template \
100+
--output-dir ~/conda-rel \
101+
102+
- name: Build extension template package
103+
run: |
104+
rattler-build build \
105+
--recipe .conda/openfisca-extension-template \
106+
--output-dir ~/conda-rel
107+
108+
- name: Export env
109+
run: mamba env export --name openfisca > .env.yaml

0 commit comments

Comments
 (0)