From ca324d84cba15341a953b67ac1926924ae806ad0 Mon Sep 17 00:00:00 2001 From: Jacob Tomlinson Date: Wed, 8 Nov 2023 11:07:02 +0100 Subject: [PATCH] Add GitHub Actions CI to run pytest (#22) --- .github/workflows/test.yaml | 27 +++++++++++++++++++++++++++ pyproject.toml | 9 +++++++++ 2 files changed, 36 insertions(+) create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..01e5b19 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,27 @@ +name: "Test" +on: + pull_request: + push: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + test: + runs-on: ubuntu-latest + timeout-minutes: 45 + strategy: + fail-fast: false + matrix: + python-version: ["3.9", "3.10", "3.11"] + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install hatch + run: pipx install hatch + - name: Run tests + run: hatch run test:run diff --git a/pyproject.toml b/pyproject.toml index dbe796f..850b943 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -92,6 +92,15 @@ all = [ "typing", ] +[tool.hatch.envs.test] +dependencies = [ + "pytest>=7.2.2", + "pytest-timeout>=2.1.0", +] + +[tool.hatch.envs.test.scripts] +run = "pytest" + [tool.black] target-version = ["py37"] line-length = 120