Skip to content

Commit

Permalink
feat: Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
janw committed Jan 27, 2024
0 parents commit 306ded4
Show file tree
Hide file tree
Showing 18 changed files with 2,688 additions and 0 deletions.
1 change: 1 addition & 0 deletions .assets/created.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/Users/jan/repos/poetry-brew/.assets/homebrew-formula-help.svg
150 changes: 150 additions & 0 deletions .assets/homebrew-formula-help.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
liberapay: janw
ko_fi: janwxyz
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: pip
directory: /
schedule:
interval: weekly
labels:
- dependencies
commit-message:
prefix: "build(deps)"
54 changes: 54 additions & 0 deletions .github/workflows/linters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Linters

on:
pull_request:

jobs:
commitizen:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v3
with:
fetch-depth: 0
sparse-checkout: |
pyproject.toml
sparse-checkout-cone-mode: false

- name: Install commitizen
run: pipx install commitizen

- run: cz check --rev-range origin/main..HEAD
shell: bash

pre-commit-extras:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v3

- name: Install commitizen
run: pipx install poetry

- name: Set up python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: 'poetry'

- run: poetry install --with=dev

- uses: pre-commit/[email protected]
with:
extra_args: >
rich-codex
mypy
--all-files
- uses: actions/upload-artifact@v4
with:
name: assets
path: |
.assets/*
retention-days: 3
if: always()
50 changes: 50 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Publish

on:
push:
tags:
- "v*.*.*"
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4

- name: Install poetry
run: pipx install poetry

- name: Build package
run: poetry build -vvv

- uses: actions/upload-artifact@v4
with:
name: package
path: |
README.md
pyproject.toml
dist/*
if-no-files-found: error
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')

pypi:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
environment: release
needs: build
steps:
- name: Install poetry
run: pipx install poetry

- uses: actions/download-artifact@v4
with:
name: package

- run: ls dist/*

- name: Publish package
run: poetry publish
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
62 changes: 62 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Tests

on:
pull_request:
push:
branches:
- "main"
tags:
- "*"

env:
POETRY_EDGE_SOURCE: 'git+https://github.com/python-poetry/poetry.git'

jobs:
pytest:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version:
- "3.10"
- "3.11"
- "3.12"
- "3.13-dev"
poetry-version:
- "1.6"
- "1.7"
- "edge"

name: pytest-${{ matrix.python-version }}-${{ matrix.poetry-version }}
steps:
- name: Check out
uses: actions/checkout@v4

- name: Install poetry
run: pipx install poetry

- name: Set up python environment
uses: actions/setup-python@v5
with:
cache: poetry
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: poetry install --no-root --with=tests --sync

- name: Install poetry version under test
run: |
if [ "${{ matrix.poetry-version }}" = "edge" ]; then
poetry run pip install -U "${{ env.POETRY_EDGE_SOURCE }}";
else
poetry run pip install -U "poetry~=${{ matrix.poetry-version }}";
fi
- run: poetry run pytest --cov-report=xml

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
name: coverage-${{ matrix.python-version }}-${{ matrix.poetry-version }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.ruff_cache/
dist/

.coverage
coverage.xml
55 changes: 55 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
ci:
autofix_prs: false
autoupdate_schedule: quarterly
autoupdate_commit_msg: 'build(pre-commit): [pre-commit.ci] pre-commit autoupdate'
skip: # see linters.yaml -> pre-commit-extras job
- "rich-codex"
- "mypy"

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.1.11'
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]
- id: ruff-format

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.4.0"
hooks:
- id: trailing-whitespace
exclude_types: [svg]
- id: end-of-file-fixer
- id: check-yaml
- id: debug-statements
- id: check-ast

- repo: https://github.com/python-poetry/poetry
rev: '1.7.1'
hooks:
- id: poetry-check

- repo: local
hooks:
- id: rich-codex
name: rich-codex
language: system
entry: >
env
FORCE_COLOR=1
TERMINAL_WIDTH=140
poetry run rich-codex
--skip-git-checks
--no-confirm
--terminal-theme MONOKAI
--created-files .assets/created.txt
pass_filenames: false
types: [markdown]
files: '(\.md|cli\.py|config\.py)$'

- id: mypy
name: mypy
entry: poetry run mypy
language: system
require_serial: true
pass_filenames: false
Loading

0 comments on commit 306ded4

Please sign in to comment.