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

Set minimum required version of dependencies #280

Merged
merged 26 commits into from
Dec 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6417abd
Set minimum required version of dependencies
leouieda Dec 20, 2021
6262b79
Add a build with the minimum versions
leouieda Dec 20, 2021
8b405b5
Skip test if paramiko isn't installed
leouieda Dec 20, 2021
268f73a
Avoid installing twine
leouieda Dec 20, 2021
bdb0f19
Fix export command
leouieda Dec 20, 2021
be1b2b6
List dependencies after installing the package
leouieda Dec 20, 2021
6e127e3
Use sed -i instead of --in-place
leouieda Dec 20, 2021
bd6a4b5
Try doing sed -i ''
leouieda Dec 20, 2021
d021565
Don't use sed -i
leouieda Dec 20, 2021
15896c4
Transition to setup.cfg
leouieda Dec 20, 2021
baf08fb
Fix test workflow yaml
leouieda Dec 20, 2021
bb468e7
Minimal instead of minimum
leouieda Dec 20, 2021
9c06e78
Remove unused config from setup.py
leouieda Dec 20, 2021
a51cfbe
Require packaging >=20
leouieda Dec 20, 2021
875b4e7
Use a separate script to convert to minimal
leouieda Dec 20, 2021
bd781ee
Remove xxhash128 from the tests
leouieda Dec 20, 2021
73e4549
Fix wrong version selection
leouieda Dec 20, 2021
fa11aa0
Replace " by ' in workflow if statements
leouieda Dec 20, 2021
142492d
Remove another test with incompatible xxhash
leouieda Dec 20, 2021
8c25386
Remove upper bounds when converting to oldest
leouieda Dec 20, 2021
3c111a0
Forgot to update the docs workflow
leouieda Dec 20, 2021
e7e79d7
Add back xxhash tests and skip if version is too low
leouieda Dec 21, 2021
d71b391
Add the missing docs about the support plan
leouieda Dec 21, 2021
f95fec2
Try an earlier version of requests
leouieda Dec 21, 2021
06dc5b0
Bump requests to 2.18
leouieda Dec 21, 2021
6b24fa1
Bump requests to 2.19
leouieda Dec 21, 2021
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
72 changes: 27 additions & 45 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# token stolen if the Action is compromised. See the comments and links here:
# https:/pypa/gh-action-pypi-publish/issues/27
#
name: docs
name: documentation

# Only build PRs, the main branch, and releases. Pushes to branches will only
# be built when a PR is opened. This avoids duplicated buids in PRs comming
Expand All @@ -21,22 +21,15 @@ on:
# Use bash by default in all jobs
defaults:
run:
# The -l {0} is necessary for conda environments to be activated
# But this breaks on MacOS if using actions/setup-python:
# https:/actions/setup-python/issues/132
shell: bash -l {0}
shell: bash

jobs:
#############################################################################
# Build the docs
build:
runs-on: ubuntu-latest
env:
REQUIREMENTS: requirements.txt
REQUIREMENTS_DEV: requirements-dev.txt
REQUIREMENTS_OPTIONAL: requirements-optional.txt
DEPENDENCIES: optional
INSTALL_EXTRA:
REQUIREMENTS: env/requirements-docs.txt
PYTHON: 3.9

steps:
Expand Down Expand Up @@ -70,6 +63,23 @@ jobs:
with:
python-version: ${{ env.PYTHON }}

- name: Collect requirements - run-time
run: python tools/export_requirements.py > requirements-full.txt

- name: Collect requirements - other
run: |
echo "Capturing dependencies from:"
for requirement in $REQUIREMENTS
do
echo " $requirement"
cat $requirement >> requirements-full.txt
done

- name: List requirements
run: |
echo "Collected dependencies:"
cat requirements-full.txt

- name: Get the pip cache folder
id: pip-cache
run: |
Expand All @@ -79,45 +89,17 @@ jobs:
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
key: ${{ runner.os }}-pip-${{ hashFiles('requirements-full.txt') }}

- name: Install requirements
run: |
requirements_file=requirements-full.txt
if [ ! -z "$REQUIREMENTS" ]; then
echo "Capturing dependencies from $REQUIREMENTS"
cat $REQUIREMENTS >> $requirements_file
fi
if [ ! -z "$REQUIREMENTS_DEV" ]; then
echo "Capturing dependencies from $REQUIREMENTS_DEV"
cat $REQUIREMENTS_DEV >> $requirements_file
fi
if [ "$DEPENDENCIES" == "optional" ]; then
echo "Capturing optional dependencies from $REQUIREMENTS_OPTIONAL"
cat $REQUIREMENTS_OPTIONAL >> $requirements_file
fi
if [ ! -z "$INSTALL_EXTRA" ]; then
echo "Capturing extra dependencies: $INSTALL_EXTRA"
echo "# Extra" >> $requirements_file
# Use xargs to print one argument per line
echo $INSTALL_EXTRA | xargs -n 1 >> $requirements_file
fi
if [ -f $requirements_file ]; then
echo "Collected dependencies:"
cat $requirements_file
echo ""
# Install wheel before anything else so pip can use wheels for
# other packages.
python -m pip install setuptools wheel
python -m pip install --requirement $requirements_file
else
echo "No requirements defined."
fi
# Install the build requirements before anything else so pip can use
# wheels for other packages.
python -m pip install --requirement env/requirements-build.txt
python -m pip install --requirement requirements-full.txt

- name: List installed packages
run: pip freeze
run: python -m pip freeze

- name: Build source and wheel distributions
run: |
Expand All @@ -127,7 +109,7 @@ jobs:
ls -lh dist/

- name: Install the package
run: pip install --no-deps dist/*.whl
run: python -m pip install dist/*.whl

- name: Build the documentation
run: make -C doc clean all
Expand Down
51 changes: 42 additions & 9 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#
name: pypi

# Only run for pushes to the main branch and releases.
on:
pull_request:
push:
branches:
- main
Expand All @@ -21,13 +21,11 @@ defaults:
shell: bash

jobs:

#############################################################################
# Publish built wheels and source archives to PyPI and test PyPI
publish:
# Build and check wheels and source distrubutions
build:
runs-on: ubuntu-latest
# Only publish from the origin repository, not forks
if: github.repository_owner == 'fatiando'

steps:
# Checks-out your repository under $GITHUB_WORKSPACE
- name: Checkout
Expand All @@ -52,7 +50,9 @@ jobs:
python-version: "3.9"

- name: Install requirements
run: python -m pip install setuptools setuptools_scm twine wheel
run: |
python -m pip install -r env/requirements-build.txt
python -m pip install twine

- name: List installed packages
run: python -m pip freeze
Expand All @@ -63,7 +63,7 @@ jobs:
# Change setuptools-scm local_scheme to "no-local-version" so the
# local part of the version isn't included, making the version string
# compatible with Test PyPI.
sed --in-place "s/node-and-date/no-local-version/g" setup.py
sed --in-place "s/node-and-date/no-local-version/g" pyproject.toml

- name: Build source and wheel distributions
run: |
Expand All @@ -75,8 +75,41 @@ jobs:
- name: Check the archives
run: twine check dist/*

# Store the archives as a build artifact so we can deploy them later
- name: Upload archives as artifacts
# Only if not a pull request
if: success() && github.event_name != 'pull_request'
uses: actions/upload-artifact@v2
with:
name: pypi-${{ github.sha }}
path: dist

#############################################################################
# Publish built wheels and source archives to PyPI and test PyPI
publish:
runs-on: ubuntu-latest
needs: build
# Only publish from the origin repository, not forks
if: github.repository_owner == 'fatiando' && github.event_name != 'pull_request'

steps:
- name: Checkout
uses: actions/checkout@v2
with:
# The GitHub token is preserved by default but this job doesn't need
# to be able to push to GitHub.
persist-credentials: false

# Fetch the built archives from the "build" job
- name: Download built archives artifact
uses: actions/download-artifact@v2
with:
name: pypi-${{ github.sha }}
path: dist

- name: Publish to Test PyPI
if: success()
# Only publish to TestPyPI when a PR is merged (pushed to main)
if: success() && github.event_name == 'push'
uses: pypa/gh-action-pypi-publish@bce3b74dbf8cc32833ffba9d15f83425c1a736e0
with:
user: __token__
Expand Down
71 changes: 11 additions & 60 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# token stolen if the Action is compromised. See the comments and links here:
# https:/pypa/gh-action-pypi-publish/issues/27
#
name: code-style
name: checks

# Only build PRs and the main branch. Pushes to branches will only be built
# when a PR is opened.
Expand All @@ -16,9 +16,7 @@ on:

###############################################################################
jobs:

black:
name: black [format]
format:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -29,19 +27,18 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
python-version: "3.10"

- name: Install requirements
run: pip install black
run: python -m pip install -r env/requirements-style.txt

- name: List installed packages
run: pip freeze
run: python -m pip freeze

- name: Check code format
run: make black-check
run: make black-check license-check

flake8:
name: flake8 [style]
style:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -52,59 +49,13 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
python-version: "3.10"

- name: Install requirements
run: pip install flake8
run: python -m pip install -r env/requirements-style.txt

- name: List installed packages
run: pip freeze
run: python -m pip freeze

- name: Check code style
run: make flake8

pylint:
name: pylint [style]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.9'

- name: Install requirements
run: pip install pylint==2.4.*

- name: List installed packages
run: pip freeze

- name: Linting (pylint)
run: make lint

license:
name: license [style]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.9'

- name: Install requirements
run: pip install pathspec

- name: List installed packages
run: pip freeze

- name: Check license notice on all source files
run: make license-check
run: make flake8 lint
Loading