Merge pull request #37 from COMP1511UNSW/dylanb/fix-generate_expected… #130
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: auto-pytest | |
on: [push, pull_request] | |
jobs: | |
# job skipper in the case of concurrent push + pull_request trigger | |
pre_job: | |
runs-on: ubuntu-latest | |
outputs: | |
should_skip: ${{steps.skip_check.outputs.should_skip}} | |
steps: | |
- id: skip_check | |
uses: fkirc/skip-duplicate-actions@master | |
with: | |
concurrent_skipping: 'same_content' | |
do_not_skip: '["push"]' | |
# actual auto pytest | |
main_job: | |
name: pytest | |
needs: pre_job | |
if: ${{needs.pre_job.outputs.should_skip != 'true'}} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
if: github.event_name == 'pull_request' | |
with: | |
fetch-depth: 0 | |
ref: ${{github.event.pull_request.head.ref}} | |
- uses: actions/checkout@v2 | |
if: github.event_name == 'push' | |
with: | |
fetch-depth: 0 | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
architecture: x64 | |
- name: Install pipenv | |
run: | | |
python -m pip install --upgrade pipenv wheel | |
- id: cache-pipenv | |
uses: actions/cache@v2 | |
with: | |
path: ~/.local/share/virtualenvs | |
key: ${{runner.os}}-pipenv-${{hashFiles('**/Pipfile.lock')}} | |
- name: Install dependencies | |
if: steps.cache-pipenv.outputs.cache-hit != 'true' | |
run: | | |
pipenv install --deploy --dev | |
- name: Run test suite | |
run: | | |
pipenv run test -v |