From 125988e40276450d9f3e5c51368cad595a85674d Mon Sep 17 00:00:00 2001 From: William Pietri Date: Thu, 7 Dec 2023 11:39:42 -0800 Subject: [PATCH] Set up CI with poetry and tests --- .github/workflows/python-app.yml | 50 ++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/python-app.yml diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml new file mode 100644 index 00000000..3062d56e --- /dev/null +++ b/.github/workflows/python-app.yml @@ -0,0 +1,50 @@ +name: Python application + +on: + push: + branches: [ "main" ] + pull_request: + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + + - name: cache poetry install + uses: actions/cache@v2 + with: + path: ~/.local + key: poetry-1.7.1-0 + + - name: Install and configure Poetry + uses: snok/install-poetry@v1 + with: + version: 1.7.1 + virtualenvs-create: true + virtualenvs-in-project: true + + - name: cache deps + id: cache-deps + uses: actions/cache@v2 + with: + path: .venv + key: pydeps-${{ hashFiles('**/poetry.lock') }} + + + - name: Install dependencies + run: poetry install --no-interaction --no-root + if: steps.cache-deps.outputs.cache-hit != 'true' + + - name: Test with pytest + run: | + pytest