diff --git a/conda_build_config.yaml b/.conda/conda_build_config.yaml similarity index 100% rename from conda_build_config.yaml rename to .conda/conda_build_config.yaml diff --git a/.conda/meta.yaml b/.conda/meta.yaml index abec48667..a40d6ceba 100644 --- a/.conda/meta.yaml +++ b/.conda/meta.yaml @@ -27,6 +27,7 @@ requirements: - python - pip run: + - numpy {% for req in data.get('install_requires', []) %} - {{ req }} {% endfor %} @@ -63,7 +64,8 @@ outputs: host: - python run: - - python >=3.9,<4.0 + - python + - numpy {% for req in data.get('api_requirements', []) %} - {{ req }} {% endfor %} @@ -81,7 +83,8 @@ outputs: host: - python run: - - python >=3.9,<4.0 + - python + - numpy {% for req in data.get('dev_requirements', []) %} - {{ req }} {% endfor %} diff --git a/.github/workflows/_before-conda.yaml b/.github/workflows/_before-conda.yaml index 194295279..b84e5c482 100644 --- a/.github/workflows/_before-conda.yaml +++ b/.github/workflows/_before-conda.yaml @@ -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 @@ -99,7 +99,6 @@ jobs: mkdir -p ~/conda-rel conda build \ .conda \ - --use-local \ --build-only \ --croot ~/conda-bld \ --cache-dir ~/conda-cache \ diff --git a/.github/workflows/_before.yaml b/.github/workflows/_before-pip.yaml similarity index 67% rename from .github/workflows/_before.yaml rename to .github/workflows/_before-pip.yaml index 1aab3a6c5..02554419c 100644 --- a/.github/workflows/_before.yaml +++ b/.github/workflows/_before-pip.yaml @@ -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 @@ -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: | @@ -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 @@ -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: | diff --git a/.github/workflows/_lint.yaml b/.github/workflows/_lint-pip.yaml similarity index 86% rename from .github/workflows/_lint.yaml rename to .github/workflows/_lint-pip.yaml index ea7411e67..e994f473e 100644 --- a/.github/workflows/_lint.yaml +++ b/.github/workflows/_lint-pip.yaml @@ -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. @@ -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: | diff --git a/.github/workflows/_test-conda.yaml b/.github/workflows/_test-conda.yaml new file mode 100644 index 000000000..0daa437fa --- /dev/null +++ b/.github/workflows/_test-conda.yaml @@ -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 diff --git a/.github/workflows/_test.yaml b/.github/workflows/_test-pip.yaml similarity index 82% rename from .github/workflows/_test.yaml rename to .github/workflows/_test-pip.yaml index 7133ff8c3..704c7fbd1 100644 --- a/.github/workflows/_test.yaml +++ b/.github/workflows/_test-pip.yaml @@ -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. @@ -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: | diff --git a/.github/workflows/merge.yaml b/.github/workflows/merge.yaml index cb66e6247..d44ffce0f 100644 --- a/.github/workflows/merge.yaml +++ b/.github/workflows/merge.yaml @@ -9,7 +9,7 @@ concurrency: cancel-in-progress: true jobs: - setup: + setup-pip: strategy: fail-fast: true matrix: @@ -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: @@ -45,21 +52,29 @@ 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 }} @@ -67,7 +82,7 @@ jobs: 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 @@ -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: | diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 9699bd39e..2a8fbdef7 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -9,7 +9,7 @@ concurrency: cancel-in-progress: true jobs: - setup: + setup-pip: strategy: fail-fast: true matrix: @@ -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 }} @@ -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: @@ -52,21 +52,29 @@ 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 }} @@ -74,7 +82,7 @@ jobs: 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