Hey! I just upgraded my assignment template’s yml file with a little snippet that:
- Prevents the runner from executing when the student accepts their assignment (or the template is cloned or forked or anything similar, and
- Will only execute when the student pushes their solution file to the repo, or I edit the test script.
It can really improve usage time for those of you approaching limits! That workflow won’t fire when you update some markdown file or whatever.
Here’s the yml file. I hope it helps someone.
name: Build and Test on: push: # Perform this workflow only when there is a push to the student solution file or the pytest testing script # Force the runner to skip this workflow when the repo is first created (cloned, forked, whatevs) # https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions paths: - 'tests/test_exercise.py' # testing script - 'src/exercise.py' # student solution file jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 # Tell the runner to use the newest release of Python 3 available by using 'Python 3.x' syntax below # https://docs.github.com/en/actions/guides/building-and-testing-python - name: Set up Python 3.x uses: actions/setup-python@v2 with: python-version: '3.x' - name: Install dependencies run: | python -m pip install --upgrade pip pip install pytest flake8 - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest run: | python -m pytest
Here’s the different testing scripts I’ll use for different programming assignments.
Which, like I said, only fire when the students push their python programs or I manipulate the testing script. So I can go about my business of uploading pretty pictures of unicorns and embedding them on my markdown files without worrying about affecting my GitHub usage limits