Skip to content

Update pyproject.toml #41

Update pyproject.toml

Update pyproject.toml #41

Workflow file for this run

name: Tests
on:
pull_request:
push:
workflow_dispatch:
jobs:
update_database:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Load cached Poetry installation
id: cached-poetry
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-0
- name: Install Poetry
if: steps.cached-poetry.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Get Year-Week Number
id: yearweeknum
run: echo "YEAR_WEEK_NUM=$(date +'%Y-%U')" >> $GITHUB_OUTPUT
shell: bash
- name: Cache Database files
id: cache-db
uses: actions/cache@v3
with:
path: data
key: ${{ runner.os }}-data-${{ steps.yearweeknum.outputs.YEAR_WEEK_NUM }}
- name: Run update script if cache miss
if: steps.cache-db.outputs.cache-hit != 'true'
run: |
poetry install
chmod +x ./update.py
poetry run ./update.py
- name: Clean up unnecessary files
if: always()
run: |
rm -rf data/*.csv data/*.db
tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Load cached Poetry installation
id: cached-poetry
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-0
- name: Install Poetry
if: steps.cached-poetry.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Run tests
run: |
poetry install
poetry run pytest