Skip to content

Commit

Permalink
Switch from Circle CI to GitHub Action
Browse files Browse the repository at this point in the history
Merge pull request #206 from openfisca/add-github-action
  • Loading branch information
benoit-cty authored Feb 7, 2023
2 parents daef686 + cae76ce commit 116791e
Show file tree
Hide file tree
Showing 18 changed files with 602 additions and 936 deletions.
141 changes: 0 additions & 141 deletions .circleci/config.yml

This file was deleted.

16 changes: 0 additions & 16 deletions .circleci/has-functional-changes.sh

This file was deleted.

4 changes: 0 additions & 4 deletions .circleci/publish-python-package.sh

This file was deleted.

34 changes: 34 additions & 0 deletions .conda/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Publish to conda

There are two ways to publish to conda:

- A fully automatic in CI that publish to an "openfisca" channel. See below for more information.
- A more complex for Conda-Forge.

We use both for openfisca-core but only _openfisca channel_ for _OpenFisca-France-Data_.

## Automatic upload

The CI automaticaly build the Conda package and publish it when merging on master, see the `.github/workflow.yml`, step `publish-to-conda`.

## Manual actions made to make it works the first time

- Create an account on https://anaconda.org.
- Create a token on https://anaconda.org/openfisca/settings/access with _Allow write access to the API site_. Warning, it expire on 2025/01/14.
- Put the token in a CI env variable ANACONDA_TOKEN.

## Manual actions before CI exist

To create the package you can do the following in the project root folder:

- Edit `.conda/meta.yaml` and update it if needed:
- Version number
- Dependencies

- Install `conda-build` to build the package and [anaconda-client](https://github.com/Anaconda-Platform/anaconda-client) to push the package to anaconda.org:
- `conda install -c anaconda conda-build anaconda-client`

- Build & Upload package:
- `conda build .conda`
- `anaconda login`
- `anaconda upload openfisca-france-data-<VERSION>-py_0.tar.bz2`
74 changes: 74 additions & 0 deletions .conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
###############################################################################
## Fichier de description du package pour Anaconda.org
## Le numéro de version est mis à jour automatiquement par BumpVer
###############################################################################

{% set name = "openfisca-france-data" %}
{% set version = "0.22.0" %}

package:
name: {{ name|lower }}
version: {{ version }}

source:
path: ..

build:
noarch: python
number: 0
script: "{{ PYTHON }} -m pip install . -vv"

requirements:
host:
- python
- pip
run:
- python >=3.7,<4.0
- click >=8.0.0,<9.0.0
- matplotlib >=3.1.1,<4.0.0
- multipledispatch >=0.6.0,<1.0.0
- openFisca-france >=113.0.0,<120.0.0 # Max 120 because of a bug in OF : https://github.com/openfisca/openfisca-france/issues/1996
- openFisca-survey-manager >=0.44.2,<1.0.0
- wquantiles >=0.3.0,<1.0.0

test:
imports:
- openfisca_france_data
requires:
- pip
commands:
#- pip check # TODO: openfisca-core 35.7.6 requires pytest, which is not installed. !!!
- pip list

outputs:
- name: openfisca-france-data

- name: openfisca-france-data-test
build:
noarch: python
requirements:
host:
- python
run:
- autopep8 >=1.4.0,<1.5.0
- flake8 >=3.7.0,<3.8.0
- ipython >=7.5.0,<8.0.0
- mypy >=0.670,<1.0.0
- pytest >=4.3.0,<5.0.0
- pytest-cov >=2.6.0,<3.0.0
- scipy >=1.2.1,<2.0.0
- toolz >=0.9.0,<1.0.0
- bumpver
- {{ pin_subpackage('openfisca-france-data', exact=True) }}

about:
home: https://fr.openfisca.org/
license_family: AGPL
license: AGPL-3.0-only
license_file: LICENSE
summary: "OpenFisca-France-Data module to work with French survey data"
description: |
OpenFisca is a versatile microsimulation free software.
This repository contains the module to work with French survey data.
doc_url: https://fr.openfisca.org/
dev_url: https://github.com/openfisca/openfisca-france-data/
12 changes: 12 additions & 0 deletions .github/has-functional-changes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#! /usr/bin/env bash

IGNORE_DIFF_ON="README.md CONTRIBUTING.md Makefile .gitignore .github/*"

last_tagged_commit=`git describe --tags --abbrev=0 --first-parent` # --first-parent ensures we don't follow tags not published in master through an unlikely intermediary merge commit

if git diff-index --name-only --exit-code $last_tagged_commit -- . `echo " $IGNORE_DIFF_ON" | sed 's/ / :(exclude)/g'` # Check if any file that has not be listed in IGNORE_DIFF_ON has changed since the last tag was published.
then
echo "No functional changes detected."
exit 1
else echo "The functional files above were changed."
fi
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
#! /usr/bin/env bash

if [[ $CIRCLE_BRANCH == master ]]
if [[ ${GITHUB_REF#refs/heads/} == master ]]
then
echo "No need for a version check on master."
exit 0
fi

if ! "$PWD"/.circleci/has-functional-changes.sh
if ! $(dirname "$BASH_SOURCE")/has-functional-changes.sh
then
echo "No need for a version update."
exit 0
fi

current_version=$(python setup.py --version)
current_version=`python setup.py --version`

if git rev-parse --verify --quiet "$current_version"
if git rev-parse --verify --quiet $current_version
then
echo "Version $current_version already exists in commit:"
git --no-pager log -1 "$current_version"
git --no-pager log -1 $current_version
echo
echo "Update the version number in setup.py before merging this branch into master."
echo "Look at the CONTRIBUTING.md file to learn how the version number should be updated."
exit 1
fi

if ! "$PWD"/.circleci/has-functional-changes.sh | grep --quiet CHANGELOG.md
if ! $(dirname "$BASH_SOURCE")/has-functional-changes.sh | grep --quiet CHANGELOG.md
then
echo "CHANGELOG.md has not been modified, while functional changes were made."
echo "Explain what you changed before merging this branch into master."
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/env bash

git tag "$(python setup.py --version)"
git tag `python setup.py --version`
git push --tags # update the repository version
Loading

0 comments on commit 116791e

Please sign in to comment.