Skip to content

Commit

Permalink
Updated files with 'repo_helper'. (#17)
Browse files Browse the repository at this point in the history
Co-authored-by: repo-helper[bot] <74742576+repo-helper[bot]@users.noreply.github.com>
  • Loading branch information
repo-helper[bot] authored Feb 5, 2022
1 parent a01c59e commit 2e03df8
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 12 deletions.
28 changes: 28 additions & 0 deletions .github/milestones.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env python

# stdlib
import os
import sys

# 3rd party
from github3 import GitHub
from github3.repos import Repository
from packaging.version import InvalidVersion, Version

latest_tag = os.environ["GITHUB_REF_NAME"]

try:
current_version = Version(latest_tag)
except InvalidVersion:
sys.exit()

gh: GitHub = GitHub(token=os.environ["GITHUB_TOKEN"])
repo: Repository = gh.repository(*os.environ["GITHUB_REPOSITORY"].split('/', 1))

for milestone in repo.milestones(state="open"):
try:
milestone_version = Version(milestone.title)
except InvalidVersion:
continue
if milestone_version == current_version:
sys.exit(not milestone.update(state="closed"))
5 changes: 3 additions & 2 deletions .github/workflows/python_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:

permissions:
actions: write
issues: write
contents: read

jobs:
Expand All @@ -21,7 +22,7 @@ jobs:
runs-on: "windows-2019"
continue-on-error: ${{ matrix.config.experimental }}
env:
USING_COVERAGE: '3.6,3.7,3.8,3.9,3.10,3.11.0-alpha.3'
USING_COVERAGE: '3.6,3.7,3.8,3.9,3.10,3.11.0-alpha.5'

strategy:
fail-fast: False
Expand All @@ -32,7 +33,7 @@ jobs:
- {python-version: "3.8", testenvs: "py38,build", experimental: False}
- {python-version: "3.9", testenvs: "py39,build", experimental: False}
- {python-version: "3.10", testenvs: "py310,build", experimental: False}
- {python-version: "3.11.0-alpha.3", testenvs: "py311-dev,build", experimental: True}
- {python-version: "3.11.0-alpha.5", testenvs: "py311-dev,build", experimental: True}

steps:
- name: Checkout 🛎️
Expand Down
19 changes: 14 additions & 5 deletions .github/workflows/python_ci_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ on:

permissions:
actions: write
issues: write
contents: read

jobs:
Expand All @@ -22,7 +23,7 @@ jobs:
runs-on: "ubuntu-20.04"
continue-on-error: ${{ matrix.config.experimental }}
env:
USING_COVERAGE: '3.6,3.7,3.8,3.9,3.10,3.11.0-alpha.3'
USING_COVERAGE: '3.6,3.7,3.8,3.9,3.10,3.11.0-alpha.5'

strategy:
fail-fast: False
Expand All @@ -33,7 +34,7 @@ jobs:
- {python-version: "3.8", testenvs: "py38,build", experimental: False}
- {python-version: "3.9", testenvs: "py39,build", experimental: False}
- {python-version: "3.10", testenvs: "py310,build", experimental: False}
- {python-version: "3.11.0-alpha.3", testenvs: "py311-dev,build", experimental: True}
- {python-version: "3.11.0-alpha.5", testenvs: "py311-dev,build", experimental: True}

steps:
- name: Checkout 🛎️
Expand Down Expand Up @@ -136,21 +137,21 @@ jobs:

- name: Setup Python 🐍
uses: "actions/setup-python@v2"
if: startsWith(github.ref, 'refs/tags/')
with:
python-version: 3.8
if: startsWith(github.ref, 'refs/tags/')

- name: Install dependencies 🔧
if: startsWith(github.ref, 'refs/tags/')
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade tox
if: startsWith(github.ref, 'refs/tags/')
- name: Build distributions 📦
if: startsWith(github.ref, 'refs/tags/')
run: |
tox -e build
if: startsWith(github.ref, 'refs/tags/')
- name: Upload distribution to PyPI 🚀
if: startsWith(github.ref, 'refs/tags/')
Expand All @@ -159,3 +160,11 @@ jobs:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
skip_existing: true

- name: Close milestone 🚪
if: startsWith(github.ref, 'refs/tags/')
run: |
python -m pip install --upgrade github3.py packaging
python .github/milestones.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 3 additions & 2 deletions .github/workflows/python_ci_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:

permissions:
actions: write
issues: write
contents: read

jobs:
Expand All @@ -21,7 +22,7 @@ jobs:
runs-on: "macos-latest"
continue-on-error: ${{ matrix.config.experimental }}
env:
USING_COVERAGE: '3.6,3.7,3.8,3.9,3.10,3.11.0-alpha.3'
USING_COVERAGE: '3.6,3.7,3.8,3.9,3.10,3.11.0-alpha.5'

strategy:
fail-fast: False
Expand All @@ -32,7 +33,7 @@ jobs:
- {python-version: "3.8", testenvs: "py38,build", experimental: False}
- {python-version: "3.9", testenvs: "py39,build", experimental: False}
- {python-version: "3.10", testenvs: "py310,build", experimental: False}
- {python-version: "3.11.0-alpha.3", testenvs: "py311-dev,build", experimental: True}
- {python-version: "3.11.0-alpha.5", testenvs: "py311-dev,build", experimental: True}

steps:
- name: Checkout 🛎️
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ repos:
- --keep-runtime-typing

- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.1.10
rev: v1.1.11
hooks:
- id: remove-crlf
- id: forbid-crlf
Expand Down
3 changes: 1 addition & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ envlist = py36, py37, py38, py39, py310, py311-dev, mypy, build
skip_missing_interpreters = True
isolated_build = True
requires =
pip>=20.3.3
pip>=21
tox-envlist>=0.2.1
tox-pip-version>=0.0.7

[envlists]
test = py36, py37, py38, py39, py310, py311-dev
Expand Down

0 comments on commit 2e03df8

Please sign in to comment.