CIS 6930 Spring 24

Logo

This is the web page for Data Engineering at the University of Florida.

View the Project on GitHub ufdatastudio/cis6930fa24

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.

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

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

To check the project of your tests you can add the contents below to your repository.

# .github/workflows/pytest.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.12.5"

      - 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