-
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor!: poetry, github action overhaul, pyenv / asdf versions
- Loading branch information
Showing
9 changed files
with
1,793 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,80 @@ | ||
name: Test | ||
name: tests | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
max-parallel: 5 | ||
matrix: | ||
python-version: ['3.7', '3.8', '3.9', '3.10'] | ||
|
||
python-version: [ '3.9' ] | ||
django-version: [ '2.2', '3.1', '3.2', '4.0', '4.1' ] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install poetry | ||
run: pipx install "poetry==1.2.1" | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Get pip cache dir | ||
id: pip-cache | ||
run: | | ||
echo "::set-output name=dir::$(pip cache dir)" | ||
- name: Cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.pip-cache.outputs.dir }} | ||
key: | ||
${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/tox.ini') }} | ||
restore-keys: | | ||
${{ matrix.python-version }}-v1- | ||
cache: 'poetry' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install --upgrade tox tox-gh-actions | ||
poetry install -E "docs test coverage lint format" | ||
poetry run pip install DJANGO~=${{ matrix.django-version }} | ||
- name: Tox tests | ||
- name: Print python versions | ||
run: | | ||
tox -v | ||
python -V | ||
poetry run python -V | ||
- name: Lint with flake8 | ||
run: poetry run flake8 | ||
|
||
- name: Lint with mypy | ||
run: poetry run mypy . | ||
|
||
- name: Upload coverage | ||
uses: codecov/codecov-action@v1 | ||
- name: Test with pytest | ||
run: poetry run py.test --cov=./ --cov-report=xml | ||
|
||
- uses: codecov/codecov-action@v2 | ||
with: | ||
name: Python ${{ matrix.python-version }} | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | ||
|
||
strategy: | ||
matrix: | ||
python-version: ["3.10"] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install poetry | ||
run: pipx install "poetry==1.2.1" | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: 'poetry' | ||
|
||
- name: Build package | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | ||
run: poetry build | ||
|
||
- name: Publish package | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
skip_existing: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.10.7 3.9.13 3.8.13 3.7.12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
session_name: django-robots | ||
start_directory: ./ # load session relative to config location (project root). | ||
shell_command_before: | ||
- '[ -f .venv/bin/activate ] && source .venv/bin/activate && reset' | ||
windows: | ||
- window_name: django-robots | ||
focus: True | ||
layout: main-horizontal | ||
options: | ||
main-pane-height: 35 | ||
panes: | ||
- focus: true | ||
- pane | ||
- make watch_test | ||
- window_name: docs | ||
layout: main-horizontal | ||
options: | ||
main-pane-height: 35 | ||
start_directory: docs/ | ||
panes: | ||
- focus: true | ||
- pane | ||
- pane | ||
- make start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
poetry 1.2.1 | ||
python 3.10.7 3.9.13 3.8.13 3.7.12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
WATCH_FILES= find . -type f -not -path '*/\.*' | grep -i '.*[.]py$$' 2> /dev/null | ||
PY_FILES= find . -type f -not -path '*/\.*' -and -not -path '*/settings\/*' -and -not -path '*/migrations\/*' | grep -i '.*[.]py$$' | ||
SHELL := /bin/bash | ||
|
||
|
||
entr_warn: | ||
@echo "----------------------------------------------------------" | ||
@echo " ! File watching functionality non-operational ! " | ||
@echo " " | ||
@echo "Install entr(1) to automatically run tasks on file change." | ||
@echo "See http://entrproject.org/ " | ||
@echo "----------------------------------------------------------" | ||
|
||
build_docs: | ||
pushd docs; $(MAKE) html; popd | ||
|
||
watch_docs: | ||
pushd docs; $(MAKE) watch_docs; popd | ||
|
||
start: | ||
$(MAKE) test; poetry run ptw . | ||
|
||
test: | ||
poetry run py.test $(test) | ||
|
||
watch_test: | ||
if command -v entr > /dev/null; then ${WATCH_FILES} | entr -c $(MAKE) test; else $(MAKE) test entr_warn; fi | ||
|
||
start_docs: | ||
$(MAKE) -C docs start | ||
|
||
design_docs: | ||
$(MAKE) -C docs design | ||
|
||
black: | ||
poetry run black `${PY_FILES}` | ||
|
||
isort: | ||
poetry run isort `${PY_FILES}` | ||
|
||
flake8: | ||
poetry run flake8 | ||
|
||
watch_flake8: | ||
if command -v entr > /dev/null; then ${WATCH_FILES} | entr -c $(MAKE) flake8; else $(MAKE) flake8 entr_warn; fi | ||
|
||
mypy: | ||
poetry run mypy `${PY_FILES}` | ||
|
||
watch_mypy: | ||
if command -v entr > /dev/null; then ${PY_FILES} | entr -c $(MAKE) mypy; else $(MAKE) mypy entr_warn; fi | ||
|
||
format_markdown: | ||
prettier --parser=markdown -w *.md docs/*.md docs/**/*.md CHANGES |
Oops, something went wrong.