Skip to content

Commit

Permalink
Merge pull request #12 from hsaunders1904/add_ability_to_ignore_direc…
Browse files Browse the repository at this point in the history
…tories

Add ability to ignore directories
  • Loading branch information
hsaunders1904 authored Jun 14, 2024
2 parents fc68b29 + 3b99750 commit 33ea71a
Show file tree
Hide file tree
Showing 10 changed files with 554 additions and 344 deletions.
55 changes: 25 additions & 30 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,45 +1,40 @@
name: pyautoenv test

on:
pull_request:
push:
branches: [main]

jobs:
test:
name: Test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Code Quality
run: |
python -m pip install pre-commit
pre-commit run --all-files
- name: Test
run: |
python -m pip install poetry
poetry install --only=test
poetry run pytest --cov --cov-report=term-missing --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Code Quality
run: |
python -m pip install pre-commit
pre-commit run --all-files
- name: Test
run: |
python -m pip install poetry
poetry install --only=test
poetry run pytest --cov --cov-report=term-missing --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}

test-windows:
name: Test-Windows
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Test
run: |
python -m pip install poetry
poetry install --only=test
poetry run pytest --cov --cov-report=term-missing
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Test
run: |
python -m pip install poetry
poetry install --only=test
poetry run pytest --cov --cov-report=term-missing
57 changes: 27 additions & 30 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,39 @@
name: pyautoenv release

on:
workflow_dispatch:
inputs:
version:
type: string
description: "New version e.g., 3.1.4"
description: New version e.g., 3.1.4
required: true

jobs:
release:
name: Release
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Validate Version
run: |
python -m pip install toml
poetry_version="$(python -c 'import toml; print(toml.load("pyproject.toml")["tool"]["poetry"]["version"])')"
echo "Version from input: ${{ github.event.inputs.version }}"
echo "Version from poetry: ${poetry_version}"
if ! [ "${{ github.event.inputs.version }}" = "${poetry_version}" ]; then
exit 1;
fi
script_version="$(python -c 'import pyautoenv; print(pyautoenv.__version__)')"
echo "Version from script: ${script_version}"
if ! [ "${poetry_version}" = "${script_version}" ]; then
exit 1;
fi
- name: Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "v${{ github.event.inputs.version }}" \
--target main \
--generate-notes \
--draft
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Validate Version
run: |
python -m pip install toml
poetry_version="$(python -c 'import toml; print(toml.load("pyproject.toml")["tool"]["poetry"]["version"])')"
echo "Version from input: ${{ github.event.inputs.version }}"
echo "Version from poetry: ${poetry_version}"
if ! [ "${{ github.event.inputs.version }}" = "${poetry_version}" ]; then
exit 1;
fi
script_version="$(python -c 'import pyautoenv; print(pyautoenv.__version__)')"
echo "Version from script: ${script_version}"
if ! [ "${poetry_version}" = "${script_version}" ]; then
exit 1;
fi
- name: Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "v${{ github.event.inputs.version }}" \
--target main \
--generate-notes \
--draft
44 changes: 25 additions & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: mixed-line-ending
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.4.2
- id: end-of-file-fixer
- id: trailing-whitespace
- id: mixed-line-ending
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.4
hooks:
- id: remove-crlf
- id: forbid-tabs
- repo: https://github.com/psf/black
rev: 23.1.0
- id: remove-crlf
- id: forbid-tabs
- repo: https://github.com/psf/black
rev: 23.11.0
hooks:
- id: black
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.259
hooks:
- id: ruff
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.1.1
- id: black
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.1.6
hooks:
- id: mypy
- id: ruff
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.0
hooks:
- id: mypy
additional_dependencies:
- types-toml
- repo: https://github.com/google/yamlfmt
rev: v0.10.0
hooks:
- id: yamlfmt
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,10 @@ There are some environment variables you can set to configure `pyautoenv`.
For example, if set to `.venv;venv`, on each directory change,
`pyautoenv` will look for an environment within `.venv`,
if that directory does not exist, it will look for an environment in `venv`.
- `PYAUTOENV_IGNORE_DIR`:
If you wish to disable `pyautoenv` for a specific set of directories,
you can list these directories here,
separated with a `;`.
The directories, and their children,
will be treated as though no virtual environment exists for them.
This means any active environment will be deactivated when changing to them.
Loading

0 comments on commit 33ea71a

Please sign in to comment.