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

Cleanup coverage and pypi actions #2804

Merged
merged 8 commits into from
Aug 21, 2023
Merged
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
28 changes: 11 additions & 17 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,23 @@ on:
- main
- current-release
- "*LTS"

jobs:
test:
runs-on: ${{ matrix.os }}
coverage:
name: Check coverage
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
os: [ubuntu-latest]
fail-fast: false

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies 🔨
run: |
python -m pip install --upgrade pip
pip install tox
- name: Run coverage
run: tox -e coverage
continue-on-error: true
- uses: codecov/codecov-action@v2
uses: prryplatypus/simple-tox@main
with:
python-version: "3.9"
tox-env: coverage
ignore-errors: true
- name: Run Codecov
uses: codecov/codecov-action@v2
with:
files: ./coverage.xml
fail_ci_if_error: false
39 changes: 0 additions & 39 deletions .github/workflows/on-demand.yml

This file was deleted.

63 changes: 36 additions & 27 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,45 @@ on:
release:
types: [created]
workflow_dispatch:

env:
IS_TEST: false

jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
build-and-publish-package:
name: Build and publish package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
- name: Checkout repo
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
python-version: "3.9"

- name: Install dependencies
run: pip install build twine

- name: Update package version
run: |
tag_name="${{ github.event.release.tag_name }}"

# Remove leading 'v' from the tag name if exists
if [[ $tag_name == v* ]]; then
version="${tag_name#v}"
else
version="$tag_name"
fi

echo "__version__ = \"${version}\"" > sanic/__version__.py

- name: Build a binary wheel and a source tarball
run: >-
python3 -m
build
--sdist
--wheel
--outdir dist/
.
# - name: Publish distribution 📦 to Test PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# password: ${{ secrets.SANIC_TEST_PYPI_API_TOKEN }}
# repository-url: https://test.pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.SANIC_PYPI_API_TOKEN }}
run: python -m build --sdist --wheel --outdir dist/ .

- name: Publish to PyPi 🚀
run: twine upload --non-interactive --disable-progress-bar dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.SANIC_PYPI_API_TOKEN }}
TWINE_REPOSITORY: ${{ env.IS_TEST == 'true' && 'testpypi' || 'pypi' }}