Convert pytorchbearer/torchbearer to GitHub Actions (#671) #17
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: pytorchbearer/torchbearer | |
on: | |
push: | |
branches: | |
- "**/*" | |
pull_request: | |
concurrency: | |
# # This item has no matching transformer | |
# maximum_number_of_builds: 0 | |
group: "${{ github.ref }}" | |
cancel-in-progress: true | |
jobs: | |
test_15: | |
runs-on: ubuntu-latest | |
env: | |
TORCH_URL: torch==1.4.0+cpu -f https://download.pytorch.org/whl/torch_stable.html | |
TORCHVISION: torchvision==0.5.0+cpu -f https://download.pytorch.org/whl/torch_stable.html | |
TORCH_VERSION: 1.4.0 | |
PILLOW: pillow | |
steps: | |
- name: checkout | |
uses: actions/[email protected] | |
- name: Set up pip cache | |
uses: actions/[email protected] | |
with: | |
path: "~/.cache/pip" | |
key: "${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}" | |
restore-keys: "${{ runner.os }}-pip-" | |
- uses: actions/[email protected] | |
with: | |
python-version: '3.7.17' | |
- run: echo ${{ github.sha }}_RANGE | |
- run: 'if [ -z "${{ github.sha }}_RANGE"]; then COMMIT_RANGE="HEAD~..HEAD"; else COMMIT_RANGE=${{ github.sha }}_RANGE; fi; | |
' | |
- run: echo $COMMIT_RANGE | |
- run: | | |
if ! git diff --name-only $COMMIT_RANGE | grep -qE '^(torchbearer/|tests/|.travis.yml)' | |
then | |
echo "Only docs were updated, not running the CI." | |
exit | |
fi | |
- run: pip install -q coverage | |
- run: pip install -q nose | |
- run: pip install -q $TORCH_URL | |
- run: pip install future | |
- run: pip install $PILLOW | |
- run: pip install -q $TORCHVISION | |
- run: pip install -q -r requirements.txt | |
- run: nosetests tests -v --with-coverage --cover-package=torchbearer | |
- run: bash <(curl -s https://codecov.io/bash) | |
if: "${{ success() }}" | |
# # This item has no matching transformer | |
# - email: | |
# on_success: never | |
# on_failure: always |