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 Python 3.8 and remove Python 3.6 #1111

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 66 additions & 23 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,31 @@ on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
# Patch version must be specified to avoid any cache confusion, since
# the cache key depends on the full Python version.
# If left unspecified, different patch versions could be allocated
# between jobs, and any such difference would lead to a cache not
# found error.
python-version: ["3.7.12", "3.8.12"]
env:
TERM: xterm-256color # To colorize output of make tasks.
TERM: xterm-256color # To colorize output of make tasks.
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7.12 # Patch version must be specified to avoid any cache confusion, since the cache key depends on the full Python version. If left unspecified, different patch versions could be allocated between jobs, and any such difference would lead to a cache not found error.
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 }}
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
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') }}
build-${{ env.pythonLocation }}-
- name: Build package
Expand All @@ -34,40 +43,46 @@ jobs:

test-core:
runs-on: ubuntu-latest
needs: [ build ]
strategy:
matrix:
python-version: ["3.7.12", "3.8.12"]
needs: [build]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TERM: xterm-256color # To colorize output of make tasks.
TERM: xterm-256color # To colorize output of make tasks.
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7.12
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 }}
- name: Run openfisca-core tests
run: make test-core
run: make test-core
- name: Submit coverage to Coveralls
run: |
pip install coveralls
coveralls --service=github

test-country-template:
runs-on: ubuntu-latest
needs: [ build ]
strategy:
matrix:
python-version: ["3.7.12", "3.8.12"]
needs: [build]
env:
TERM: xterm-256color
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7.12
python-version: ${{ matrix.python-version }}
- name: Cache build
id: restore-build
uses: actions/cache@v2
Expand All @@ -79,15 +94,18 @@ jobs:

test-extension-template:
runs-on: ubuntu-latest
needs: [ build ]
strategy:
matrix:
python-version: ["3.7.12", "3.8.12"]
needs: [build]
env:
TERM: xterm-256color
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7.12
python-version: ${{ matrix.python-version }}
- name: Cache build
id: restore-build
uses: actions/cache@v2
Expand All @@ -99,15 +117,18 @@ jobs:

check-numpy:
runs-on: ubuntu-latest
needs: [ build ]
strategy:
matrix:
python-version: ["3.7.12", "3.8.12"]
needs: [build]
env:
TERM: xterm-256color
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7.12
python-version: ${{ matrix.python-version }}
- name: Cache build
id: restore-build
uses: actions/cache@v2
Expand All @@ -119,7 +140,10 @@ jobs:

test-docs:
runs-on: ubuntu-latest
needs: [ build ]
strategy:
matrix:
python-version: ["3.7.12", "3.8.12"]
needs: [build]
env:
TERM: xterm-256color
steps:
Expand All @@ -129,7 +153,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7.12
python-version: ${{ matrix.python-version }}
- name: Cache build
id: restore-build
uses: actions/cache@v2
Expand All @@ -149,7 +173,10 @@ jobs:

lint-files:
runs-on: ubuntu-latest
needs: [ build ]
strategy:
matrix:
python-version: ["3.7.12", "3.8.12"]
needs: [build]
env:
TERM: xterm-256color
steps:
Expand All @@ -159,7 +186,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7.12
python-version: ${{ matrix.python-version }}
- name: Cache build
id: restore-build
uses: actions/cache@v2
Expand All @@ -171,15 +198,25 @@ jobs:

check-version:
runs-on: ubuntu-latest
needs: [ test-core, test-country-template, test-extension-template, check-numpy, test-docs, lint-files ] # Last job to run
strategy:
matrix:
python-version: ["3.7.12", "3.8.12"]
needs: [
test-core,
test-country-template,
test-extension-template,
check-numpy,
test-docs,
lint-files,
] # Last job to run
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch all the tags
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7.12
python-version: ${{ matrix.python-version }}
- name: Check version number has been properly updated
run: "${GITHUB_WORKSPACE}/.github/is-version-number-acceptable.sh"

Expand All @@ -188,8 +225,11 @@ jobs:
# The `deploy` job is dependent on the output of the `check-for-functional-changes`job.
check-for-functional-changes:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7.12", "3.8.12"]
if: github.ref == 'refs/heads/master' # Only triggered for the `master` branch
needs: [ check-version ]
needs: [check-version]
outputs:
status: ${{ steps.stop-early.outputs.status }}
steps:
Expand All @@ -199,13 +239,16 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7.12
python-version: ${{ matrix.python-version }}
- id: stop-early
run: if "${GITHUB_WORKSPACE}/.github/has-functional-changes.sh" ; then echo "::set-output name=status::success" ; fi # The `check-for-functional-changes` job should always succeed regardless of the `has-functional-changes` script's exit code. Consequently, we do not use that exit code to trigger deploy, but rather a dedicated output variable `status`, to avoid a job failure if the exit code is different from 0. Conversely, if the job fails the entire workflow would be marked as `failed` which is disturbing for contributors.

deploy:
runs-on: ubuntu-latest
needs: [ check-for-functional-changes ]
strategy:
matrix:
python-version: ["3.7.12", "3.8.12"]
needs: [check-for-functional-changes]
if: needs.check-for-functional-changes.outputs.status == 'success'
env:
PYPI_USERNAME: openfisca-bot
Expand All @@ -218,7 +261,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7.12
python-version: ${{ matrix.python-version }}
- name: Cache build
id: restore-build
uses: actions/cache@v2
Expand Down
Loading