Skip to content

Commit

Permalink
Merge pull request #5 from openfisca/fix-ci
Browse files Browse the repository at this point in the history
Improve lint
  • Loading branch information
benjello authored Jun 26, 2024
2 parents 69470b6 + f656b60 commit 520fa26
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 105 deletions.
2 changes: 1 addition & 1 deletion .github/lint-changed-python-files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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 ! 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 $last_tagged_commit -- "**/*.py")
then
echo "Linting the following Python files:"
echo $changes
Expand Down
100 changes: 3 additions & 97 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: OpenFisca France
name: OpenFisca France Pension

on:
push:
Expand Down Expand Up @@ -67,8 +67,8 @@ jobs:
- run: make check-style
- name: Lint Python files
run: "${GITHUB_WORKSPACE}/.github/lint-changed-python-files.sh"
- name: Lint YAML tests
run: "${GITHUB_WORKSPACE}/.github/lint-changed-yaml-tests.sh"
# - name: Lint YAML tests
# run: "${GITHUB_WORKSPACE}/.github/lint-changed-yaml-tests.sh"
test-python:
runs-on: ${{ matrix.os }}
needs: [ build ]
Expand Down Expand Up @@ -230,97 +230,3 @@ jobs:
run: twine upload dist/* --username $PYPI_USERNAME --password $PYPI_TOKEN
- 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
channels: openfisca,conda-forge
activate-environment: true
- uses: actions/checkout@v3
- name: Update meta.yaml
run: |
python3 -m pip install requests argparse
python3 .github/get_pypi_info.py -p OpenFisca-France
- 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 -c openfisca -c conda-forge --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"
# Add conda-forge for OpenFisca-Core
channels: openfisca,conda-forge
activate-environment: true
- uses: actions/checkout@v3
# - name: Test max path length
# run: "python3 openfisca_france/scripts/check_path_length.py"
- 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-pension-dev-${{ env.PACKAGE_VERSION }}-py_0.tar.bz2 openfisca-france-dev
- name: openfisca test
run: openfisca test --country-package openfisca_france_pension tests

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
- name: Conda build and upload
# This shell is made necessary by https://github.com/conda-incubator/setup-miniconda/issues/128
shell: bash -l {0}
run: |
conda install --yes conda-build anaconda-client
conda config --set anaconda_upload yes
conda build --channel conda-forge --channel openfisca --token ${{ secrets.ANACONDA_TOKEN }} --user openfisca .conda
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# Changelog

## 0.0.1
## 0.0.2 [5](https://github.com/openfisca/openfisca-france-pension/pull/5)

* Amélioration technique.
* Détails :
- Configuration de l'intégration continue


## 0.0.1

First Draft
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@ deps:
pip install --upgrade pip twine wheel

install: deps
@# Install OpenFisca-Extension-Template for development.
@# `make install` installs the editable version of OpenFisca-France.
@# `make install` installs the editable version of OpenFisca-France-Pension.
@# This allows contributors to test as they code.
pip install --editable .[dev] --upgrade

build: clean deps
@# Install OpenFisca-Extension-Template for deployment and publishing.
@# `make build` allows us to be be sure tests are run against the packaged version
@# of OpenFisca-Extension-Template, the same we put in the hands of users and reusers.
python setup.py bdist_wheel
find dist -name "*.whl" -exec pip install --upgrade {}[dev] \;

Expand All @@ -37,4 +34,4 @@ check-style:
flake8 `git ls-files | grep "\.py$$" | grep -v openfisca_france_pension/variables/`

test: clean check-syntax-errors check-style
openfisca test --country-package openfisca_france_pension openfisca_france_pension/tests
openfisca test --country-package openfisca_france_pension tests
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
setup(
name = "OpenFisca-France-Pension",
python_requires='>=3.9',
version = "0.0.1",
version = "0.0.2",
author = "OpenFisca Team",
author_email = "[email protected]",
classifiers=[
Expand Down

0 comments on commit 520fa26

Please sign in to comment.