Skip to content

Commit

Permalink
feat: implements tox in pipline for CI (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
apoclyps authored May 31, 2024
1 parent c248e23 commit 2b1b879
Show file tree
Hide file tree
Showing 12 changed files with 962 additions and 729 deletions.
9 changes: 9 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
### Issue / Motivation



### Changes

This PR implements the following changes:

1.
34 changes: 34 additions & 0 deletions .github/release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"packages": {
".": {
"package-name": "register-order-calculations",
"release-type": "python",
"include-v-in-tag": false,
"changelog-sections": [
{ "type": "build", "section": "🏗️ Build System", "hidden": true },
{
"type": "chore",
"section": "🧹 Miscellaneous Chores",
"hidden": true
},
{
"type": "ci",
"section": "👷 Continuous Integration",
"hidden": true
},
{ "type": "docs", "section": "📝 Documentation" },
{ "type": "feat", "section": "🚀 Features" },
{ "type": "fix", "section": "🐛 Bug Fixes" },
{ "type": "perf", "section": "⚡ Performance Improvements" },
{
"type": "refactor",
"section": "♻️ Code Refactoring",
"hidden": true
},
{ "type": "revert", "section": "⏪️ Reverts" },
{ "type": "style", "section": "💄 Styles", "hidden": true },
{ "type": "test", "section": "✅ Tests", "hidden": true }
]
}
}
}
19 changes: 3 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
permissions:
contents: write
pull-requests: write
packages: write

jobs:
release:
Expand All @@ -24,21 +25,7 @@ jobs:
# https://github.com/google-github-actions/release-please-action#configuration
release-type: python
package-name: poetry-plugin-upgrade
changelog-types: >
[
{"type": "build", "section": "🏗️ Build System", "hidden": true},
{"type": "chore", "section": "🧹 Miscellaneous Chores", "hidden": true},
{"type": "ci", "section": "👷 Continuous Integration", "hidden": true},
{"type": "docs", "section": "📝 Documentation"},
{"type": "feat", "section": "🚀 Features"},
{"type": "fix", "section": "🐛 Bug Fixes"},
{"type": "perf", "section": "⚡ Performance Improvements"},
{"type": "refactor", "section": "♻️ Code Refactoring", "hidden": true},
{"type": "revert", "section": "⏪️ Reverts"},
{"type": "style", "section": "💄 Styles", "hidden": true},
{"type": "test", "section": "✅ Tests", "hidden": true}
]
include-v-in-tag: false
config-file: .github/release-please-config.json

publish:
name: publish
Expand All @@ -58,7 +45,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"

- name: Install poetry
uses: snok/install-poetry@v1
Expand Down
35 changes: 23 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
name: test

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

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name != 'pull_request' && github.sha || '' }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-latest
name: Run lint/test on python v${{ matrix.python-version }}
runs-on: [ubuntu-latest]
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
python-version:
- "3.10"
- "3.11"
- "3.12"
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -24,12 +35,18 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Install poetry
uses: snok/[email protected]
with:
version: 1.6.1
run: |
python -m pip install poetry==1.8.2
- name: Configure poetry
run: |
python -m poetry config virtualenvs.in-project true
- name: Install dependencies
run: poetry install
run: python -m poetry install --only=dev --no-root

- name: Run Tox
run: poetry run tox

- name: Lint
run: |
Expand All @@ -38,12 +55,6 @@ jobs:
pre-commit run --all-files
pre-commit run commitizen-branch --hook-stage push
- name: Test
run: |
source $(poetry env info --path)/bin/activate
pytest tests -vvv
poetry upgrade --help
- name: Build
run: poetry build

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ htmlcov/
.cache
nosetests.xml
coverage.xml
coverage.lcov
*.cover
*.py,cover
.hypothesis/
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ repos:
"--min-confidence",
"90",
"--exclude",
"tests,env,lib/schemas/fields.py",
"tests,env,lib/schemas/fields.py,.tox",
"--ignore-names",
"einfo,task_id,retval,logger,log_method,exc,args",
".",
Expand Down
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: help lint test
.PHONY: help lint test tox shell

default: help

Expand All @@ -20,3 +20,14 @@ lint: env ## Lint and format the code

test: env ## Run the unit tests and linters
pytest -vv --cov=src --cov-report=term-missing --cov-fail-under=50 tests

install: ## Install dependencies
@poetry config virtualenvs.in-project true
@poetry config virtualenvs.create true
@poetry install --no-root

tox: install ## Run linting/testing in parallel for multiple Python versions
@poetry run tox -p

shell: .env install ## Start the poetry shell
@poetry shell
Loading

0 comments on commit 2b1b879

Please sign in to comment.