Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test PR #141

Closed
wants to merge 13 commits into from
4 changes: 1 addition & 3 deletions .github/has-functional-changes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

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 main 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.
if git diff-index --name-only --exit-code master -- . `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
Expand Down
12 changes: 9 additions & 3 deletions .github/is-version-number-acceptable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,22 @@ then
exit 0
fi

current_version=$(python setup.py --version)
current_version=$(grep '^version =' pyproject.toml | cut -d '"' -f 2) # parsing with tomllib is complicated, see https://github.com/python-poetry/poetry/issues/273

if [[ ! $current_version ]]
then
echo "Error getting current version"
exit 1
fi

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

if ! $(dirname "$BASH_SOURCE")/has-functional-changes.sh | grep --quiet CHANGELOG.md
Expand Down
4 changes: 1 addition & 3 deletions .github/lint-changed-python-files.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#! /usr/bin/env bash

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

if ! changes=$(git diff-index --name-only --diff-filter=ACMR --exit-code $last_tagged_commit -- "*.py")
if ! changes=$(git diff-index --name-only --diff-filter=ACMR --exit-code main -- "*.py")
then
echo "Linting the following Python files:"
echo $changes
Expand Down
8 changes: 3 additions & 5 deletions .github/lint-changed-yaml-tests.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#! /usr/bin/env bash

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

if ! changes=$(git diff-index --name-only --diff-filter=ACMR --exit-code $last_tagged_commit -- "tests/*.yaml")
if ! changed_files=$(git diff-index --name-only --diff-filter=ACMR --exit-code master -- "tests/*.yaml")
then
echo "Linting the following changed YAML tests:"
echo $changes
yamllint $changes
echo $changed_files
yamllint $changed_files
else echo "No changed YAML tests to lint"
fi
3 changes: 2 additions & 1 deletion .github/publish-git-tag.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#! /usr/bin/env bash

git tag $(python setup.py --version)
current_version=$(grep '^version =' pyproject.toml | cut -d '"' -f 2) # parsing with tomllib is complicated, see https://github.com/python-poetry/poetry/issues/273
git tag $current_version
git push --tags # update the repository version
18 changes: 9 additions & 9 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Country-Template

on:
push:
branches: [ main ]
branches: [ master ]
pull_request:
types: [ assigned, opened, reopened, synchronize, ready_for_review ]
workflow_dispatch:
Expand All @@ -22,9 +22,9 @@ jobs:
uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: build-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ github.sha }} # Cache the entire build Python environment
key: build-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ github.sha }} # Cache the entire build Python environment
restore-keys: |
build-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}
build-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}
build-${{ env.pythonLocation }}-
- name: Build package
run: make build
Expand All @@ -33,7 +33,7 @@ jobs:
uses: actions/cache@v2
with:
path: dist
key: release-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ github.sha }}
key: release-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ github.sha }}

lint-files:
runs-on: ubuntu-20.04
Expand All @@ -51,7 +51,7 @@ jobs:
uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: build-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ github.sha }}
key: build-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ github.sha }}
- run: make check-syntax-errors
- run: make check-style
- name: Lint Python files
Expand All @@ -73,7 +73,7 @@ jobs:
uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: build-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ github.sha }}
key: build-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ github.sha }}
- run: openfisca test --country-package openfisca_country_template openfisca_country_template/tests

test-api:
Expand All @@ -90,7 +90,7 @@ jobs:
uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: build-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ github.sha }}
key: build-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ github.sha }}
- name: Test the Web API
run: "${GITHUB_WORKSPACE}/.github/test-api.sh"

Expand Down Expand Up @@ -148,13 +148,13 @@ jobs:
uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: build-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ github.sha }}
key: build-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ github.sha }}
- name: Cache release
id: restore-release
uses: actions/cache@v2
with:
path: dist
key: release-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ github.sha }}
key: release-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ github.sha }}
- name: Upload a Python package to PyPi
run: twine upload dist/* --username $PYPI_USERNAME --password $PYPI_PASSWORD
- name: Publish a git tag
Expand Down
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -689,8 +689,8 @@ See more on the OpenFisca-Core [changelog](https://github.com/openfisca/openfisc

## 0.0.1 - [#0](https://github.com/openfisca/country-template/pull/0)

* Tax and benefit system evolution.
* Impacted periods: all.
* Tax and benefit system evolution
* Impacted periods: all
* Impacted areas:
- `benefits`.
- `demographics`.
Expand All @@ -700,3 +700,4 @@ See more on the OpenFisca-Core [changelog](https://github.com/openfisca/openfisc
- `taxes`.
* Details:
- Import model from template
-
4 changes: 2 additions & 2 deletions openfisca_country_template/entities.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
This file defines the entities needed by our legislation.
This file defines the entities that are needed by our legislation.

Taxes and benefits can be calculated for different entities: persons, household, companies, etc.
Taxes and benefits can be calculated for different entities: persons, household, companies, etc

See https://openfisca.org/doc/key-concepts/person,_entities,_role.html
"""
Expand Down
Loading