Skip to content

Move sample location. #15

Move sample location.

Move sample location. #15

name: build
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
permissions:
contents: read
jobs:
build-test:
# Original source: https://github.com/marketplace/actions/install-poetry-action#testing
runs-on: ubuntu-latest
steps:
- name: Check out repo and setup Python
uses: actions/checkout@v4
- name: Set up python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Load cached Poetry installation, if exists
id: cached-poetry
uses: actions/cache@v4
with:
path: ~/.local # the path depends on the OS
key: poetry-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-3 # increment to reset cache, e.g. if you see .venv/bin/activate: No such file or directory
- name: Install and configure Poetry, if cache miss
if: steps.cached-poetry.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Load cached venv, if exists
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}-1
- name: Install dependencies (without root project), if cache miss
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Install root project
run: poetry install --no-interaction
- name: Run style check - black
run: |
source .venv/bin/activate
black gptauthor tests --check --verbose
- name: Run linter - ruff
run: |
source .venv/bin/activate
ruff check . --verbose
- name: Run tests
# env:
# OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
source .venv/bin/activate
coverage run -m pytest -vvv -s ./tests
coverage report