Skip to content

Commit

Permalink
rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
ofek committed Dec 29, 2021
0 parents commit eef7d0c
Show file tree
Hide file tree
Showing 283 changed files with 34,868 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# TODO: move this to pyproject.toml when supported, see https://github.com/PyCQA/flake8/issues/234

[flake8]
select = B,C,E,F,W,B001,B003,B006,B007,B301,B305,B306,B902,Q000,Q001,Q002,Q003
ignore = E203,E722,W503
exclude = .tox,build,backend/hatchling/utils/compat.py
max-line-length = 120
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
4 changes: 4 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
github:
- ofek
custom:
- https://ofek.dev/donate/
7 changes: 7 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Description
<!--- A few words to describe your changes -->



## Checklist
<!--- We appreciate your help and please add yourself to the AUTHORS file. -->
48 changes: 48 additions & 0 deletions .github/workflows/build-hatch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: build hatch

on:
push:
tags:
- hatch-v*

concurrency:
group: build-hatch-${{ github.head_ref }}

jobs:
build:
name: Build wheels and source distribution
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Install build dependencies
run: python -m pip install --upgrade build

- name: Build source distribution
run: python -m build

- uses: actions/upload-artifact@v2
with:
name: artifacts
path: dist/*
if-no-files-found: error

publish:
name: Publish release
needs:
- build
runs-on: ubuntu-latest

steps:
- uses: actions/download-artifact@v2
with:
name: artifacts
path: dist

- name: Push build artifacts to PyPI
uses: pypa/gh-action-pypi-publish@v1.4.2
with:
skip_existing: true
user: __token__
password: ${{ secrets.PYPI_API_TOKEN_HATCH }}
48 changes: 48 additions & 0 deletions .github/workflows/build-hatchling.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: build hatchling

on:
push:
tags:
- hatchling-v*

concurrency:
group: build-hatchling-${{ github.head_ref }}

jobs:
build:
name: Build wheels and source distribution
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Install build dependencies
run: python -m pip install --upgrade build

- name: Build source distribution
run: python -m build backend

- uses: actions/upload-artifact@v2
with:
name: artifacts
path: backend/dist/*
if-no-files-found: error

publish:
name: Publish release
needs:
- build
runs-on: ubuntu-latest

steps:
- uses: actions/download-artifact@v2
with:
name: artifacts
path: dist

- name: Push build artifacts to PyPI
uses: pypa/gh-action-pypi-publish@v1.4.2
with:
skip_existing: true
user: __token__
password: ${{ secrets.PYPI_API_TOKEN_HATCHLING }}
81 changes: 81 additions & 0 deletions .github/workflows/docs-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: dev docs

on:
push:
branches:
- master
pull_request:
branches:
- master

concurrency:
group: docs-deploy

env:
FORCE_COLOR: "1"

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
# Fetch all history for applying timestamps to every page
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'

- name: Validate history
run: python scripts/validate_history.py

- name: Ensure latest pip
run: python -m pip install --upgrade pip

- name: Install ourself
run: pip install -e .

- name: Configure Git for GitHub Actions bot
run: |
git config --local user.name 'github-actions[bot]'
git config --local user.email 'github-actions[bot]@users.noreply.github.com'
- name: Build documentation
run: hatch run docs:ci-build dev

- name: Create archive
run: git archive -o site.zip gh-pages

- uses: actions/upload-artifact@v2
with:
name: documentation
path: site.zip

publish:
runs-on: ubuntu-latest

if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs:
- build

steps:
- uses: actions/download-artifact@v2
with:
name: documentation

- name: Unpack archive
run: python -m zipfile -e site.zip site

- uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: site
commit_message: ${{ github.event.head_commit.message }}
# Write .nojekyll at the root, see:
# https://help.github.com/en/github/working-with-github-pages/about-github-pages#static-site-generators
enable_jekyll: false
# Only deploy if there were changes
allow_empty_commit: false
83 changes: 83 additions & 0 deletions .github/workflows/docs-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: release docs

on:
create:
tags:
- hatch-v*
- hatchling-v*

concurrency:
group: docs-deploy

env:
FORCE_COLOR: "1"

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
# Fetch all history for applying timestamps to every page
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'

- name: Validate history
run: python scripts/validate_history.py

- name: Ensure latest pip
run: python -m pip install --upgrade pip

- name: Install ourself
run: pip install -e .

- name: Display full version
run: hatch version

- name: Set the version of docs to publish
run: python scripts/set_release_version.py

- name: Configure Git for GitHub Actions bot
run: |
git config --local user.name 'github-actions[bot]'
git config --local user.email 'github-actions[bot]@users.noreply.github.com'
- name: Deploy documentation
run: hatch run docs:ci-build $HATCH_DOCS_VERSION latest

- name: Create archive
run: git archive -o site.zip gh-pages

- uses: actions/upload-artifact@v2
with:
name: documentation
path: site.zip

publish:
runs-on: ubuntu-latest
needs:
- build

steps:
- uses: actions/download-artifact@v2
with:
name: documentation

- name: Unpack archive
run: python -m zipfile -e site.zip site

- uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: site
commit_message: ${{ github.event.head_commit.message }}
# Write .nojekyll at the root, see:
# https://help.github.com/en/github/working-with-github-pages/about-github-pages#static-site-generators
enable_jekyll: false
# Only deploy if there were changes
allow_empty_commit: false
106 changes: 106 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: test

on:
push:
branches:
- master
pull_request:
branches:
- master

concurrency:
group: test-${{ github.head_ref }}
cancel-in-progress: true

env:
PYTHONUNBUFFERED: "1"
FORCE_COLOR: "1"

jobs:
run:
name: Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10']

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Ensure latest pip
run: python -m pip install --upgrade pip

- name: Install ourself
run: pip install -e .

- if: matrix.python-version == '3.9' && runner.os == 'Linux'
name: Lint
run: hatch run lint:all

- name: Run tests
env:
HATCH_CI_PUBLISHER_TOKEN: ${{ secrets.HATCH_CI_PUBLISHER_TOKEN }}
run: hatch run full

downstream:
name: Downstream builds with Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['2.7', '3.8']

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install tools
run: pip install --upgrade -r tests/backend/downstream/requirements.txt

- name: Build downstream projects
run: python tests/backend/downstream/integrate.py

response-time:
name: CLI responsiveness with latest Python
runs-on: ubuntu-latest

env:
PYTHON_VERSION: '3.10'
HYPERFINE_VERSION: '1.12.0'

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install hyperfine
run: |
wget https://github.com/sharkdp/hyperfine/releases/download/v${HYPERFINE_VERSION}/hyperfine_${HYPERFINE_VERSION}_amd64.deb
sudo dpkg -i hyperfine_${HYPERFINE_VERSION}_amd64.deb
- name: Install other tools
run: pip install --upgrade flit poetry pipenv

- name: Install ourself
run: pip install .

- name: Benchmark
run: |
hyperfine -m 100 --warmup 10 -i pipenv
hyperfine -m 100 --warmup 10 poetry
hyperfine -m 100 --warmup 10 -i flit
hyperfine -m 100 --warmup 10 hatch

0 comments on commit eef7d0c

Please sign in to comment.