Skip to content

add tests

add tests #4455

Workflow file for this run

'on':
push: null
pull_request: null
workflow_dispatch: null
jobs:
format-checker:
runs-on: ubuntu-latest
env:
# When there is no base commit (e.g., first push to a new branch),
# GitHub assigns a string of zeros to event.before. It's necessary to
# handle this separately
NULL_COMMIT: '0000000000000000000000000000000000000000'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Python 3
uses: actions/setup-python@v4
with:
python-version: 3.10.6
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r format_checker/requirements.txt
# Only run this step if the event is a push and event.before shows
# that it's the first push to a new branch
- if: >-
${{github.event_name == 'push' && github.event.before ==
env.NULL_COMMIT}}
name: Run format checker on new branch
run: >
python format_checker/main.py ${{github.event.before}}
${{github.event.commits[0].id}} ${{github.event.after}}
# Only run this step if the event is a pull request
- if: ${{github.event_name == 'pull_request'}}
name: Run format checker on pull request
run: >
python format_checker/main.py ${{github.event.pull_request.base.sha}}
${{github.event.pull_request.head.sha}}
# Only run this step if the event is a push and it's not the first one
# to a new branch
- if: >-
${{github.event_name == 'push' && github.event.before !=
env.NULL_COMMIT}}
name: Run format checker on push
run: >
python format_checker/main.py ${{github.event.before}}
${{github.event.after}}