Skip to content

cicd: update precommit configs #165

cicd: update precommit configs

cicd: update precommit configs #165

Workflow file for this run

name: Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
db_url: ["http://localhost:8000", "postgres://postgres:postgres@localhost:5432/gene_normalizer_test"]
python-version: ["3.10", "3.11", "3.12"]
services:
postgres:
image: postgres:14
env:
POSTGRES_USER: 'postgres'
POSTGRES_DB: 'gene_normalizer_test'
POSTGRES_PASSWORD: 'postgres'
ports:
- 5432:5432
env:
AWS_ACCESS_KEY_ID: ${{ secrets.DUMMY_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.DUMMY_AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-2
AWS_DEFAULT_OUTPUT: text
GENE_NORM_DB_URL: ${{ matrix.db_url }}
GENE_TEST: true
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install DynamoDB dependencies
if: ${{ env.GENE_NORM_DB_URL == 'http://localhost:8000' }}
run: python3 -m pip install ".[etl,test]"
- name: Install PG dependencies
if: ${{ env.GENE_NORM_DB_URL != 'http://localhost:8000' }}
run: python3 -m pip install ".[pg,etl,test]"
- name: Build local DynamoDB
if: ${{ env.GENE_NORM_DB_URL == 'http://localhost:8000' }}
run: |
chmod +x ./tests/unit/dynamodb_build.bash
./tests/unit/dynamodb_build.bash
- name: Run tests
run: python3 -m pytest
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: python3 -m pip install ".[dev]"
- name: Check style
run: python3 -m ruff check . && python3 -m ruff format --check .
precommit_hooks:
runs-on: ubuntu-latest
strategy:
matrix:
hook:
- "end-of-file-fixer"
- "trailing-whitespace"
- "mixed-line-ending"
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
- uses: pre-commit/[email protected]
with:
extra_args: ${{ matrix.hook.args }} --all-files
docs:
runs-on: ubuntu-latest
env:
SPHINX_GITHUB_CHANGELOG_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install '.[docs,pg,etl]'
- name: Attempt docs build
working-directory: ./docs
run: make html