CS 5293 Spring 21

Logo

This is the web page for Text Analytics at the University of Oklahoma.

View the Project on GitHub oudalab/cs5293sp22

Github Actions PyTest

I added an example file GitHub Actions script that you can add to your repository. This script will run your PyTest test cases every time you push your code to the repository. This is an example of continuous integration.

https://github.com/cegme/cs5293sp22/blob/main/.github/workflows/pytest.yml

You just need to create a new directory and pytest.yml file.

mkdir -p .github/workflows
touch .github/workflows/pytest.yml

Then you can add the same contents as the example file above

To check the project of your tests you can add 

# .github/workflows/app.yaml
name: PyTest
on: push

jobs:
  test:
    runs-on: ubuntu-latest
    timeout-minutes: 10

    steps:
      - name: Check out repository code
        uses: actions/checkout@v2

      # Setup Python (faster than using Python container)
      - name: Setup Python
        uses: actions/setup-python@v2
        with:
          python-version: "3.10.2"

      - name: Install pipenv
        run: |
          python -m pip install --upgrade pipenv wheel
      - id: cache-pipenv
        uses: actions/cache@v1
        with:
          path: ~/.local/share/virtualenvs
          key: $-pipenv-$

      - name: Install dependencies
        if: steps.cache-pipenv.outputs.cache-hit != 'true'
        run: |
          pipenv install --deploy --dev
      - name: Run test suite
        run: |
          pipenv run python -m pytest -v .

To view the progress of a test click on the GitHub action button at the repository page.

Github Acton

Hat tip to @dennisokeeffe92 for the template.


Back