Manage list parameter in Excel reform (#1357) #61
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: OpenFisca-Core / Deploy package to PyPi & Conda | |
| env: | |
| UPPER_PYTHON_VERSION: &upper_pyver 3.13.11 | |
| CONDA_PYTHON_VERSION: &conda_pyver 3.11.14 | |
| on: | |
| push: | |
| branches: [master] | |
| concurrency: | |
| group: ${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| setup-pip: | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| include: | |
| # NumPy 1.24.2 supports Python 3.8 to 3.11 | |
| # Numpy 2.0.2 supports Python 3.9 to 3.12 | |
| - os: ubuntu-24.04 | |
| numpy: 1.24.2 | |
| python: 3.10.11 | |
| activate_command: source venv/bin/activate | |
| - os: windows-2025 | |
| numpy: 2.0.2 | |
| python: 3.10.11 | |
| activate_command: .\venv\Scripts\activate | |
| # Python 3.11+: test both numpy 1.x and 2.x | |
| - os: ubuntu-24.04 | |
| numpy: 1.26.4 | |
| python: 3.12.10 | |
| activate_command: source venv/bin/activate | |
| - os: ubuntu-24.04 | |
| numpy: 2.3.0 | |
| python: 3.12.10 | |
| activate_command: source venv/bin/activate | |
| - os: ubuntu-24.04 | |
| numpy: 2.3.0 | |
| python: *upper_pyver | |
| activate_command: source venv/bin/activate | |
| - os: windows-2025 | |
| numpy: 2.3.0 | |
| python: *upper_pyver | |
| activate_command: .\venv\Scripts\activate | |
| uses: ./.github/workflows/_before-pip.yaml | |
| with: | |
| os: ${{ matrix.os }} | |
| numpy: ${{ matrix.numpy }} | |
| python: ${{ matrix.python }} | |
| activate_command: ${{ matrix.activate_command }} | |
| setup-conda: | |
| uses: ./.github/workflows/_before-conda.yaml | |
| with: | |
| os: ubuntu-24.04 | |
| numpy: 1.26.4 | |
| python: *conda_pyver | |
| test-pip: | |
| needs: [setup-pip] | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| include: | |
| # NumPy 1.24.2 supports Python 3.8 to 3.11 | |
| # Numpy 2.0.2 supports Python 3.9 to 3.12 | |
| - os: ubuntu-24.04 | |
| numpy: 1.24.2 | |
| python: 3.10.11 | |
| activate_command: source venv/bin/activate | |
| - os: windows-2025 | |
| numpy: 2.0.2 | |
| python: 3.10.11 | |
| activate_command: .\venv\Scripts\activate | |
| # Python 3.11+: test both numpy 1.x and 2.x | |
| - os: ubuntu-24.04 | |
| numpy: 1.26.4 | |
| python: 3.12.10 | |
| activate_command: source venv/bin/activate | |
| - os: ubuntu-24.04 | |
| numpy: 2.3.0 | |
| python: 3.12.10 | |
| activate_command: source venv/bin/activate | |
| - os: ubuntu-24.04 | |
| numpy: 2.3.0 | |
| python: *upper_pyver | |
| activate_command: source venv/bin/activate | |
| - os: windows-2025 | |
| numpy: 2.3.0 | |
| python: *upper_pyver | |
| activate_command: .\venv\Scripts\activate | |
| uses: ./.github/workflows/_test-pip.yaml | |
| with: | |
| os: ${{ matrix.os }} | |
| numpy: ${{ matrix.numpy }} | |
| python: ${{ matrix.python }} | |
| activate_command: ${{ matrix.activate_command }} | |
| test-conda: | |
| uses: ./.github/workflows/_test-conda.yaml | |
| needs: [setup-conda] | |
| with: | |
| os: ubuntu-24.04 | |
| numpy: 1.26.4 | |
| python: *conda_pyver | |
| lint-pip: | |
| needs: [setup-pip] | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| include: | |
| # Lint with one version from each numpy series | |
| # Need to be the same as setup-pip for cache | |
| - numpy: 1.24.2 | |
| python: 3.10.11 | |
| - numpy: 1.26.4 | |
| python: 3.12.10 | |
| - numpy: 2.3.0 | |
| python: *upper_pyver | |
| uses: ./.github/workflows/_lint-pip.yaml | |
| with: | |
| os: ubuntu-24.04 | |
| numpy: ${{ matrix.numpy }} | |
| python: ${{ matrix.python }} | |
| activate_command: source venv/bin/activate | |
| check-version: | |
| needs: [test-pip, test-conda, lint-pip] | |
| uses: ./.github/workflows/_version.yaml | |
| with: | |
| os: ubuntu-24.04 | |
| python: *upper_pyver | |
| # GitHub Actions does not have a halt job option, to stop from deploying if | |
| # no functional changes were found. We build a separate job to substitute the | |
| # halt option. The `deploy` job is dependent on the output of the | |
| # `check-for-functional-changes`job. | |
| check-for-functional-changes: | |
| runs-on: ubuntu-24.04 | |
| # Last job to run | |
| needs: [check-version] | |
| outputs: | |
| status: ${{ steps.stop-early.outputs.status }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: *upper_pyver | |
| - id: stop-early | |
| # The `check-for-functional-changes` job should always succeed regardless | |
| # of the `has-functional-changes` script's exit code. Consequently, we do | |
| # not use that exit code to trigger deploy, but rather a dedicated output | |
| # variable `status`, to avoid a job failure if the exit code is different | |
| # from 0. Conversely, if the job fails the entire workflow would be | |
| # marked as `failed` which is disturbing for contributors. | |
| run: if "${GITHUB_WORKSPACE}/.github/has-functional-changes.sh" ; then echo | |
| "::set-output name=status::success" ; fi | |
| publish-to-pypi: | |
| runs-on: ubuntu-24.04 | |
| needs: [check-for-functional-changes] | |
| if: needs.check-for-functional-changes.outputs.status == 'success' | |
| env: | |
| PYPI_USERNAME: __token__ | |
| PYPI_TOKEN: ${{ secrets.PYPI_TOKEN_OPENFISCA_BOT }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: *upper_pyver | |
| - name: Cache deps | |
| uses: actions/cache@v4 | |
| with: | |
| path: venv | |
| key: pip-deps-ubuntu-24.04-np2.3.0-py${{ env.UPPER_PYTHON_VERSION }}-${{ hashFiles('setup.py') }} | |
| - name: Cache build | |
| uses: actions/cache@v4 | |
| with: | |
| path: venv/**/[oO]pen[fF]isca* | |
| key: pip-build-ubuntu-24.04-np2.3.0-py${{ env.UPPER_PYTHON_VERSION }}-${{ hashFiles('setup.py') }}-${{ github.sha }} | |
| - name: Cache release | |
| uses: actions/cache@v4 | |
| with: | |
| path: dist | |
| key: pip-release-ubuntu-24.04-np2.3.0-py${{ env.UPPER_PYTHON_VERSION }}-${{ hashFiles('setup.py') }}-${{ github.sha }} | |
| - name: Check package format | |
| run: | | |
| source venv/bin/activate | |
| twine check dist/* | |
| - name: Upload package to PyPi | |
| run: | | |
| source venv/bin/activate | |
| twine upload dist/* --username $PYPI_USERNAME --password $PYPI_TOKEN | |
| - name: Update version | |
| run: | | |
| source venv/bin/activate | |
| git tag `python setup.py --version` | |
| git push --tags # update the repository version | |
| - name: Update doc | |
| run: | | |
| curl -L \ | |
| -X POST \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "Authorization: Bearer ${{ secrets.OPENFISCADOC_BOT_ACCESS_TOKEN }}" \ | |
| -H "X-GitHub-Api-Version: 2022-11-28" \ | |
| https://api.github.com/repos/openfisca/openfisca-doc/actions/workflows/deploy.yaml/dispatches \ | |
| -d '{"ref":"main"}' | |
| publish-to-conda: | |
| runs-on: ubuntu-24.04 | |
| needs: [publish-to-pypi] | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Cache conda env | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| /usr/share/miniconda/envs/openfisca | |
| ~/.conda/envs/openfisca | |
| .env.yaml | |
| key: conda-env-ubuntu-24.04-np1.26.4-py${{ env.CONDA_PYTHON_VERSION }}-${{ hashFiles('setup.py') }} | |
| - name: Cache conda deps | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/conda_pkgs_dir | |
| key: conda-deps-ubuntu-24.04-np1.26.4-py${{ env.CONDA_PYTHON_VERSION }}-${{ hashFiles('setup.py') }} | |
| - name: Cache release | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/conda-rel | |
| key: conda-release-ubuntu-24.04-np1.26.4-py${{ env.CONDA_PYTHON_VERSION }}-${{ hashFiles('setup.py') }}-${{ github.sha }} | |
| - name: Update conda & dependencies | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| activate-environment: openfisca | |
| environment-file: .env.yaml | |
| miniforge-version: latest | |
| use-mamba: true | |
| - name: Publish to conda | |
| run: | | |
| rattler-build upload anaconda ~/conda-rel/noarch/*.conda \ | |
| --force \ | |
| --owner openfisca \ | |
| --api-key ${{ secrets.ANACONDA_TOKEN }} | |
| test-on-windows: | |
| runs-on: windows-2025 | |
| needs: [publish-to-conda] | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| steps: | |
| - uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| auto-update-conda: true | |
| # See GHA Windows | |
| # https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json | |
| python-version: *conda_pyver | |
| channels: conda-forge | |
| activate-environment: true | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install with conda | |
| run: conda install -c openfisca openfisca-core | |
| - name: Test openfisca | |
| run: openfisca --help |