Repository: simon-ritchie/apysc (language: python)

Issue:
Add a workflow for running `pytest` during a pull request



Discussion / hints:

Fix patch:
diff --git a/apysc/__init__.py b/apysc/__init__.py
index 175cf97f0..5bc9e123d 100644
--- a/apysc/__init__.py
+++ b/apysc/__init__.py
@@ -141,4 +141,4 @@
 True_: __True = __True()
 False_: __False = __False()
 
-__version__: str = "4.0.47"
+__version__: str = "4.0.48"


Test patch:
diff --git a/.github/workflows/run_pytest_when_pull_request.yml b/.github/workflows/run_pytest_when_pull_request.yml
new file mode 100644
index 000000000..331a31d28
--- /dev/null
+++ b/.github/workflows/run_pytest_when_pull_request.yml
@@ -0,0 +1,35 @@
+name: Run the pytest command when a pull request is created or updated
+on:
+  pull_request:
+    types: [opened, synchronize]
+jobs:
+  SetGlobalConstants:
+    runs-on: ubuntu-latest
+    timeout-minutes: 10
+    outputs:
+      PYTHON_VERSION: 3.11.1
+    steps:
+      - run: echo 'Setting constans.'
+  RunPytest:
+    needs: SetGlobalConstants
+    runs-on: ubuntu-latest
+    timeout-minutes: 10
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v4
+      - name: CreateCache
+        uses: ./.github/actions/create_env_cache
+        with:
+          python-version: ${{ needs.SetGlobalConstants.outputs.PYTHON_VERSION }}
+      - name: Setup the Python dependencies
+        uses: ./.github/actions/setup_py_dependencies
+        with:
+          python-version: ${{ needs.SetGlobalConstants.outputs.PYTHON_VERSION }}
+      - name: Install playwright and Chromium
+        run: playwright install chromium
+      - name: Run the test runner command
+        uses: nick-fields/retry@v2
+        with:
+          timeout_seconds: 300
+          max_attempts: 3
+          command: python ./scripts/run_tests.py