From d7e1d70c34c094be63867bc61b32113f7fe9c651 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 16 Nov 2020 22:41:24 +0200 Subject: [PATCH 1/9] Use pre-commit/action --- .github/workflows/lint.yml | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index fd4c7e6..bda0c64 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -2,39 +2,11 @@ name: Lint on: [push, pull_request] -env: - FORCE_COLOR: 1 - jobs: build: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - - - name: Cache - uses: actions/cache@v2 - with: - path: | - ~/.cache/pip - ~/.cache/pre-commit - key: - lint-v2-${{ hashFiles('**/setup.py') }}-${{ - hashFiles('**/.pre-commit-config.yaml') }} - restore-keys: | - lint-v2- - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - - name: Install dependencies - run: | - python -m pip install -U pip - python -m pip install -U tox - - - name: Lint - run: tox -e lint - env: - PRE_COMMIT_COLOR: always + - uses: actions/setup-python@v2 + - uses: pre-commit/action@v2.0.0 From b7e2cce725e2e3e77018bb94ff13c86caad731a5 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 16 Nov 2020 22:41:44 +0200 Subject: [PATCH 2/9] Remove Travis CI --- .travis.yml | 66 ----------------------------------------------------- 1 file changed, 66 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d7865e5..0000000 --- a/.travis.yml +++ /dev/null @@ -1,66 +0,0 @@ -language: python -cache: - pip: true - directories: - - $HOME/.cache/pre-commit - -env: - global: - - secure: ivg6II471E9HV8xyqnawLIuP/sZ0J63Y+BC0BQcRVKtLn/K3zmD1ozM3TFL9S549Nxd0FqDKHXJvXsgaTGIDpK8sxE2AMKV5IojyM0iAVuN7YjPK9vwSlRw1u0EysPMFqxOZVQnoDyHrSGIUrP/VMd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zZI5iHx2gH8Y= - - secure: SsKJoJwtDVWrL5xxl9C/gTRy6FhfRQQNNAFOogl9mTs/WeI2t9QTYoKsxLPXOdoRdu4MvT3h/B2sjwggt7zP81fBVxQRTkg4nq0zSHlj0NqclbFa6I5lUYdGwH9gPk/HWJJwXhKRDsqn/iRw2v+qBDs/j3kIgPQ0yjM58LEPXic= - -matrix: - fast_finish: true - include: - - python: 3.8 - env: TOXENV=lint - - python: 3.9 - - python: 3.8 - - python: 3.7 - - python: 3.6 - - python: 3.10-dev - - python: pypy3 - -install: -- travis_retry pip install -U pip -- travis_retry pip install -U tox-travis - -script: tox - -after_success: - - | - if [ "$TOXENV" != "lint" ]; then - travis_retry pip install -U coveralls && coveralls - travis_retry pip install -U codecov && codecov - fi - -deploy: - - provider: pypi - server: https://test.pypi.org/legacy/ - on: - tags: false - repo: pylast/pylast - branch: master - condition: $TOXENV = lint - user: hugovk - password: - secure: "OCNT7Sf7TpS6aKuqBXEWxJZjmEpdERTBp/yllOd9xnpFt2ZL96CyKtAhPA8zu5OP58QFEZSafZRfXYJoz78RDrx3gOdRXCFT00vXIMnjVvrAlieNEHCVAT0kRW9lYK1Cf5baHYsOYIs6EZf2fEAhdzvmh83G4Y1Y+FPR9tA6uy8=" - distributions: sdist --format=gztar bdist_wheel - skip_existing: true - - provider: pypi - on: - tags: true - repo: pylast/pylast - branch: master - condition: $TOXENV = lint - user: hugovk - password: - secure: "OCNT7Sf7TpS6aKuqBXEWxJZjmEpdERTBp/yllOd9xnpFt2ZL96CyKtAhPA8zu5OP58QFEZSafZRfXYJoz78RDrx3gOdRXCFT00vXIMnjVvrAlieNEHCVAT0kRW9lYK1Cf5baHYsOYIs6EZf2fEAhdzvmh83G4Y1Y+FPR9tA6uy8=" - distributions: sdist --format=gztar bdist_wheel - skip_existing: true From 815dc62dcd38091803b068ec0002478529734955 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 16 Nov 2020 22:51:34 +0200 Subject: [PATCH 3/9] Test on GitHub Actions --- .github/workflows/test.yml | 63 ++++++++++++++++++++++++++++++++++++++ tox.ini | 10 +++--- 2 files changed, 68 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..12e6357 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,63 @@ +name: Test + +on: [push, pull_request] + +env: + FORCE_COLOR: 1 + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python-version: ["3.6", "3.7", "3.8", "3.9", "3.10-dev", "pypy3"] + os: [ubuntu-20.04] + include: + # Include new variables for Codecov + - { codecov-flag: GHA_Ubuntu2004, os: ubuntu-20.04 } + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Get pip cache dir + id: pip-cache + run: | + echo "::set-output name=dir::$(pip cache dir)" + + - name: Cache + uses: actions/cache@v2 + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: + ${{ matrix.os }}-${{ matrix.python-version }}-v3-${{ + hashFiles('**/setup.py') }} + restore-keys: | + ${{ matrix.os }}-${{ matrix.python-version }}-v3- + + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install -U wheel + python -m pip install -U tox + + - name: Tox tests + shell: bash + run: | + tox -e py + env: + PYLAST_API_KEY: ${{ secrets.PYLAST_API_KEY }} + PYLAST_API_SECRET: ${{ secrets.PYLAST_API_SECRET }} + PYLAST_PASSWORD_HASH: ${{ secrets.PYLAST_PASSWORD_HASH }} + PYLAST_USERNAME: ${{ secrets.PYLAST_USERNAME }} + + - name: Upload coverage + uses: codecov/codecov-action@v1 + with: + flags: ${{ matrix.codecov-flag }} + name: ${{ matrix.os }} Python ${{ matrix.python-version }} diff --git a/tox.ini b/tox.ini index 331d4ef..c19e202 100644 --- a/tox.ini +++ b/tox.ini @@ -3,11 +3,11 @@ envlist = py{py3, 310, 39, 38, 37, 36} [testenv] -setenv = - PYLAST_API_KEY = {env:PYLAST_API_KEY:} - PYLAST_API_SECRET = {env:PYLAST_API_SECRET:} - PYLAST_PASSWORD_HASH = {env:PYLAST_PASSWORD_HASH:} - PYLAST_USERNAME = {env:PYLAST_USERNAME:} +passenv = + PYLAST_API_KEY + PYLAST_API_SECRET + PYLAST_PASSWORD_HASH + PYLAST_USERNAME extras = tests commands = From 5413d636ce107f7291ada9cb80a6ea6a6cbff6a5 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 16 Nov 2020 23:45:25 +0200 Subject: [PATCH 4/9] Fix test --- tests/test_network.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_network.py b/tests/test_network.py index 3416260..702b9a9 100755 --- a/tests/test_network.py +++ b/tests/test_network.py @@ -64,7 +64,7 @@ class TestPyLastNetwork(TestPyLastWithLastFm): self.network.enable_rate_limit() then = time.time() # Make some network call, limit not applied first time - self.network.get_user(self.username) + self.network.get_top_artists() # Make a second network call, limiting should be applied self.network.get_top_artists() now = time.time() From c979b72cf3ba656e6896953f56e20c21fbd93c53 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Tue, 17 Nov 2020 17:39:48 +0200 Subject: [PATCH 5/9] Label sync: don't delete existing labels not found in manifest --- .github/workflows/labels.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/labels.yml b/.github/workflows/labels.yml index 2303846..e84c13e 100644 --- a/.github/workflows/labels.yml +++ b/.github/workflows/labels.yml @@ -11,5 +11,7 @@ jobs: steps: - uses: actions/checkout@v2 - uses: micnncim/action-label-syncer@v1 + with: + prune: false env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From e98f493c39a81f62765c4f6266d9013c4d5e1d74 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Tue, 17 Nov 2020 17:40:56 +0200 Subject: [PATCH 6/9] Use version resolver with Release Drafter --- .github/release-drafter.yml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 402bfbf..c121b37 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,5 +1,5 @@ -name-template: "$NEXT_PATCH_VERSION" -tag-template: "$NEXT_PATCH_VERSION" +name-template: "Release $RESOLVED_VERSION" +tag-template: "$RESOLVED_VERSION" categories: - title: "Added" @@ -26,3 +26,20 @@ template: | ## Changes $CHANGES + +version-resolver: + major: + labels: + - "changelog: Removed" + minor: + labels: + - "changelog: Added" + - "changelog: Changed" + - "changelog: Deprecated" + - "enhancement" + + patch: + labels: + - "changelog: Fixed" + - "bug" + default: minor From 0ba17ecfff960f23e19d2dfae656bcd661f3b9e5 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Tue, 17 Nov 2020 17:46:50 +0200 Subject: [PATCH 7/9] Deploy to TestPyPI on merges to master, to prod PyPI for tags --- .github/workflows/deploy.yml | 57 ++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..1f65cb8 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,57 @@ +name: Deploy + +on: + push: + branches: + - master + release: + types: + - published + +jobs: + build: + if: github.repository == 'pylast/pylast' + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Cache + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: deploy-${{ hashFiles('**/setup.py') }} + restore-keys: | + deploy- + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install -U setuptools twine wheel + + - name: Build package + run: | + python setup.py --version + python setup.py sdist --format=gztar bdist_wheel + twine check dist/* + + - name: Publish package to PyPI + if: github.event.action == 'published' + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.pypi_password }} + + - name: Publish package to TestPyPI + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.test_pypi_password }} + repository_url: https://test.pypi.org/legacy/ From e4ca881c951148bbcde39719353dd85599711368 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Tue, 17 Nov 2020 17:50:28 +0200 Subject: [PATCH 8/9] pre-commit autoupdate --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c8a441a..147a7e0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/asottile/pyupgrade - rev: v2.7.2 + rev: v2.7.4 hooks: - id: pyupgrade args: ["--py36-plus"] @@ -15,7 +15,7 @@ repos: types: [] - repo: https://github.com/PyCQA/isort - rev: 5.5.4 + rev: 5.6.4 hooks: - id: isort @@ -26,12 +26,12 @@ repos: additional_dependencies: [flake8-2020, flake8-implicit-str-concat] - repo: https://github.com/pre-commit/pygrep-hooks - rev: v1.6.0 + rev: v1.7.0 hooks: - id: python-check-blanket-noqa - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.2.0 + rev: v3.3.0 hooks: - id: check-merge-conflict - id: check-yaml From 9033debfcd756e2c1ff39e8db910d68da777de5f Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Tue, 17 Nov 2020 17:58:43 +0200 Subject: [PATCH 9/9] Replace Travis CI with GitHub Actions --- .mergify.yml | 2 -- README.md | 5 ++--- RELEASING.md | 7 ++++--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.mergify.yml b/.mergify.yml index f2aad55..dad8639 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -3,8 +3,6 @@ pull_request_rules: conditions: - label=automerge - status-success=build - - status-success=continuous-integration/travis-ci/pr - - status-success=continuous-integration/travis-ci/push actions: merge: method: merge diff --git a/README.md b/README.md index ceed792..69872b5 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,9 @@ pyLast [![PyPI version](https://img.shields.io/pypi/v/pylast.svg)](https://pypi.org/project/pylast/) [![Supported Python versions](https://img.shields.io/pypi/pyversions/pylast.svg)](https://pypi.org/project/pylast/) [![PyPI downloads](https://img.shields.io/pypi/dm/pylast.svg)](https://pypistats.org/packages/pylast) -[![Build status](https://travis-ci.org/pylast/pylast.svg?branch=master)](https://travis-ci.org/pylast/pylast) +[![Test](https://github.com/pylast/pylast/workflows/Test/badge.svg)](https://github.com/pylast/pylast/actions) [![Coverage (Codecov)](https://codecov.io/gh/pylast/pylast/branch/master/graph/badge.svg)](https://codecov.io/gh/pylast/pylast) -[![Coverage (Coveralls)](https://coveralls.io/repos/github/pylast/pylast/badge.svg?branch=master)](https://coveralls.io/github/pylast/pylast?branch=master) -[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/python/black) +[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![DOI](https://zenodo.org/badge/7803088.svg)](https://zenodo.org/badge/latestdoi/7803088) A Python interface to [Last.fm](https://www.last.fm/) and other API-compatible websites such as [Libre.fm](https://libre.fm/). diff --git a/RELEASING.md b/RELEASING.md index 4224482..7e3cdfc 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -1,8 +1,9 @@ # Release Checklist * [ ] Get master to the appropriate code release state. - [Travis CI](https://travis-ci.org/pylast/pylast) should be running cleanly for + [GitHub Actions](https://github.com/pylast/pylast/actions) should be running cleanly for all merges to master. + [![Test](https://github.com/pylast/pylast/workflows/Test/badge.svg)](https://github.com/pylast/pylast/actions) * [ ] Edit release draft, adjust text if needed: https://github.com/pylast/pylast/releases @@ -13,8 +14,8 @@ * [ ] Publish release -* [ ] Check the tagged [Travis CI build](https://travis-ci.org/pylast/pylast) has - deployed to [PyPI](https://pypi.org/project/pylast/#history) +* [ ] Check the tagged [GitHub Actions build](https://github.com/pylast/pylast/actions?query=workflow%3ADeploy) + has deployed to [PyPI](https://pypi.org/project/pylast/#history) * [ ] Check installation: