Skip to content

Commit

Permalink
ci: test conda
Browse files Browse the repository at this point in the history
  • Loading branch information
bonjourmauko committed Oct 3, 2024
1 parent 2c8d90e commit bd01a00
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 42 deletions.
File renamed without changes.
7 changes: 5 additions & 2 deletions .conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ requirements:
- python
- pip
run:
- numpy
{% for req in data.get('install_requires', []) %}
- {{ req }}
{% endfor %}
Expand Down Expand Up @@ -63,7 +64,8 @@ outputs:
host:
- python
run:
- python >=3.9,<4.0
- python
- numpy
{% for req in data.get('api_requirements', []) %}
- {{ req }}
{% endfor %}
Expand All @@ -81,7 +83,8 @@ outputs:
host:
- python
run:
- python >=3.9,<4.0
- python
- numpy
{% for req in data.get('dev_requirements', []) %}
- {{ req }}
{% endfor %}
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/_before-conda.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ defaults:
shell: bash -l {0}

jobs:
setup-conda:
setup:
runs-on: ${{ inputs.os }}
name: setup-conda-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}
name: conda-setup-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}
env:
# To colorize output of make tasks.
TERM: xterm-256color
Expand Down Expand Up @@ -99,7 +99,6 @@ jobs:
mkdir -p ~/conda-rel
conda build \
.conda \
--use-local \
--build-only \
--croot ~/conda-bld \
--cache-dir ~/conda-cache \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ on:
jobs:
deps:
runs-on: ${{ inputs.os }}
name: deps-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}
name: pip-deps-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}
env:
# To colorize output of make tasks.
TERM: xterm-256color
Expand All @@ -45,8 +45,8 @@ jobs:
uses: actions/cache@v4
with:
path: venv
key: deps-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{ hashFiles('setup.py') }}
restore-keys: deps-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-
key: pip-deps-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{ hashFiles('setup.py') }}
restore-keys: pip-deps-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-

- name: Install dependencies
run: |
Expand All @@ -58,7 +58,7 @@ jobs:
build:
runs-on: ${{ inputs.os }}
needs: [deps]
name: build-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}
name: pip-build-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}
env:
TERM: xterm-256color

Expand All @@ -80,22 +80,22 @@ jobs:
uses: actions/cache@v4
with:
path: venv
key: deps-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{ hashFiles('setup.py') }}
key: pip-deps-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{ hashFiles('setup.py') }}

- name: Cache build
uses: actions/cache@v4
with:
path: venv/**/[Oo]pen[Ff]isca*
key: build-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{ hashFiles('setup.py') }}-${{ github.sha }}
key: pip-build-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{ hashFiles('setup.py') }}-${{ github.sha }}
restore-keys: |
build-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{ hashFiles('setup.py') }}-
build-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-
pip-build-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{ hashFiles('setup.py') }}-
pip-build-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-
- name: Cache release
uses: actions/cache@v4
with:
path: dist
key: release-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{ hashFiles('setup.py') }}-${{ github.sha }}
key: pip-release-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{ hashFiles('setup.py') }}-${{ github.sha }}

- name: Build package
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ on:
jobs:
lint:
runs-on: ${{ inputs.os }}
name: lint-doc-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}
name: pip-lint-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}
env:
TERM: xterm-256color # To colorize output of make tasks.

Expand All @@ -44,7 +44,7 @@ jobs:
uses: actions/cache@v4
with:
path: venv
key: deps-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{ hashFiles('setup.py') }}
key: pip-deps-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{ hashFiles('setup.py') }}

- name: Lint doc
run: |
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/_test-conda.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Test conda package

on:
workflow_call:
inputs:
os:
required: true
type: string

numpy:
required: true
type: string

python:
required: true
type: string

defaults:
run:
shell: bash -l {0}

jobs:
test:
runs-on: ${{ inputs.os }}
name: conda-test-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}
env:
TERM: xterm-256color # To colorize output of make tasks.

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install OpenFisca-Core
run: conda install --use-local --name openfisca openfisca-core-dev

- name: Run OpenFisca-Core tests
run: make test-core

- name: Run Country Template tests
if: ${{ startsWith(inputs.os, 'ubuntu') }}
run: make test-country

- name: Run Extension Template tests
if: ${{ startsWith(inputs.os, 'ubuntu') }}
run: make test-extension
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ on:
jobs:
test:
runs-on: ${{ inputs.os }}
name: test-core-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}
name: pip-test-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TERM: xterm-256color # To colorize output of make tasks.
Expand All @@ -45,13 +45,13 @@ jobs:
uses: actions/cache@v4
with:
path: venv
key: deps-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{ hashFiles('setup.py') }}
key: pip-deps-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{ hashFiles('setup.py') }}

- name: Cache build
uses: actions/cache@v4
with:
path: venv/**/[Oo]pen[Ff]isca*
key: build-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{ hashFiles('setup.py') }}-${{ github.sha }}
key: pip-build-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{ hashFiles('setup.py') }}-${{ github.sha }}

- name: Run Openfisca Core tests
run: |
Expand Down
41 changes: 27 additions & 14 deletions .github/workflows/merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ concurrency:
cancel-in-progress: true

jobs:
setup:
setup-pip:
strategy:
fail-fast: true
matrix:
Expand All @@ -25,15 +25,22 @@ jobs:
activate_command: source venv/bin/activate
- os: windows-2019
activate_command: .\venv\Scripts\activate
uses: ./.github/workflows/_before.yaml
uses: ./.github/workflows/_before-pip.yaml
with:
os: ${{ matrix.os }}
numpy: ${{ matrix.numpy }}
python: ${{ matrix.python }}
activate_command: ${{ matrix.activate_command }}

test:
needs: [setup]
setup-conda:
uses: ./.github/workflows/_before-conda.yaml
with:
os: ubuntu-22.04
numpy: 1.26.4
python: 3.10.6

test-pip:
needs: [setup-pip]
strategy:
fail-fast: true
matrix:
Expand All @@ -45,29 +52,37 @@ jobs:
activate_command: source venv/bin/activate
- os: windows-2019
activate_command: .\venv\Scripts\activate
uses: ./.github/workflows/_test.yaml
uses: ./.github/workflows/_test-pip.yaml
with:
os: ${{ matrix.os }}
numpy: ${{ matrix.numpy }}
python: ${{ matrix.python }}
activate_command: ${{ matrix.activate_command }}

lint:
needs: [setup]
test-conda:
uses: ./.github/workflows/_test-conda.yaml
needs: [setup-conda]
with:
os: ubuntu-22.04
numpy: 1.26.4
python: 3.10.6

lint-pip:
needs: [setup-pip]
strategy:
fail-fast: true
matrix:
numpy: [1.24.2]
python: [3.11.9, 3.9.13]
uses: ./.github/workflows/_lint.yaml
uses: ./.github/workflows/_lint-pip.yaml
with:
os: ubuntu-22.04
numpy: ${{ matrix.numpy }}
python: ${{ matrix.python }}
activate_command: source venv/bin/activate

check-version:
needs: [test, lint]
needs: [test-pip, test-conda, lint-pip]
uses: ./.github/workflows/_version.yaml
with:
os: ubuntu-22.04
Expand Down Expand Up @@ -126,21 +141,19 @@ jobs:
uses: actions/cache@v4
with:
path: venv
key: deps-ubuntu-22.04-np1.24.2-py3.9.13-${{ hashFiles('setup.py') }}
key: pip-deps-ubuntu-22.04-np1.24.2-py3.9.13-${{ hashFiles('setup.py') }}

- name: Cache build
uses: actions/cache@v4
with:
path: venv/**/[oO]pen[fF]isca*
key: build-ubuntu-22.04-np1.24.2-py3.9.13-${{ hashFiles('setup.py') }}-${{
github.sha }}
key: pip-build-ubuntu-22.04-np1.24.2-py3.9.13-${{ hashFiles('setup.py') }}-${{ github.sha }}

- name: Cache release
uses: actions/cache@v4
with:
path: dist
key: release-ubuntu-22.04-np1.24.2-py3.9.13-${{ hashFiles('setup.py') }}-${{
github.sha }}
key: pip-release-ubuntu-22.04-np1.24.2-py3.9.13-${{ hashFiles('setup.py') }}-${{ github.sha }}

- name: Upload package to PyPi
run: |
Expand Down
26 changes: 17 additions & 9 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ concurrency:
cancel-in-progress: true

jobs:
setup:
setup-pip:
strategy:
fail-fast: true
matrix:
Expand All @@ -25,7 +25,7 @@ jobs:
activate_command: source venv/bin/activate
- os: windows-2019
activate_command: .\venv\Scripts\activate
uses: ./.github/workflows/_before.yaml
uses: ./.github/workflows/_before-pip.yaml
with:
os: ${{ matrix.os }}
numpy: ${{ matrix.numpy }}
Expand All @@ -39,8 +39,8 @@ jobs:
numpy: 1.26.4
python: 3.10.6

test:
needs: [setup]
test-pip:
needs: [setup-pip]
strategy:
fail-fast: true
matrix:
Expand All @@ -52,29 +52,37 @@ jobs:
activate_command: source venv/bin/activate
- os: windows-2019
activate_command: .\venv\Scripts\activate
uses: ./.github/workflows/_test.yaml
uses: ./.github/workflows/_test-pip.yaml
with:
os: ${{ matrix.os }}
numpy: ${{ matrix.numpy }}
python: ${{ matrix.python }}
activate_command: ${{ matrix.activate_command }}

lint:
needs: [setup]
test-conda:
uses: ./.github/workflows/_test-conda.yaml
needs: [setup-conda]
with:
os: ubuntu-22.04
numpy: 1.26.4
python: 3.10.6

lint-pip:
needs: [setup-pip]
strategy:
fail-fast: true
matrix:
numpy: [1.24.2]
python: [3.11.9, 3.9.13]
uses: ./.github/workflows/_lint.yaml
uses: ./.github/workflows/_lint-pip.yaml
with:
os: ubuntu-22.04
numpy: ${{ matrix.numpy }}
python: ${{ matrix.python }}
activate_command: source venv/bin/activate

check-version:
needs: [test, lint, setup-conda]
needs: [test-pip, test-conda, lint-pip]
uses: ./.github/workflows/_version.yaml
with:
os: ubuntu-22.04
Expand Down

0 comments on commit bd01a00

Please sign in to comment.