From 56e2f3cdb1468fc739def203bbd51bc5c9d748ce Mon Sep 17 00:00:00 2001 From: Kevin Mai-Husan Chia Date: Mon, 22 Jan 2024 17:29:28 +0800 Subject: [PATCH] ci: create test.yml --- .github/workflows/test.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..403b054 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,37 @@ +name: Run tests + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + test: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: "3.11" + - name: Use poetry + uses: abatilo/actions-poetry@v2 + - name: Setup a local virtual environment + run: | + poetry config virtualenvs.create true --local + poetry config virtualenvs.in-project true --local + - name: Define a cache for the virtual environment based on the dependencies lock file + uses: actions/cache@v3 + with: + path: ./.venv + key: venv-${{ hashFiles('poetry.lock') }} + - name: Install dependencies + run: poetry install + - name: Run the automated tests (for example) + run: poetry run pytest -v