Skip to content

Change l'identification du poids modifié #329

Change l'identification du poids modifié

Change l'identification du poids modifié #329

Workflow file for this run

name: OpenFisca France Data
on:
push:
pull_request:
types: [opened, reopened]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: ["ubuntu-20.04"]
python-version: ["3.9.9", "3.10.6"]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache build
id: restore-build
uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: build-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ github.sha }}-${{ matrix.os }}
restore-keys: | # in case of a cache miss (systematically unless the same commit is built repeatedly), the keys below will be used to restore dependencies from previous builds, and the cache will be stored at the end of the job, making up-to-date dependencies available for all jobs of the workflow; see more at https://docs.github.com/en/actions/advanced-guides/caching-dependencies-to-speed-up-workflows#example-using-the-cache-action
build-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ matrix.os }}
build-${{ env.pythonLocation }}-${{ matrix.os }}
- name: Build package
run: make build
- name: Cache release
id: restore-release
uses: actions/cache@v3
with:
path: dist
key: release-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ github.sha }}-${{ matrix.os }}
lint-files:
runs-on: ubuntu-20.04
needs: [ build ]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all the tags
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9.9
- name: Cache build
id: restore-build
uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: build-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ github.sha }}-ubuntu-20.04
- run: |
make check-syntax-errors
# pip install flake8
# make check-style # Pas lancé car 1 600 erreurs !!!
coverage:
runs-on: ubuntu-20.04
needs: [ build ]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TERM: xterm-256color # To colorize output of make tasks.
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9.9
- name: Cache build
id: restore-build
uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: build-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ github.sha }}-ubuntu-20.04
- run: |
pip install --upgrade coveralls
coveralls --service=github
test-python:
runs-on: ${{ matrix.os }}
needs: [ build ]
strategy:
fail-fast: true
matrix:
os: [ "ubuntu-20.04" ] # On peut ajouter "macos-latest" si besoin
python-version: ["3.9.9", "3.10.6"]
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache build
id: restore-build
uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: build-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ github.sha }}-${{ matrix.os }}
- run: pip install .[test]
- run: make test
check-version-and-changelog:
runs-on: ubuntu-20.04
needs: [ lint-files, test-python ] # Last job to run
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all the tags
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9.9
- name: Check version number has been properly updated
run: "${GITHUB_WORKSPACE}/.github/is-version-number-acceptable.sh"
# 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-20.04
if: github.ref == 'refs/heads/master' # Only triggered for the `master` branch
needs: [ check-version-and-changelog ]
outputs:
status: ${{ steps.stop-early.outputs.status }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all the tags
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9.9
- id: stop-early
run: if "${GITHUB_WORKSPACE}/.github/has-functional-changes.sh" ; then echo "::set-output name=status::success" ; fi
deploy:
runs-on: ubuntu-20.04
needs: [ check-for-functional-changes ]
if: needs.check-for-functional-changes.outputs.status == 'success'
env:
PYPI_TOKEN_OPENFISCA_BOT: ${{ secrets.PYPI_TOKEN_OPENFISCA_BOT }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all the tags
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9.9
- name: Cache build
id: restore-build
uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: build-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ github.sha }}-ubuntu-20.04
- name: Cache release
id: restore-release
uses: actions/cache@v3
with:
path: dist
key: release-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ github.sha }}-ubuntu-20.04
- name: Upload a Python package to PyPi
run: twine upload dist/* --username __token__ --password $PYPI_TOKEN_OPENFISCA_BOT
- name: Publish a git tag
run: "${GITHUB_WORKSPACE}/.github/publish-git-tag.sh"
build-conda:
runs-on: "ubuntu-20.04"
needs: [ check-version-and-changelog ]
# Do not build on master, the artifact will be used
if: github.ref != 'refs/heads/master'
steps:
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: "3.9.9"
# Add "conda-forge" for OpenFisca-Core and "openfisca" for openfisca-survey-manager
channels: conda-forge, openfisca
activate-environment: true
- uses: actions/checkout@v3
- name: Get version
run: echo "PACKAGE_VERSION=$(python3 ./setup.py --version)" >> $GITHUB_ENV
- name: Conda Config
run: |
conda install conda-build anaconda-client
conda info
- name: Build Conda package
run: conda build --croot /tmp/conda .conda
- name: Upload Conda build
uses: actions/upload-artifact@v3
with:
name: conda-build-${{ env.PACKAGE_VERSION }}-${{ github.sha }}
path: /tmp/conda
retention-days: 30
test-on-windows:
runs-on: "windows-latest"
needs: [ build-conda ]
steps:
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: "3.9.9"
channels: conda-forge, openfisca
activate-environment: true
- uses: actions/checkout@v3
- name: Get version
run: |
# chcp 65001 #set code page to utf-8
echo ("PACKAGE_VERSION=" + (python3 ./setup.py --version) ) >> $env:GITHUB_ENV
echo "Version setup.py: ${{ env.PACKAGE_VERSION }}"
- name: Download conda build
uses: actions/download-artifact@v3
with:
name: conda-build-${{ env.PACKAGE_VERSION }}-${{ github.sha }}
path: conda-build-tmp
- name: Install with conda
run: |
conda install -c ./conda-build-tmp/noarch/openfisca-france-data-${{ env.PACKAGE_VERSION }}-py_0.tar.bz2 openfisca-france-data
publish-to-conda:
runs-on: "ubuntu-20.04"
needs: [ deploy ]
steps:
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: "3.9.9"
# Add conda-forge for OpenFisca-Core
channels: conda-forge
activate-environment: true
- name: Get source code
uses: actions/checkout@v3
- name: Get version
run: echo "PACKAGE_VERSION=$(python3 ./setup.py --version)" >> $GITHUB_ENV
# Get the last commit hash on the PR (-2 : before the merge commit)
- uses: actions/github-script@v6
id: last_pr_commit
with:
script: |
const commits = ${{ toJSON(github.event.commits) }}
return commits.at(-2).id;
result-encoding: string
# Default Download artifact don't see artifact of other workflow
# So we use dawidd6/action-download-artifact@v2 to do it.
- name: Download artifact
id: download-artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow_conclusion: success
commit: ${{steps.last_pr_commit.outputs.result}}
name: conda-build-${{ env.PACKAGE_VERSION }}-${{steps.last_pr_commit.outputs.result}}
path: conda-build-tmp
event: push # To avoid conflict with PR workflow
if_no_artifact_found: fail
- name: Conda upload
# This shell is made necessary by https://github.com/conda-incubator/setup-miniconda/issues/128
shell: bash -l {0}
run: |
conda install anaconda-client
conda info
anaconda -t ${{ secrets.ANACONDA_TOKEN }} upload -u openfisca ./conda-build-tmp/noarch/openfisca-france-data-*-py_0.tar.bz2 --force