-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
twisted-alike (so similar) automatic publishing on gha (#315)
- Loading branch information
Showing
7 changed files
with
102 additions
and
11 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ name: CI | |
on: | ||
push: | ||
branches: [ master ] | ||
tags: [ "**" ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
|
@@ -53,7 +54,8 @@ jobs: | |
test: | ||
name: ${{ matrix.task.name}} - ${{ matrix.os.name }} ${{ matrix.python.name }} | ||
runs-on: ${{ matrix.os.runs-on }} | ||
needs: build | ||
needs: | ||
- build | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
|
@@ -125,6 +127,8 @@ jobs: | |
check: | ||
name: ${{ matrix.task.name}} - ${{ matrix.python.name }} | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
|
@@ -137,8 +141,6 @@ jobs: | |
task: | ||
- name: Flake8 | ||
tox: flake8 | ||
- name: Check Manifest | ||
tox: check-manifest | ||
- name: Check Newsfragment | ||
tox: check-newsfragment | ||
|
||
|
@@ -147,6 +149,12 @@ jobs: | |
with: | ||
fetch-depth: 0 | ||
|
||
- name: Download package files | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: dist | ||
path: dist/ | ||
|
||
- name: Set up ${{ matrix.python.name }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
|
@@ -160,13 +168,56 @@ jobs: | |
- name: Tox | ||
run: tox -c tox.ini -e ${{ matrix.task.tox }} | ||
|
||
pypi-publish: | ||
# https://github.community/t/is-it-possible-to-require-all-github-actions-tasks-to-pass-without-enumerating-them/117957/4?u=graingert | ||
name: Check tag and publish | ||
runs-on: ubuntu-latest | ||
|
||
needs: | ||
- build | ||
- test | ||
- check | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Download package files | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: dist | ||
path: dist/ | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip setuptools wheel | ||
python -m pip install pep517 | ||
- name: Display structure of files to be pushed | ||
run: ls --recursive dist/ | ||
|
||
- name: Check matched tag version and branch version - on tag | ||
if: startsWith(github.ref, 'refs/tags/') | ||
run: python admin/check_tag_version_match.py "${{ github.ref }}" | ||
|
||
- name: Publish to PyPI - on tag | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: pypa/[email protected] | ||
with: | ||
password: ${{ secrets.PYPI_TOKEN }} | ||
verbose: true | ||
|
||
all: | ||
name: All | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build | ||
- test | ||
- check | ||
- pypi-publish | ||
steps: | ||
- name: This | ||
shell: python | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# | ||
# Used during the release process to make sure that we release based on a | ||
# tag that has the same version as the current twisted.__version. | ||
# | ||
# Designed to be conditionally called inside GitHub Actions release job. | ||
# Tags should use PEP440 version scheme. | ||
# | ||
# To be called as: admin/check_tag_version_match.py refs/tags/twisted-20.3.0 | ||
# | ||
import sys | ||
|
||
import pep517.meta | ||
|
||
TAG_PREFIX = "refs/tags/" | ||
|
||
if len(sys.argv) < 2: | ||
print("No tag check requested.") | ||
sys.exit(0) | ||
|
||
branch_version = pep517.meta.load(".").version | ||
run_version = sys.argv[1] | ||
|
||
if not run_version.startswith(TAG_PREFIX): | ||
print("Not a twisted release tag name '{}.".format(run_version)) | ||
sys.exit(1) | ||
|
||
run_version = run_version[len(TAG_PREFIX) :] | ||
|
||
if run_version != branch_version: | ||
print("Branch is at '{}' while tag is '{}'".format(branch_version, run_version)) | ||
exit(1) | ||
|
||
print("All good. Branch and tag versions match for '{}'.".format(branch_version)) | ||
sys.exit(0) |
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
Empty file.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,16 @@ | ||
# build the sdist | ||
|
||
set -evx | ||
|
||
check-manifest --verbose ${toxinidir} | ||
|
||
python -m build --sdist --outdir ${toxinidir}/dist/ ${toxinidir} | ||
|
||
tar -xvf ${toxinidir}/dist/* | ||
cd * | ||
|
||
# build the wheel from the sdist | ||
python -m build --wheel --outdir ${toxinidir}/dist/ . | ||
cd - | ||
|
||
twine check ${toxinidir}/dist/* |