Autograding and Actions

Hello everyone! First time posting.

I have been using github classroom for my AP Computer Science Principles class and I have been using some very basic input/output tests using the autograder and the github actions. I have just received a notification that I have use almost all of my allowed github actions minutes. I know that there are options for education but all of it seems to be geared toward colleges and not high schools. Any advice there?

On another note, I noticed that everytime my students accept an assignment it runs the autograder on the files in the repository template as they are commited to the new repository for that assignment… this uses 1 - 1.5 minutes per student per assignment. Any advice as to how to only make it run when students commit their own assignment and not when the assignment repository is created?

thanks!

1 Like

Autograding is basically just glorified Github Actions, so you can set up Actions yourself. This is particularly useful not only for the tests (it’s less tedious generally to set up the tests in the file than in the UI, and you have more fine-tuned control over the whole process), but also for when the actions run. You’ll want to look at the Github Actions docs, but there’s an on block that you can use to tell it to run only on a given branch and only with certain actions. That should allow you to pare down when it runs, but may take a little fiddling to get just the way you want.

Hey!

So I have manually configured my yml file to do what @ShaunaGordon above was talking about:

  1. Not run any tests on initial clone, fork, assignment setup, whatever.
  2. Only run tests on pushes to two files:
    • My student solution file
    • My testing script

Here’s my .github/workflows/workflow.yml file. It’s battle tested, mom approved.

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 programs or I manipulate the testing script. So I can go about my business of uploading pretty pictures of unicorns :unicorn: and embedding them on my markdown files without worrying about affecting my GitHub usage limits

1 Like
© 2017 GitHub, Inc.
with by
GitHub Education