Skip to content

Bump black from 19.10b0 to 24.3.0 #210

Bump black from 19.10b0 to 24.3.0

Bump black from 19.10b0 to 24.3.0 #210

Workflow file for this run

name: ci
on:
- push
- pull_request
jobs:
# Main CI: this will test the library against all target versions on Linux and
# one version on Mac OS (3.8) to mirror development environment.
check:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python:
- 3.5
- 3.6
- 3.7
- 3.8
- pypy3
os:
- ubuntu-latest
- macos-latest
exclude:
- os: macos-latest
python: 3.5
- os: macos-latest
python: 3.6
- os: macos-latest
python: 3.7
- os: macos-latest
python: pypy3
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python }}
- name: Cache deps
uses: actions/cache@v1
with:
path: .pip-cache
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('requirements*.txt') }}
restore-keys: |
${{ runner.os }}-python-${{ matrix.python }}-
${{ runner.os }}-python-
${{ runner.os }}-
- name: Dependencies
if: matrix.python != 'pypy3'
run: |
mkdir -p .pip-cache
pip install --cache-dir .pip-cache --upgrade -r requirements-dev.txt
pip install -e .
# Some dev dependencies don't build under pypy but testing deps and py-gql
# should work.
- name: Dependencies (PyPy)
if: matrix.python == 'pypy3'
run: |
mkdir -p .pip-cache
pip install --cache-dir .pip-cache --upgrade invoke -r requirements-tests.txt
pip install -e .
- name: (Debug) dependency versions
run: |
python --version
pip --version
pip freeze
- name: Lint (Flake 8)
if: matrix.python != 'pypy3'
run: |
inv flake8 --junit
- name: Lint (Mypy)
if: matrix.python != 'pypy3'
run: |
inv mypy --junit
- name: Test & Coverage
if: matrix.python != 'pypy3'
run: |
inv test -v --coverage --junit --no-bail
- name: Test - No Coverage
if: matrix.python == 'pypy3'
run: |
inv test -v --junit --no-bail
- name: Check benchmarks run
if: matrix.python != 'pypy3'
run: |
inv benchmark
- name: Test with Cython
if: matrix.python != 'pypy3' && matrix.os != 'macos-latest'
run: |
PY_GQL_USE_CYTHON=1 pip install --no-build-isolation -e .
PY_IGNORE_IMPORTMISMATCH=1 inv test -v --no-bail
- name: Build docs
if: matrix.python == '3.8' && matrix.os != 'macos-latest'
run: |
inv docs
- uses: codecov/codecov-action@v1
if: matrix.python != 'pypy3' && matrix.os != 'macos-latest'
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
# Build wheels and source distribution, upload them as build artifacts.
build_universal:
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || contains(github.ref, 'tags/v')
runs-on: ubuntu-latest
needs: [check]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Cache deps
uses: actions/cache@v1
with:
path: .pip-cache
key: ${{ runner.os }}-python-build-deps
- name: Dependencies
run: |
mkdir -p .pip-cache
pip install --cache-dir .pip-cache --upgrade pip wheel setuptools 'invoke~=1.1'
- name: Build base wheel and source distribution
run: inv build
- name: Upload dist
uses: actions/upload-artifact@v1
with:
name: dist.any
path: dist
build_wheels:
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || contains(github.ref, 'tags/v')
runs-on: ubuntu-latest
needs: [check]
strategy:
fail-fast: false
matrix:
version:
- 3.5
- 3.6
- 3.7
- 3.8
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Cache deps
uses: actions/cache@v1
with:
path: .pip-cache
key: ${{ runner.os }}-python-build-deps
- name: Dependencies
run: |
mkdir -p .pip-cache
pip install --cache-dir .pip-cache --upgrade pip wheel setuptools 'cython<3' 'invoke~=1.1'
- name: Build manylinux wheel
run: inv build-manylinux-wheels --cythonize-module --python ${{ matrix.version }}
- name: Upload dist
uses: actions/upload-artifact@v1
with:
name: dist.${{ matrix.version }}
path: dist
collect_dist:
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || contains(github.ref, 'tags/v')
runs-on: ubuntu-latest
needs: [build_universal, build_wheels]
steps:
- name: Download build artifacts (any)
uses: actions/download-artifact@v1
with:
name: dist.any
- name: Download build artifacts (3.5)
uses: actions/download-artifact@v1
with:
name: dist.3.5
- name: Download build artifacts (3.6)
uses: actions/download-artifact@v1
with:
name: dist.3.6
- name: Download build artifacts (3.7)
uses: actions/download-artifact@v1
with:
name: dist.3.7
- name: Download build artifacts (3.8)
uses: actions/download-artifact@v1
with:
name: dist.3.8
- name: Collect
run: |
mkdir -p dist
mv dist.*/*.tar.gz dist
mv dist.*/*.whl dist
touch dist/checksums.txt
find dist -name "py_gql*" -type f -exec sha256sum "{}" + >> dist/checksums.txt
- name: Upload dist
uses: actions/upload-artifact@v1
with:
name: dist
path: dist
# On tag this should create a Github release with the same tag and upload the
# artifacts from the `build` step.
# TODO: Upload to PyPI?
release:
if: success() && contains(github.ref, 'tags/v')
runs-on: ubuntu-latest
needs: [collect_dist]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Inspect and check version
id: version
run: |
version_str=$(echo ${{ github.ref }} | sed 's/refs\/tags\/v//')
package_version=$(grep __version__ py_gql/_pkg.py | sed 's/__version__ = //; s/\"//g')
if ! grep -q -P '^\d+\.\d+\.\d+(?:\.(?:dev|a|b|rc)\d+)?$' <<< "$version_str"; then
echo "::error::Invalid version string $version_str"
exit 1
fi
if [ "$version_str" != "$package_version" ]; then
echo "::error::Tag ($version_str) should match package version ($package_version)"
exit 1
fi
prerelease=$(grep -q -P '\.(?:dev|a|b|rc)\d+$' <<< "$version_str" && echo true || echo false)
echo "::set-output name=version::${version_str}"
echo "::set-output name=prerelease::${prerelease}"
- name: Download build artifacts
uses: actions/download-artifact@v1
with:
name: dist
- name: Create body
id: body
run: |
body=$(cat <<EOF
Release ${{ steps.version.outputs.version }} ($(date -I))
\`\`\`
$(cat dist/checksums.txt)
\`\`\`
EOF
)
escaped="${body//$'\n'/%0A}"
echo "::set-output name=value::$escaped"
- name: Create Release
id: create_release
uses: actions/create-release@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version.outputs.version }}
release_name: Release ${{ steps.version.outputs.version }}
body: ${{ steps.body.outputs.value }}
prerelease: ${{ steps.version.outputs.prerelease }}
draft: true # Let a human promote releases for now
# I'd like to use actions/upload-release-asset but it doesn't support
# globs/dynamic file lists at the moment.
- name: Upload release artifacts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
AUTH="Authorization: token $GITHUB_TOKEN"
URL="https://uploads.github.com/repos/${{ github.repository }}/releases/${{ steps.create_release.outputs.id }}/assets"
for file in dist/*; do
echo "Uploading $file...\n"
curl \
--verbose \
--fail \
-H "$AUTH" \
-H "Content-Type: $(file -b --mime-type "$file")" \
-H "Content-Length: $(stat -c%s "$file")" \
--data-binary @"$file" \
"$URL?name=$(basename "$file")"
done