Lower amount of DB connections (#547) #1940
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: Python CI | |
on: | |
pull_request: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
env: | |
MANIFOLD_API_KEY: ${{ secrets.MANIFOLD_API_KEY }} | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
BET_FROM_ADDRESS: ${{ secrets.BET_FROM_ADDRESS }} | |
BET_FROM_PRIVATE_KEY: ${{ secrets.BET_FROM_PRIVATE_KEY }} | |
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }} | |
GNOSIS_RPC_URL: ${{ secrets.GNOSIS_RPC_URL }} | |
GRAPH_API_KEY: ${{ secrets.GRAPH_API_KEY }} | |
METACULUS_API_KEY: ${{ secrets.METACULUS_API_KEY }} | |
PINATA_API_KEY: ${{ secrets.PINATA_API_KEY }} | |
PINATA_API_SECRET: ${{ secrets.PINATA_API_SECRET }} | |
jobs: | |
mypy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: ./.github/actions/python_prepare | |
- name: Run mypy | |
run: poetry run mypy | |
pytest: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [ '3.10.x', '3.11.x', '3.12.x' ] | |
test: | |
- name: Unit Tests | |
command: 'poetry run python -m pytest tests/ -p no:ape_test -vvv' | |
- name: Integration Tests | |
command: 'poetry run python -m pytest tests_integration/ -p no:ape_test -vvv' | |
- name: Integration with Local Chain | |
command: 'poetry run python -m pytest tests_integration_with_local_chain/ --disable-isolation -vvv' | |
name: pytest - Python ${{ matrix.python-version }} - ${{ matrix.test.name }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: ./.github/actions/python_prepare | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
- name: 'Google Cloud Auth' | |
uses: ./.github/actions/gcp_prepare | |
with: | |
credentials_json: ${{ secrets.GCP_SA_KEY }} | |
- name: Run Tests - ${{ matrix.test.name }} | |
run: ${{ matrix.test.command }} | |
black: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: ./.github/actions/python_prepare | |
- name: Check with black | |
run: poetry run black --check . | |
autoflake: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: ./.github/actions/python_prepare | |
- name: Check with autoflake | |
run: | | |
poetry run autoflake --in-place --remove-all-unused-imports --remove-unused-variables --recursive . | |
git diff --exit-code || exit 1 | |
isort: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: ./.github/actions/python_prepare | |
- name: Check with isort | |
run: | | |
poetry run isort --profile black . | |
git diff --exit-code || exit 1 |