imaginAIry/.github/workflows/ci.yaml

74 lines
2.1 KiB
YAML
Raw Normal View History

name: Python Checks
on:
pull_request:
push:
branches:
- master
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
steps:
2022-10-11 04:46:50 +00:00
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.9
2022-10-11 04:46:50 +00:00
cache: pip
cache-dependency-path: requirements-dev.txt
- name: Install dependencies
run: |
2022-10-11 05:37:59 +00:00
python -m pip install --disable-pip-version-check wheel pip-tools
pip-sync requirements-dev.txt
python -m pip install --disable-pip-version-check --no-deps .
- name: Lint
run: |
echo "::add-matcher::.github/pylama_matcher.json"
pylama --options tox.ini
autoformat:
runs-on: ubuntu-latest
steps:
2022-10-11 04:46:50 +00:00
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --disable-pip-version-check black isort
- name: Autoformatter
run: |
black --diff .
isort --atomic --profile black --check-only .
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.10"]
steps:
2022-10-11 04:46:50 +00:00
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
2022-10-11 04:46:50 +00:00
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
2022-10-11 04:46:50 +00:00
cache: pip
cache-dependency-path: requirements-dev.txt
- name: Install dependencies
run: |
python -m pip install --disable-pip-version-check -r requirements-dev.txt
python -m pip install --disable-pip-version-check .
2022-10-11 04:46:50 +00:00
- name: Get current date
id: date
run: echo "::set-output name=curmonth::$(date +'%Y-%m')"
- name: Cache Model Files
id: cache-model-files
uses: actions/cache@v3
with:
2022-10-11 05:28:07 +00:00
path: |
~/.cache/huggingface
~/.cache/clip
~/.cache/imaginairy
~/.cache/torch
2022-10-17 02:58:53 +00:00
key: ${{ steps.date.outputs.curmonth }}-b
- name: Test with pytest
timeout-minutes: 10
run: |
pytest --durations=50 -v