Skip to content

Commit

Permalink
Merge branch 'main' into strconcat
Browse files Browse the repository at this point in the history
  • Loading branch information
yilei committed Aug 15, 2022
2 parents 58df185 + 4ebf14d commit 86e70f5
Show file tree
Hide file tree
Showing 55 changed files with 724 additions and 322 deletions.
2 changes: 1 addition & 1 deletion .github/mypyc-requirements.txt
@@ -1,4 +1,4 @@
mypy == 0.920
mypy == 0.971

# A bunch of packages for type information
mypy-extensions >= 0.4.3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/doc.yml
@@ -1,4 +1,4 @@
name: Documentation Build
name: Documentation

on: [push, pull_request]

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/fuzz.yml
Expand Up @@ -2,6 +2,10 @@ name: Fuzz

on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

permissions:
contents: read

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up Python
- name: Set up latest Python
uses: actions/setup-python@v4
with:
python-version: "*"
Expand All @@ -27,9 +27,9 @@ jobs:
python -m pip install -e '.[d]'
python -m pip install tox
- name: Lint
- name: Run pre-commit hooks
uses: pre-commit/action@v3.0.0

- name: Run On Self
- name: Format ourselves
run: |
tox -e run_self
56 changes: 48 additions & 8 deletions .github/workflows/pypi_upload.yml
@@ -1,4 +1,4 @@
name: pypi_upload
name: Publish to PyPI

on:
release:
Expand All @@ -8,14 +8,14 @@ permissions:
contents: read

jobs:
build:
name: PyPI Upload
main:
name: sdist + pure wheel
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Python
- name: Set up latest Python
uses: actions/setup-python@v4
with:
python-version: "*"
Expand All @@ -26,11 +26,51 @@ jobs:
python -m pip install --upgrade build twine
- name: Build wheel and source distributions
run: |
python -m build
run: python -m build

- name: Upload to PyPI via Twine
env:
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
twine upload --verbose -u '__token__' dist/*
run: twine upload --verbose -u '__token__' dist/*

mypyc:
name: mypyc wheels (${{ matrix.name }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
name: linux-x86_64
- os: windows-2019
name: windows-amd64
- os: macos-11
name: macos-x86_64
macos_arch: "x86_64"
- os: macos-11
name: macos-arm64
macos_arch: "arm64"
- os: macos-11
name: macos-universal2
macos_arch: "universal2"

steps:
- uses: actions/checkout@v3

- name: Build wheels via cibuildwheel
uses: pypa/cibuildwheel@v2.8.1
env:
CIBW_ARCHS_MACOS: "${{ matrix.macos_arch }}"
# This isn't supported in pyproject.toml which makes sense (but is annoying).
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.6.2"

- name: Upload wheels as workflow artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.name }}-mypyc-wheels
path: ./wheelhouse/*.whl

- name: Upload wheels to PyPI via Twine
env:
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: pipx run twine upload --verbose -u '__token__' wheelhouse/*.whl
64 changes: 44 additions & 20 deletions .github/workflows/test.yml
Expand Up @@ -11,8 +11,15 @@ on:
- "docs/**"
- "*.md"

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
build:
main:
# We want to run on external PRs, but not on our own internal PRs as they'll be run
# by the push to the branch. Without this if check, checks are duplicated since
# internal PRs match both the push and pull_request events.
Expand All @@ -35,29 +42,23 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
- name: Install tox
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade tox
- name: Unit tests
if: "!startsWith(matrix.python-version, 'pypy')"
run: |
tox -e ci-py -- -v --color=yes
run: tox -e ci-py -- -v --color=yes

- name: Unit tests pypy
- name: Unit tests (pypy)
if: "startsWith(matrix.python-version, 'pypy')"
run: |
tox -e ci-pypy3 -- -v --color=yes
run: tox -e ci-pypy3 -- -v --color=yes

- name: Publish coverage to Coveralls
# If pushed / is a pull request against main repo AND
- name: Upload coverage to Coveralls
# Upload coverage if we are on the main repository and
# we're running on Linux (this action only supports Linux)
if:
((github.event_name == 'push' && github.repository == 'psf/black') ||
github.event.pull_request.base.repo.full_name == 'psf/black') && matrix.os ==
'ubuntu-latest'

if: github.repository == 'psf/black' && matrix.os == 'ubuntu-latest'
uses: AndreMiras/coveralls-python-action@v20201129
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -66,17 +67,40 @@ jobs:
debug: true

coveralls-finish:
needs: build
# If pushed / is a pull request against main repo
if:
(github.event_name == 'push' && github.repository == 'psf/black') ||
github.event.pull_request.base.repo.full_name == 'psf/black'
needs: main
if: github.repository == 'psf/black'

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Coveralls finished
- name: Send finished signal to Coveralls
uses: AndreMiras/coveralls-python-action@v20201129
with:
parallel-finished: true
debug: true

uvloop:
if:
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
github.repository
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest]

steps:
- uses: actions/checkout@v3

- name: Set up latest Python
uses: actions/setup-python@v4
with:
python-version: "*"

- name: Install black with uvloop
run: |
python -m pip install pip --upgrade --disable-pip-version-check
python -m pip install -e ".[uvloop]"
- name: Format ourselves
run: python -m black --check src/
22 changes: 13 additions & 9 deletions .github/workflows/upload_binary.yml
@@ -1,16 +1,14 @@
name: Upload self-contained binaries
name: Publish executables

on:
release:
types: [published]

permissions:
contents: read
contents: write # actions/upload-release-asset needs this.

jobs:
build:
permissions:
contents: write # for actions/upload-release-asset to upload release asset
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -38,15 +36,21 @@ jobs:
with:
python-version: "*"

- name: Install dependencies
- name: Install Black and PyInstaller
run: |
python -m pip install --upgrade pip wheel setuptools
python -m pip install .
python -m pip install --upgrade pip wheel
python -m pip install .[colorama]
python -m pip install pyinstaller
- name: Build binary
- name: Build executable with PyInstaller
run: >
python -m PyInstaller -F --name ${{ matrix.asset_name }} --add-data
'src/blib2to3${{ matrix.pathsep }}blib2to3' src/black/__main__.py
- name: Quickly test executable
run: |
python -m PyInstaller -F --name ${{ matrix.asset_name }} --add-data 'src/blib2to3${{ matrix.pathsep }}blib2to3' src/black/__main__.py
./dist/${{ matrix.asset_name }} --version
./dist/${{ matrix.asset_name }} src --verbose
- name: Upload binary as release asset
uses: actions/upload-release-asset@v1
Expand Down
50 changes: 0 additions & 50 deletions .github/workflows/uvloop_test.yml

This file was deleted.

11 changes: 8 additions & 3 deletions .pre-commit-config.yaml
Expand Up @@ -23,6 +23,11 @@ repos:
files: '(CHANGES\.md|the_basics\.md)$'
additional_dependencies: *version_check_dependencies

- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort

- repo: https://github.com/pycqa/flake8
rev: 4.0.1
hooks:
Expand All @@ -33,7 +38,7 @@ repos:
- flake8-simplify

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.940
rev: v0.971
hooks:
- id: mypy
exclude: ^docs/conf.py
Expand All @@ -46,13 +51,13 @@ repos:
- platformdirs >= 2.1.0

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.5.1
rev: v2.7.1
hooks:
- id: prettier
exclude: \.github/workflows/diff_shades\.yml

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
rev: v4.3.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
1 change: 1 addition & 0 deletions AUTHORS.md
Expand Up @@ -20,6 +20,7 @@ Multiple contributions by:
- [Adam Johnson](mailto:me@adamj.eu)
- [Adam Williamson](mailto:adamw@happyassassin.net)
- [Alexander Huynh](mailto:github@grande.coffee)
- [Alexandr Artemyev](mailto:mogost@gmail.com)
- [Alex Vandiver](mailto:github@chmrr.net)
- [Allan Simon](mailto:allan.simon@supinfo.com)
- Anders-Petter Ljungquist
Expand Down

0 comments on commit 86e70f5

Please sign in to comment.