Skip to content

Commit

Permalink
feat: switch to poetry and add stock data directly to py file
Browse files Browse the repository at this point in the history
  • Loading branch information
SlashGordon committed Nov 17, 2023
1 parent e1b3a65 commit e77d253
Show file tree
Hide file tree
Showing 19 changed files with 1,182 additions and 423 deletions.
35 changes: 29 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,40 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python: [3.8]

python-version: [3.11]
poetry-version: [1.7.1]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Cache poetry installation
uses: actions/cache@v2
with:
path: ~/.local
key: poetry-${{ matrix.python-version }}-${{ matrix.poetry-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
poetry-version: ${{ matrix.poetry-version }}
virtualenvs-create: true
virtualenvs-in-project: true
- name: Cache dependencies
uses: actions/cache@v2
with:
python-version: ${{ matrix.python }}
path: .venv
key: pydeps-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: pip install tox
run: poetry install --no-interaction --no-root
if: steps.cache-deps.outputs.cache-hit != 'true'
- name: Run tests
run: tox
run: |
source .venv/bin/activate
python3 tools/yaml2data.py
poetry build
poetry run pytest
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
Expand Down
39 changes: 28 additions & 11 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,40 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python: [3.8]

python-version: [3.11]
poetry-version: [1.7.1]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Cache poetry installation
uses: actions/cache@v2
with:
path: ~/.local
key: poetry-${{ matrix.python-version }}-${{ matrix.poetry-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: ${{ matrix.poetry-version }}
virtualenvs-create: true
virtualenvs-in-project: true
- name: Cache dependencies
uses: actions/cache@v2
with:
python-version: ${{ matrix.python }}
path: .venv
key: pydeps-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: pip install tox
run: poetry install --no-interaction --no-root
if: steps.cache-deps.outputs.cache-hit != 'true'
- name: Run tests
run: |
tox
- name: Coveralls
uses: AndreMiras/coveralls-python-action@develop
with:
parallel: true
debug: true
source .venv/bin/activate
python3 tools/yaml2data.py
poetry build
poetry run pytest
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
Expand Down
43 changes: 29 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,30 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python: [3.8]
python-version: [3.11]
poetry-version: [1.7.1]
steps:
- uses: mickem/clean-after-action@v1
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v1
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: ${{ matrix.poetry-version }}
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install dependencies
run: pip install tox
run: poetry install --no-interaction
- name: Run tests
run: |
tox
source .venv/bin/activate
python3 tools/yaml2data.py
poetry run pytest
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
Expand All @@ -34,17 +45,21 @@ jobs:
with:
parallel: true
debug: true
# Run semantic release:
# - Update CHANGELOG.md
# - Update version in code
# - Create git tag
# - Create GitHub release
# - Publish to PyPI
- name: Python Semantic Release
uses: relekang/python-semantic-release@v8.3.0
id: release
uses: python-semantic-release/python-semantic-release@v8.3.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: steps.release.outputs.released == 'true'
with:
password: ${{ secrets.PYPI_TOKEN_PP }}
- name: Publish package distributions to GitHub Releases
uses: python-semantic-release/upload-to-gh-release@main
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
pypi_token: ${{ secrets.PYPI_TOKEN_PP }}
coveralls_finish:
needs: release
runs-on: ubuntu-latest
Expand All @@ -53,4 +68,4 @@ jobs:
uses: AndreMiras/coveralls-python-action@develop
with:
parallel-finished: true
debug: true
debug: true
48 changes: 33 additions & 15 deletions .github/workflows/symbolscanner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,48 @@ on:
jobs:
scan:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.11]
poetry-version: [1.7.1]
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt update
sudo apt-get install libcurl4-openssl-dev
- name: setup python
uses: actions/setup-python@v2
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
run: pip install wheel
- name: Install dependencies
run: pip install pysymbolscanner
- name: Run scanner
run: pysymbolscanner --input stocks.yaml --output stocks.yaml
- uses: actions/setup-python@v1
python-version: ${{ matrix.python-version }}
- name: Cache poetry installation
uses: actions/cache@v2
with:
python-version: ${{ matrix.python }}
path: ~/.local
key: poetry-${{ matrix.python-version }}-${{ matrix.poetry-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: ${{ matrix.poetry-version }}
virtualenvs-create: true
virtualenvs-in-project: true
- name: Cache dependencies
uses: actions/cache@v2
with:
path: .venv
key: pydeps-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: pip install tox
run: poetry install --no-interaction --no-root
if: steps.cache-deps.outputs.cache-hit != 'true'
- name: Run tests
run: tox
continue-on-error: true
run: |
source .venv/bin/activate
pip3 install pysymbolscanner
pysymbolscanner --input stocks.yaml --output stocks.yaml
python3 tools/yaml2data.py
export SKIP_TEST_VALID_COUNTRY_NAME='true'
export SKIP_TEST_UNIQUE_TICKER_SYMBOLS='true'
poetry run pytest
- name: Coveralls
uses: AndreMiras/coveralls-python-action@develop
with:
Expand Down
69 changes: 0 additions & 69 deletions .github/workflows/symbolscannersymbols.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ index_data.pickle
stocks2.yaml
.history
.DS_Store
src/pytickersymbols/stocks.json
Loading

0 comments on commit e77d253

Please sign in to comment.