Bump ruff from 0.0.272 to 0.5.5 #628
Workflow file for this run
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
name: tests | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
types: | |
- opened | |
- synchronize | |
- reopened | |
- ready_for_review | |
concurrency: | |
group: python-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
permissions: | |
pull-requests: write | |
contents: read | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} | |
COVERALLS_PARALLEL: true | |
PYTHONPATH: src | |
STOCKTRACER_CACHE_DIR: .stocktracer-cache | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 1 | |
matrix: | |
python-version: ["3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install poetry | |
run: | | |
pipx install poetry | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "poetry" | |
- run: poetry install --extras "tensorflow" | |
if: ${{ matrix.python-version == '3.10' }} | |
- run: poetry install | |
if: ${{ matrix.python-version != '3.10' }} | |
- name: Cache Network Requests | |
uses: actions/cache@v3 | |
with: | |
key: sqlite-${{ hashFiles('**/tests/fixtures/network.py', '**/stocktracer/cache.py', 'smoke-test.sh') }} | |
path: | | |
${{ env.STOCKTRACER_CACHE_DIR }}/data.sqlite | |
${{ env.STOCKTRACER_CACHE_DIR }}/tickers.sqlite | |
if: ${{ !github.event.pull_request.draft }} | |
- name: Run - unit-tests | |
run: | | |
poetry run coverage run --concurrency=multiprocessing -m pytest --doctest-modules | |
# Just to cut down on network testing while initially iterating | |
- name: Run - network-tests | |
run: | | |
poetry run coverage run --concurrency=multiprocessing -a -m pytest -m webtest --run-webtest | |
if: ${{ !github.event.pull_request.draft }} | |
- name: Run - smoke-tests | |
run: | | |
./smoke-test.sh | |
if: ${{ !github.event.pull_request.draft && matrix.python-version == '3.10' }} | |
- name: Coveralls | |
run: | | |
poetry run coverage combine | |
poetry run coveralls --service=github | |
# - name: Coveralls | |
# uses: coverallsapp/github-action@v2 | |
# with: | |
# github-token: ${{ secrets.GITHUB_TOKEN }} | |
# flag-name: run-${{ join(matrix.*, '-') }} | |
# parallel: true | |
# format: python | |
# if: ${{ success() }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
retention-days: 5 | |
name: smoke-results ${{ matrix.python-version }} | |
path: ${{ github.workspace }}/docs/.smoke-tests | |
if: ${{ !github.event.pull_request.draft && matrix.python-version == '3.10'}} | |
# - name: Upload pytest test results | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: pytest-results-${{ matrix.python-version }} | |
# path: junit/test-results-${{ matrix.python-version }}.xml | |
# # Use always() to always run this step to publish test results when there are test failures | |
# if: ${{ always() }} | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install poetry | |
run: | | |
pipx install poetry | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" # pylint wrapt not supported on 3.11 yet | |
cache: "poetry" | |
- run: poetry install --extras "tensorflow" | |
- name: Lint - Ruff | |
run: poetry run ruff src | |
if: ${{ always() }} | |
- name: Lint - Black | |
run: poetry run black --check src | |
if: ${{ always() }} | |
- name: Lint - isort | |
run: poetry run isort --check src | |
if: ${{ always() }} | |
- name: Lint - pylint (src/stocktracer) | |
run: poetry run pylint -E src/stocktracer | |
if: ${{ always() }} | |
# - name: Lint - pydocstyle | |
# run: | | |
# pydocstyle | |
# if: ${{ always() }} | |
- name: Lint - pydoctest | |
run: PYTHONPATH=src poetry run pydoctest --config pydocktest.json | |
if: ${{ always() }} | |
verify-packaging: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install poetry | |
run: | | |
pipx install poetry | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
cache: "poetry" | |
- run: poetry install | |
- name: Run Test | |
run: | | |
./verify-packaging.sh | |
finish: | |
needs: build | |
if: ${{ always() }} | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
cache: "pip" | |
- name: Install dependencies | |
run: | | |
pip install coveralls | |
- name: Coveralls Finished | |
run: | | |
coveralls --service=github --finish | |
# - name: Coveralls Finished | |
# uses: coverallsapp/github-action@v2 | |
# with: | |
# github-token: ${{ secrets.GITHUB_TOKEN }} | |
# parallel-finished: true | |
# carryforward: "run-1,run-2,run-3" | |
docs: | |
runs-on: ubuntu-latest | |
needs: [build] | |
if: ${{ !github.event.pull_request.draft }} | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # so we get the correct modification date | |
- name: Install poetry | |
run: | | |
pipx install poetry | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
cache: "poetry" | |
- run: poetry install --with docs | |
- uses: actions/download-artifact@v3 | |
with: | |
name: smoke-results 3.10 | |
path: ${{ github.workspace }}/docs/.smoke-tests | |
- name: Test | |
if: github.ref != 'refs/heads/main' | |
run: | | |
poetry run mkdocs build --strict | |
- name: Deploy | |
if: github.ref == 'refs/heads/main' | |
run: | | |
poetry run mkdocs gh-deploy --force |