Skip to content

Commit

Permalink
fix: only try to publish from eyeonus repos
Browse files Browse the repository at this point in the history
fixes eyeonus#134

This makes the publish job dependent on being the eyeonus repository. It also moves the requirements files
into the top-level directory and organizes them into requirements, requirements-dev, and requirements-publish
which incrementally reference the previous requirements file to simplify them.

It's unusual for requirements*.txt to be in a subdirectory these days, and various tools are lazy about it,
which can make these chained-references problematic as some tools will intepret them relatively and some
won't; ergo having them in the tld together is less likely to suddenly not work one day.
  • Loading branch information
kfsone committed Apr 29, 2024
1 parent ba58077 commit fd5c9ab
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 33 deletions.
24 changes: 11 additions & 13 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,20 @@ jobs:

- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install flake8 pytest
python3 -m pip install -r requirements/publish.txt
python3 -m pip install tox tox-gh-actions
# - name: Lint with flake8
# run: |
# # stop the build if there are Python syntax errors or undefined names
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
python3 -m pip install -q --upgrade pip
python3 -m pip install -q requirements-publish.txt
- name: Test with tox
# This will run flake8 tests (which will fail quickly) alongside running
# pylint for a deeper inspect and running unit tests for all available
# python interpreters in parallel
run: |
tox
tox --parallel
pypi-publish:
name: Upload release to PyPI
# No point trying to publish if you're a fork.
if: github.repository == 'eyeonus/Trade-Dangerous'
needs: test
runs-on: ubuntu-latest
environment:
Expand All @@ -71,8 +69,8 @@ jobs:

- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements/publish.txt
python3 -m pip install -q --upgrade pip
python3 -m pip install -q -r requirements-publish.txt
- name: Configure git
run: |
Expand Down
15 changes: 7 additions & 8 deletions docs/develop.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Develop Trade-Dangerous
============================
=======================

## Setup Environment

Expand All @@ -9,19 +9,17 @@ git clone https://github.com/eyeonus/Trade-Dangerous
cd Trade-Dangerous
python3 -m venv venv
. venv/bin/activate
pip3 install -e .
pip3 install -r requirements/dev.txt
pip3 install -r requirements-dev.txt -e .
```

__Windows__
__Windows__ (powershell)
```powershell
git clone https://github.com/eyeonus/Trade-Dangerous
cd Trade-Dangerous
# This requires a python version >= 3.4.2
python3 -m venv venv
.\venv\Scripts\activate
pip3 install -e .
pip3 install -r requirements/dev.txt
.\venv\Scripts\activate.ps1
pip3 install -r requirements-dev.txt -e .
```

## Generate Documentation
Expand All @@ -39,7 +37,8 @@ cd docs
```

### Generate apidoc

```bash
cd docs
sphinx-apidoc -f -s md -o source/ ../tradedangerous ../tradedangerous/mfd ../tradedangerous/templates ../tradedangerous/commands
```
```
16 changes: 8 additions & 8 deletions requirements/dev.txt → requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
mistune<2.0.0
m2r
pytest
Sphinx
-r requirements.txt

tox
flake8
importlib-metadata>=1
wheel
pytest
tox-gh-actions
coverage
ijson
rich==13.7.1

Sphinx
mistune<2.0.0
m2r
3 changes: 2 additions & 1 deletion requirements/publish.txt → requirements-publish.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
-r dev.txt
-r requirements-dev.txt

packaging>=20.0
python-semantic-release
build
twine
wheel
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ skipsdist = true # avoid installation
skip_missing_interpreters = true

[testenv]
deps = -r requirements/dev.txt
deps = -r requirements-dev.txt
passenv =
SYSTEMDRIVE, PROGRAMFILES
platform =
linux|linux2|darwin|nt|win32|win64
# changedir = {toxinidir}/tradedangerous # ?

[testenv:py{37,38,39,310,311}]
deps = -r requirements/dev.txt
deps = -r requirements-dev.txt
commands =
coverage run --source=tradedangerous -m pytest {posargs}
coverage report --show-missing
Expand Down Expand Up @@ -127,7 +127,7 @@ ignore =
[testenv:pylint]
deps =
pylint
-r requirements/dev.txt
-r requirements-dev.txt
commands =
pylint --rcfile {toxinidir}/tox.ini \
tradedangerous/__init__.py \
Expand Down

0 comments on commit fd5c9ab

Please sign in to comment.