From 93452c1f0087e29fadf8853eef6b1e5d61e0fccc Mon Sep 17 00:00:00 2001 From: Ev Lacey Date: Mon, 1 Nov 2021 10:11:41 -0700 Subject: [PATCH 1/6] Remove Azure pipeline, add Github Pipeline + Codecov Signed-off-by: Ev Lacey --- .azure/azure-build-pipeline.yml | 49 --------------------------------- .github/codecov.yml | 31 +++++++++++++++++++++ .github/workflows/pr.yml | 39 ++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 49 deletions(-) delete mode 100644 .azure/azure-build-pipeline.yml create mode 100644 .github/codecov.yml create mode 100644 .github/workflows/pr.yml diff --git a/.azure/azure-build-pipeline.yml b/.azure/azure-build-pipeline.yml deleted file mode 100644 index 770f948b..00000000 --- a/.azure/azure-build-pipeline.yml +++ /dev/null @@ -1,49 +0,0 @@ -trigger: -- main - -pr: -- main - -stages: - - stage: 'Test' - jobs: - - job: RunTests - pool: - vmImage: ubuntu-20.04 - strategy: - matrix: - Python3.6: - python.version: '3.6' - maxParallel: 3 - steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: $(python.version) - displayName: 'Setup Python' - - script: | - pip install virtualenv - virtualenv .venv - displayName: 'Create Venv' - - script: | - source .venv/bin/activate - ./run setup - displayName: 'Setup development environment' - - script: | - source .venv/bin/activate - ./run check -f - displayName: 'Check formatting' - - script: | - source .venv/bin/activate - ./run test all unit - displayName: 'Run Unit tests' - - script: | - # Refer to https://about.codecov.io/blog/introducing-codecovs-new-uploader/ - curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --import # One-time step - curl -Os https://uploader.codecov.io/latest/linux/codecov - curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM - curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig - gpg --verify codecov.SHA256SUM.sig codecov.SHA256SUM - shasum -a 256 -c codecov.SHA256SUM - chmod +x codecov - ./codecov -f monai-deploy-app-sdk-coverage.xml -t $(CODECOV_TOKEN) - displayName: 'Upload code coverage' diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 00000000..ffe40ce3 --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,31 @@ +coverage: + status: + project: + default: + target: 70% + threshold: 10 + base: parent + if_no_uploads: error + if_not_found: success + if_ci_failed: error + only_pulls: false + flags: null + paths: null + patch: + default: + target: auto + # Allows PRs without tests, overall stats count + threshold: 100 + base: auto + if_no_uploads: error + if_not_found: success + if_ci_failed: error + only_pulls: false + flags: null + paths: null + +# Disable comments on PR +comment: false + +ignore: + - "/monai/deploy/_version.py" diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 00000000..6f37729e --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,39 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: build + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.6 + uses: actions/setup-python@v2 + with: + python-version: 3.6 + - name: Setup Dev Environment + run: | + export VIRTUAL_ENV=true # Spoof running in virtual environment in CI + export CONDA_PREFIX=true # Spoof running in CONDA in CI + ./run setup + - name: Check formatting + run: | + ./run check -f + - name: Run Unit tests + run: | + ./run test all unit + - name: Coverage + run: | + coverage xml + - name: Upload coverage + uses: codecov/codecov-action@v1 + with: + fail_ci_if_error: false + file: ./coverage.xml \ No newline at end of file From bff0e2805e3f062dd6b1d949b4c634bbc0aaf898 Mon Sep 17 00:00:00 2001 From: Ev Lacey Date: Mon, 1 Nov 2021 10:31:34 -0700 Subject: [PATCH 2/6] Use virtualenv Signed-off-by: Ev Lacey --- .github/workflows/pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 6f37729e..efeb369e 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -20,8 +20,8 @@ jobs: python-version: 3.6 - name: Setup Dev Environment run: | - export VIRTUAL_ENV=true # Spoof running in virtual environment in CI - export CONDA_PREFIX=true # Spoof running in CONDA in CI + pip install virtualenv + virtualenv .venv ./run setup - name: Check formatting run: | From 4d4f9261c41e0f697a94a1197bd6aa0e793dbbfc Mon Sep 17 00:00:00 2001 From: Ev Lacey Date: Mon, 1 Nov 2021 12:31:03 -0700 Subject: [PATCH 3/6] Source venv Signed-off-by: Ev Lacey --- .github/workflows/pr.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index efeb369e..95f81cfa 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -22,12 +22,15 @@ jobs: run: | pip install virtualenv virtualenv .venv + source .venv/bin/activate ./run setup - name: Check formatting run: | + source .venv/bin/activate ./run check -f - name: Run Unit tests run: | + source .venv/bin/activate ./run test all unit - name: Coverage run: | From e67a2b1d165f8cd5e9b82a176e4bfeaade7417a1 Mon Sep 17 00:00:00 2001 From: Ev Lacey Date: Mon, 1 Nov 2021 12:40:09 -0700 Subject: [PATCH 4/6] Add coverage to requirements-dev.txt Signed-off-by: Ev Lacey --- requirements-dev.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements-dev.txt b/requirements-dev.txt index f1de2eea..42cd8109 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -11,6 +11,7 @@ pycodestyle pyflakes black isort +coverage pytype>=2020.6.1; platform_system != "Windows" types-pkg_resources mypy>=0.790 From 77d690d9443457a9b43e176405333357cf1f8b27 Mon Sep 17 00:00:00 2001 From: Ev Lacey Date: Mon, 1 Nov 2021 12:42:43 -0700 Subject: [PATCH 5/6] Remove coverage from requirements-dev.txt; source venv for coverage Signed-off-by: Ev Lacey --- .github/workflows/pr.yml | 1 + requirements-dev.txt | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 95f81cfa..a0943ab1 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -34,6 +34,7 @@ jobs: ./run test all unit - name: Coverage run: | + source .venv/bin/activate coverage xml - name: Upload coverage uses: codecov/codecov-action@v1 diff --git a/requirements-dev.txt b/requirements-dev.txt index 42cd8109..f1de2eea 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -11,7 +11,6 @@ pycodestyle pyflakes black isort -coverage pytype>=2020.6.1; platform_system != "Windows" types-pkg_resources mypy>=0.790 From 3badbc9925ddad90fc744118830397ad1d942ff5 Mon Sep 17 00:00:00 2001 From: Ev Lacey Date: Mon, 1 Nov 2021 13:54:29 -0700 Subject: [PATCH 6/6] Update codecov to v2 Signed-off-by: Ev Lacey --- .github/workflows/pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index a0943ab1..1d29510d 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -37,7 +37,7 @@ jobs: source .venv/bin/activate coverage xml - name: Upload coverage - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v2 with: fail_ci_if_error: false - file: ./coverage.xml \ No newline at end of file + files: ./coverage.xml