Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Move basic PR checks like Flake8, Mypy and HelloWorld to Github actio…
Browse files Browse the repository at this point in the history
…ns (#426)

At present, external contributors don't have any insight into why the PR builds fail because they run on ADO. This PR moves some of the basic checks to Github Actions, where they are fully visible: Flake8, mypy, and training the HelloWorld model.
  • Loading branch information
ant0nsc committed Mar 29, 2021
1 parent 426854a commit 821cb3b
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 27 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/linting_and_hello_world.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Flake8, MyPy, and Hello World

# This workflow runs linting via Flake8 and Mypy.
# It also checks that the HelloWorld model can be trained.

on:
pull_request:

jobs:
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
lfs: true

- name: flake8
run: |
pip install flake8
python -m flake8
shell: bash
if: always()

# This script also does "conda init" for all shells. For bash, this modifies .bashrc.
# However, the default "bash" in a github workflow does not execute bashrc. Hence, all
# scripts that use this environment need to either hardcode the path to Python, or use
# a customized shell that executes bashrc, like "shell: bash -eo pipefail {0}"
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: InnerEye
auto-activate-base: false
environment-file: environment.yml
python-version: 3.7
if: always()

- name: mypy
run: |
$CONDA/envs/InnerEye/bin/python mypy_runner.py --mypy=$CONDA/envs/InnerEye/bin/mypy
if: always()

- name: Run HelloWorld model
run: |
$CONDA/envs/InnerEye/bin/python ./InnerEye/ML/runner.py --model=HelloWorld
env:
PYTHONPATH: ${{ github.workspace }}
if: always()

windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
lfs: true

- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: InnerEye
auto-activate-base: false
environment-file: environment.yml
python-version: 3.7
if: always()

- name: Run HelloWorld model
run: |
conda info
%CONDA%\envs\InnerEye\bin\python ./InnerEye/ML/runner.py --model=HelloWorld
env:
PYTHONPATH: ${{ github.workspace }}
shell: cmd
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ nodes in AzureML. Example: Add `--num_nodes=2` to the commandline arguments to t
`dataset.csv` supports multiple labels (indices corresponding to `class_names`) per subject in the label column.
Multiple labels should be encoded as a string with labels separated by a `|`, for example "0|2|4".
Note that this PR does not add support for multiclass models, where the labels are mutually exclusive.
- ([#425](https://github.com/microsoft/InnerEye-DeepLearning/pull/425)) The number of layers in a Unet is no longer fixed at 4, but can be set via the config field `num_downsampling_paths`. A lower number of layers may be useful for decreasing memory requirements, or for working with smaller images. (The minimum image size in any dimension when using a network of n layers is 2**n.)
- ([#425](https://github.com/microsoft/InnerEye-DeepLearning/pull/425)) The number of layers in a Unet is no longer
fixed at 4, but can be set via the config field `num_downsampling_paths`. A lower number of layers may be useful
for decreasing memory requirements, or for working with smaller images.
(The minimum image size in any dimension when using a network of n layers is 2**n.)
- ([#426](https://github.com/microsoft/InnerEye-DeepLearning/pull/426)) Flake8, mypy, and testing the HelloWorld model
is now happening in a Github action, no longer in Azure Pipelines.

### Changed
- ([#385](https://github.com/microsoft/InnerEye-DeepLearning/pull/385)) Starting an AzureML run now uses the
Expand Down
4 changes: 3 additions & 1 deletion InnerEye/ML/reports/notebook_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ def generate_notebook(template_notebook: Path, notebook_params: Dict, result_not
papermill.execute_notebook(input_path=str(template_notebook),
output_path=str(result_notebook),
parameters=notebook_params,
progress_bar=False)
progress_bar=False,
# Unit tests often fail with cell timeouts when default of 4 is used.
iopub_timeout=10)
return convert_to_html(result_notebook)


Expand Down
25 changes: 0 additions & 25 deletions azure-pipelines/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,6 @@ steps:
condition: succeeded()
displayName: Create conda environment
- bash: |
source activate InnerEye
flake8
failOnStderr: true
condition: succeededOrFailed()
displayName: flake8
- bash: |
source activate InnerEye
python mypy_runner.py
failOnStderr: true
condition: succeededOrFailed()
displayName: mypy
# Build the HelloWorld model, without providing the secrets for the ServicePrincipal, to mimic running HelloWorld
# right after checking out. This must happen before we provide any additional information in settings.yml
- bash: |
source activate InnerEye
python ./InnerEye/ML/runner.py --model=HelloWorld
env:
PYTHONPATH: $(Build.SourcesDirectory)/
failOnStderr: false
condition: succeededOrFailed()
displayName: Run HelloWorld model
# Pytest needs subscription information directly in settings.yml. Local package install will cause use of
# the wrong default project root, hence InnerEyePrivateSettings.yml can't be picked up.
- bash: |
Expand Down

0 comments on commit 821cb3b

Please sign in to comment.