-
Notifications
You must be signed in to change notification settings - Fork 82
Description
RFC: Consolidate build workflow
Context
There are currently four sources of truth for how to build, test and deploy an OpenFisca package:
- CI configuration (
.circleci/config.yml
, soon.github/workflows/config.yml
, cf. Switch from CircleCI to GitHub Actions #1030). - Shell scripts run in CI but that can also be run locally (
.circleci/*.sh
, soon.github/*.sh
). Makefile
.- OpenFisca CLI.
Depending on each case, these complement (installing locally, testing both locally and in CI, packaging in CI), reference (publish-git-tag.sh
from CI config, openfisca test
in test-api.sh
) or overlap (make check-style
vs .circleci/lint-changed-python-tests.sh
) each other.
Problem
This setup raises the following issues:
- Inconsistent workflows (
make install
differs from the install result in CI, which callsmake build
instead), leading to inconsistent test results (e.g. build: test against packaged version #1037). - Inconsistent contributor practices (with maintainers more often using
make test
and contributorsopenfisca test
), leading to blocked PRs (e.g. Allow variable neutralization in YAML test files #1021 (comment)). - Duplication of work (e.g. Retire le doublon pytest openfisca-france#1649).
- Maintainability: where to update the workflow when it changes? This uncertainty leads to concurrent, potentially incompatible pull requests (e.g. Switch from CircleCI to GitHub Actions #1030, Run tests in a parallel matrix #1031, build: test against packaged version #1037…).
- Portability: shell scripts and Makefile have limited portability, and CI configuration is vendor-dependent and most often executable only on CI.
Discussion
A synchronous discussion with @benjello @benoit-cty @sandcha @maukoquiroga @HAEKADI @MattiSG took place on 02/09/2021 on this topic.
Conclusions on that topic were that:
- There is interest in converging the workflow on one single tool.
- Maintainers present in the call preferred
make
overopenfisca
as it is shorter, especially when multiple country packages are installed in one virtualenv (make test
vsopenfisca test --country-package openfisca_france tests
). - The cost of installing Docker was felt as too high, even for maintainers.
- The representativity of the sample of participants to the discussion was too low to lead to any conclusion as to which tool to prefer.
Annex
Known workflow steps
The following table aims at summarizing all known declared workflow steps. It was established by @MattiSG on 03/09/2021, based on reading through Core, France and Country Template Makefile
, .circleci/config.yml
and .circleci/*.sh
.
Some tasks exist only on Core and are marked with
⊛
, some exist only on a country package (France or Country Template) and are marked with✣
.
Task | CI config | Shell scripts | Makefile | OpenFisca CLI |
---|---|---|---|---|
Install dependencies | pip install --editable (optional) |
make deps , make install |
pip install openfisca_country_package |
|
Lint | lint-changed-python-files.sh , lint-changed-yaml-tests.sh |
make check-syntax-errors check-style |
||
Apply linting rules | make format-style |
|||
Run tests | pytest && openfisca test |
make test |
openfisca test |
|
Start the web API | make api (in Core) make serve-local (in Country Template) |
openfisca serve |
||
Check version number validity | git fetch && check_version_and_changelog.sh |
check_version_and_changelog.sh |
||
Build package | make build |
|||
Clean installed packages | make uninstall , make clean |
|||
Test web API ✣ | test-api.sh |
|||
Deploy ✣ | Deploy web API | publish-python-package.sh && publish-git-tag.sh |
||
Deploy ⊛ | Trigger documentation build update | publish-python-package.sh && publish-git-tag.sh |
||
Check NumPy compatibility ⊛ | Check NumPy typing against latest 3 minor versions | |||
Check types ⊛ | make check-types |
|||
Run Country-Template tests ⊛ | Run Country Template tests | |||
Log test coverage ⊛ | Submit coverage to Coveralls |
Usage survey
In parallel to this RFC, in order to identify which tasks might be removed altogether from the list of existing ones, and which destination is least likely to disrupt existing uses, a survey has been created by @MattiSG to better understand the current usages. You are strongly encouraged to participate to it: share your current workflow.
The results of the survey are publicly available.
Process
This RFC aims at finding the best solution to the problems identified above. Contributors are invited to vote on the propositions below, which will be exposed each in their own post, through emoji reactions (:+1: to support an option, :-1: to reject it, :eyes: to indicate having read it and not supporting nor rejecting it). Contributors are also invited to ask for clarifications, suggest improvements to the propositions if that could change their stance on them, and contribute their own if they believe they can offer significant improvements.
In order to contribute a proposition, please make clear whether it is a new one, in which case you should give it a new number (e.g. “proposition 5”), or if it builds upon an existing one to add some detail, in which case you should suffix the original number with a letter (e.g. “proposition 3A”).
This RFC will close after one week (7 ⨉ 24 hours) without changes to the proposition set. At that time, votes will be counted and the most consensual proposition will be implemented.