Skip to content

Commit

Permalink
Merge pull request #2 from tjquillan/ci
Browse files Browse the repository at this point in the history
Add CI configurations
  • Loading branch information
tjquillan authored Nov 19, 2022
2 parents 260b2e1 + bd5a833 commit bcf053d
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 1 deletion.
63 changes: 63 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Tests

on:
push:
branches:
- main
pull_request: {}

concurrency:
group: tests-${{ github.head_ref || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
tests:
name: ${{ matrix.os }} / ${{ matrix.python-version }} ${{ matrix.suffix }}
runs-on: ${{ matrix.image }}
strategy:
matrix:
os: [Ubuntu, macOS, Windows]
python-version: ["3.8", "3.9", "3.10", "3.11"]
include:
- os: Ubuntu
image: ubuntu-latest
- os: Windows
image: windows-2022
- os: macOS
image: macos-11
fail-fast: false
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3

- name: Bootstrap poetry
run: |
curl -sL https://install.python-poetry.org | python3 - -y ${{ matrix.bootstrap-args }}
- name: Update PATH
if: ${{ matrix.os != 'Windows' }}
run: echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Update PATH for Windows
if: ${{ matrix.os == 'Windows' }}
run: echo "$APPDATA\Python\Scripts" >> $GITHUB_PATH

- name: Configure poetry
run: poetry config virtualenvs.in-project true

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
id: python
with:
python-version: ${{ matrix.python-version }}
cache: "poetry"

- name: Install dependencies
run: poetry install --with ci

- name: Run mypy
run: poetry run mypy

- name: Run pytest
run: poetry run pytest -p no:sugar -q tests/
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Release

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

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

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

- name: Install Poetry
run: |
curl -sL https://install.python-poetry.org | python - -y ${{ matrix.bootstrap-args }}
- name: Update PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Build project for distribution
run: poetry build

- name: Check Version
id: check-version
run: |
[[ "$(poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] \
|| echo name=prerelease::true >> $GITHUB_OUTPUT
- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: "dist/*"
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
prerelease: steps.check-version.outputs.prerelease == 'true'

- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
run: poetry publish
2 changes: 1 addition & 1 deletion poetry_plugin_pyenv/pyenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

# See: https://regex101.com/r/Bz2g17/1
PYTHON_VERSION_REGEX: Pattern[str] = re.compile(
r"^\s*(\d+.*)\s*$", re.IGNORECASE | re.MULTILINE
r"^\s*(\d+\S*)\s*$", re.IGNORECASE | re.MULTILINE
)


Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ lines_after_imports = 2
strict = true
show_error_codes = true
namespace_packages = true
files = ["poetry_plugin_pyenv", "tests"]

[[tool.mypy.overrides]]
module = [
'cleo.*',
]
ignore_missing_imports = true

[build-system]
requires = ["poetry-core"]
Expand Down

0 comments on commit bcf053d

Please sign in to comment.