-
-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor!: poetry, github action overhaul, pyenv / asdf versions #137
Closed
+1,909
−57
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
41fb7a6
refactor!: poetry, github action overhaul, pyenv / asdf versions
tony de670f9
docs(conf): flake8 fix
tony 2cecdf3
build(deps): Add setuptools-types
tony 4ab7d32
docs(Makefile): Update sphinx docs to latest
tony a479ffa
!squash initial commit
tony 1138895
refactor!(settings): Simplify settings structure
tony 06131cf
refactor!(settings): Simplify settings structure
tony File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That seems not needed here. |
||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't needed for development should be kept on your machine. |
||
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 |
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be done here but in the release.yml file instead. Please don't push to PyPI directly, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true ☝️ And I know why that'd be. This is copied from my own project's workflows (it wasn't meant to be added)