Skip to content

Pytorch net

Pytorch net #83

Workflow file for this run

name: ci
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10']
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# Cache Poetry dependencies
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Install poetry
run: |
curl -sSL https://install.python-poetry.org | python -
- name: Configure poetry
run: |
poetry config virtualenvs.create false
- name: Install dependencies
run: |
poetry run pip install torch --extra-index-url https://download.pytorch.org/whl/cpu
poetry install
- name: Run Tests with Coverage
run: |
poetry run coverage run -m pytest
env:
COVERAGE_FILE: ".coverage.${{ matrix.python-version }}"
- name: Store coverage file
uses: actions/upload-artifact@v3
with:
name: coverage
path: .coverage.${{ matrix.python-version }}
# Coverage job to comment on PRs and update README badge
coverage:
runs-on: ubuntu-latest
needs: tests
permissions:
pull-requests: write
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Download coverage artifact
uses: actions/download-artifact@v3
with:
name: 'coverage'
# Comment coverage details on PR
- name: Coverage comment
id: coverage_comment
uses: py-cov-action/python-coverage-comment-action@v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MERGE_COVERAGE_FILES: true
# Store comment to be posted if written
- name: Store Pull Request comment to be posted
uses: actions/upload-artifact@v3
if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
with:
name: python-coverage-comment-action
path: python-coverage-comment-action.txt