Skip to content
Snippets Groups Projects
Unverified Commit 70f2def4 authored by Jirka Borovec's avatar Jirka Borovec Committed by GitHub
Browse files

adding minimal CI (#15)

* adding CI

* badge

* tests
parent f0baf60b
No related branches found
No related tags found
No related merge requests found
name: CI testing
# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows
on:
# Trigger the workflow on push or pull request, but only for the master branch
push:
branches:
- master
pull_request:
branches:
- master
jobs:
pytest:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macOS-10.15, windows-2019]
python-version: [3.7]
# Timeout: https://stackoverflow.com/a/59076067/4521646
timeout-minutes: 35
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
# Github Actions: Run step on specific OS: https://stackoverflow.com/a/57948488/4521646
- name: Setup macOS
if: runner.os == 'macOS'
run: |
brew install libomp # https://github.com/pytorch/pytorch/issues/20030
# Note: This uses an internal pip API and may not always work
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
- name: Get pip cache
id: pip-cache
run: |
python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)"
- name: Cache pip
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-py${{ matrix.python-version }}-
- name: Install dependencies
run: |
pip install --requirement requirements.txt --upgrade --quiet --find-links https://download.pytorch.org/whl/cpu/torch_stable.html --use-feature=2020-resolver
pip install --requirement tests/requirements.txt --quiet --use-feature=2020-resolver
python --version
pip --version
pip list
shell: bash
- name: Tests
run: |
coverage run --source project -m py.test project tests -v --junitxml=junit/test-results-${{ runner.os }}-${{ matrix.python-version }}.xml
- name: Statistics
if: success()
run: |
coverage report
......@@ -26,6 +26,7 @@ The goal of this seed is to structure ML paper-code the same so that work can ea
ARXIV
[![Paper](http://img.shields.io/badge/arxiv-math.co:1480.1111-B31B1B.svg)](https://www.nature.com/articles/nature14539)
-->
![CI testing](https://github.com/PyTorchLightning/deep-learning-project-template/workflows/CI%20testing/badge.svg?branch=master&event=push)
<!--
......
[tool:pytest]
norecursedirs =
.git
dist
build
addopts =
--strict
--doctest-modules
--durations=0
[coverage:report]
exclude_lines =
pragma: no-cover
pass
[flake8]
max-line-length = 120
exclude = .tox,*.egg,build,temp
select = E,W,F
doctests = True
verbose = 2
# https://pep8.readthedocs.io/en/latest/intro.html#error-codes
format = pylint
# see: https://www.flake8rules.com/
ignore =
E731 # Do not assign a lambda expression, use a def
W504 # Line break occurred after a binary operator
F401 # Module imported but unused
F841 # Local variable name is assigned to but never used
W605 # Invalid escape sequence 'x'
# setup.cfg or tox.ini
[check-manifest]
ignore =
*.yml
.github
.github/*
[metadata]
license_file = LICENSE
description-file = README.md
# long_description = file:README.md
# long_description_content_type = text/markdown
......@@ -13,3 +13,4 @@ setup(
install_requires=['pytorch-lightning'],
packages=find_packages(),
)
coverage
codecov>=2.1
pytest>=3.0.5
pytest-cov
pytest-flake8
flake8
check-manifest
twine==1.13.0
\ No newline at end of file
from project.datasets.mnist import mnist
from project.lit_classifier_main import LitClassifier
from pytorch_lightning import Trainer, seed_everything
from project.lit_classifier_main import LitClassifier
def test_lit_classifier():
seed_everything(1234)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment