From 229db7dd5c88a2af886bbd5cc701f80b865f78f2 Mon Sep 17 00:00:00 2001 From: Michael Plunkett <5885605+michplunkett@users.noreply.github.com> Date: Wed, 26 Feb 2025 14:37:49 -0600 Subject: [PATCH] =?UTF-8?q?Add=20test=20CI=20Action=20with=20multiple=20?= =?UTF-8?q?=F0=9F=90=8D=20versions=20(#57)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 2 +- .github/workflows/format-and-fail.yml | 2 +- .github/workflows/test.yml | 40 +++++++++++++++++++++++++++ app/__init__.py | 0 pytest.ini | 2 ++ 5 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/test.yml create mode 100644 app/__init__.py create mode 100644 pytest.ini diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4135ac2..6b8c556 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ on: branches: [ main, dev ] jobs: - test: + test-with-coverage: runs-on: ubuntu-latest services: diff --git a/.github/workflows/format-and-fail.yml b/.github/workflows/format-and-fail.yml index f1c01f8..c203aa9 100644 --- a/.github/workflows/format-and-fail.yml +++ b/.github/workflows/format-and-fail.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: "3.11" - uses: pre-commit/action@v3.0.0 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..1ad37f3 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,40 @@ +name: Run Tests +on: + push: + branches: [ main, dev ] + pull_request: + branches: [ main, dev ] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.10', '3.11', '3.12'] + + services: + redis: + image: redis:6-alpine + ports: + - 6379:6379 + + steps: + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install Poetry + run: pipx install poetry + + - name: Install dependencies + run: poetry install --no-interaction --with dev + + - name: Set dev environment variable + run: echo "ENVIRONMENT_FILE=.env.test" >> $GITHUB_ENV + + - name: Run tests + run: poetry run pytest app/tests diff --git a/app/__init__.py b/app/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..a635c5c --- /dev/null +++ b/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +pythonpath = .