Skip to content

Commit

Permalink
fix(ci): use poetry (#1183)
Browse files Browse the repository at this point in the history
For managing the python dependencies, running the unit tests and
spellchecker. This makes it easier for everyone to have same environment
as CI. Also includes few cosmetic edits for style for the ci.yml
  • Loading branch information
oikarinen authored Nov 29, 2024
1 parent 1345c59 commit 3db275c
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 20 deletions.
42 changes: 30 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
branches: [main]
jobs:
lint:
runs-on: 'ubuntu-latest'
runs-on: ubuntu-latest
steps:
- name: Check out code.
uses: actions/checkout@v4
Expand Down Expand Up @@ -44,26 +44,46 @@ jobs:
steps:
- name: Check out code.
uses: actions/checkout@v4
- name: Install poetry
run: pip install poetry
- name: Set up Python
uses: actions/setup-python@v5
with:
cache: 'poetry'
cache-dependency-path: "tests/pyproject.toml"
python-version-file: "tests/pyproject.toml"
- name: Install dependencies
run: |
cd tests || exit
poetry install --only dev
- name: spell check
run: |
pip install codespell==2.2
git grep --cached -l '' | grep -v -e 'History\.md' -e 'AUTHORS' -e 'man/.*\.1' -e 'man/.*\.html' | xargs codespell --ignore-words=.github/.ignore_words
cd tests
git grep --cached -l '' .. | \
grep -v -e 'History\.md' -e 'AUTHORS' -e 'man/.*\.1' -e 'man/.*\.html' | \
xargs poetry run codespell --ignore-words=../.github/.ignore_words
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
- name: Install poetry
run: pip install poetry
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'poetry'
cache-dependency-path: "tests/pyproject.toml"
python-version-file: "tests/pyproject.toml"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest==8.1.2 GitPython==3.1.43 testpath==0.6.0
cd tests || exit
poetry install --only test
- name: Unit test
run: make test
run: |
cd tests
poetry run pytest
build:
strategy:
Expand All @@ -78,11 +98,9 @@ jobs:
uses: actions/checkout@v4
- name: Linux Install
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get install -y bsdmainutils
run: sudo apt-get install -y bsdmainutils
- name: Script
run: |
./check_integrity.sh
run: ./check_integrity.sh
- name: Brew release
if: matrix.platform == 'macos-latest'
run: |
Expand Down
29 changes: 22 additions & 7 deletions tests/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion tests/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@ license = "MIT"
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.11"
python = "^3.12"

[tool.poetry.group.test.dependencies]
pytest = "8.1.2"
gitpython = "3.1.43"
testpath = "0.6.0"

[tool.poetry.group.dev.dependencies]
codespell = "2.2"

[tool.pytest.ini_options]
minversion = "7.4"
addopts = "-ra -q"
Expand Down

0 comments on commit 3db275c

Please sign in to comment.