Fix NameError
by importing urllib
at the top level (#6)
#33
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Continuous Integration | |
on: [push, pull_request] | |
defaults: | |
run: | |
shell: bash | |
concurrency: | |
group: ci-tests-${{ github.ref }}-1 | |
cancel-in-progress: true | |
jobs: | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04, macos-11, windows-2019] | |
python-version: [ "3.6", "3.7", "3.8", "3.9", "3.10", "pypy3.7", "pypy3.8", "pypy3.9", ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Set up python | |
id: setup-python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Print Python Information | |
run: python -VV | |
- name: Install and configure Poetry | |
run: | | |
pip3 install poetry | |
poetry config virtualenvs.in-project true | |
- name: Set up cache | |
uses: syphar/[email protected] | |
id: cache-virtualenv | |
with: | |
requirement_files: poetry.lock | |
custom_virtualenv_dir: .venv | |
- name: Install dependencies | |
run: poetry install | |
if: steps.cache-virtualenv.outputs.cache-hit != 'true' | |
- name: run tests | |
run: poetry run pytest -vv tests/* | |
builder: | |
needs: [test] | |
if: github.ref == 'refs/heads/master' | |
strategy: | |
matrix: | |
os: [macos-11, windows-2019] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v2 | |
- name: Discover python architecture | |
run: | | |
if [ "$RUNNER_OS" == "Windows" ]; then | |
echo "PYTHON_ARCHITECTURE=x86" >> $GITHUB_ENV | |
else | |
echo "PYTHON_ARCHITECTURE=x64" >> $GITHUB_ENV | |
fi | |
- name: Set up python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9.x" | |
architecture: "${{ env.PYTHON_ARCHITECTURE }}" | |
- name: Print Python Information | |
run: python -VV | |
- name: Update dependencies | |
run: python -m pip install -U pip wheel setuptools twine poetry | |
- name: Set up cache | |
uses: syphar/[email protected] | |
id: cache-virtualenv | |
with: | |
requirement_files: poetry.lock | |
custom_virtualenv_dir: .venv | |
- name: Install dependencies | |
run: poetry install | |
if: steps.cache-virtualenv.outputs.cache-hit != 'true' | |
- name: Build universal source Archive and wheel | |
run: poetry build | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
publisher_release: | |
needs: [builder] | |
if: startsWith(github.event.ref, 'refs/tags/v') && github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
verbose: true | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
publisher_latest: | |
needs: [builder] | |
if: github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Make release | |
uses: "marvinpinto/[email protected]" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
prerelease: true | |
title: "Latest Development Version" | |
automatic_release_tag: "latest" | |
files: dist/* |