From c59c0d8c6b3dbca4902b48cdc7f86afc3d6426b3 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Fri, 9 Dec 2022 17:24:55 -0500 Subject: [PATCH] add action to run pytests (#1167) This PR adds a github action that runs pytests on the python code within pygw. The package is tested with python versions 3.7,. 3.8, 3.9 and 3.10. After this PR, tests will be required with every new feature added to `pygw`. --- .github/workflows/pytests.yaml | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/pytests.yaml diff --git a/.github/workflows/pytests.yaml b/.github/workflows/pytests.yaml new file mode 100644 index 0000000000..0c3c0ccb59 --- /dev/null +++ b/.github/workflows/pytests.yaml @@ -0,0 +1,35 @@ +name: Run pytests +on: [push, pull_request] + +jobs: + run_pytests: + runs-on: ubuntu-latest + name: Install pygw and run tests with pytests + strategy: + matrix: + python: ["3.7", "3.8", "3.9", "3.10"] + + steps: + - name: Setup Python + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python }} + + - name: Install (upgrade) dependencies + run: | + pip install --upgrade pip + + - name: Checkout + uses: actions/checkout@v2 + with: + path: global-workflow + + - name: Install pygw + run: | + cd $GITHUB_WORKSPACE/global-workflow/ush/python/pygw + pip install .[dev] + + - name: Run pytests + run: | + cd $GITHUB_WORKSPACE/global-workflow/ush/python/pygw + pytest -v src/tests