From e59f7a9f4a19c4d07fdf4502cac596712336e695 Mon Sep 17 00:00:00 2001 From: eddiebergman Date: Wed, 15 Dec 2021 21:11:03 +0100 Subject: [PATCH 1/7] update workflow files --- .github/workflows/dist.yml | 32 +++++++- .github/workflows/docs.yml | 28 ++++++- .github/workflows/long_regression_test.yml | 9 +- .github/workflows/pre-commit.yaml | 25 +++++- .github/workflows/pytest.yml | 96 +++++++++++++++++++--- .github/workflows/release.yml | 4 +- .github/workflows/scheduled_test.yml | 34 -------- 7 files changed, 171 insertions(+), 57 deletions(-) delete mode 100644 .github/workflows/scheduled_test.yml diff --git a/.github/workflows/dist.yml b/.github/workflows/dist.yml index 5dfdcb9be..75de5a86b 100644 --- a/.github/workflows/dist.yml +++ b/.github/workflows/dist.yml @@ -1,31 +1,57 @@ name: dist-check -on: [push, pull_request] +on: + # Manually triggerable in github + workflow_dispatch: + + # When a push occurs on either of these branches + push: + branches: + - master + - development + + # When a push occurs on a PR that targets these branches + pull_request: + branches: + - master + - development + + schedule: + # Every day at 7AM UTC + - cron: '0 07 * * *' jobs: + dist: runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v2 + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python uses: actions/setup-python@v2 with: python-version: 3.8 + - name: Build dist run: | python setup.py sdist + - name: Twine check run: | pip install twine last_dist=$(ls -t dist/autoPyTorch-*.tar.gz | head -n 1) twine_output=`twine check "$last_dist"` if [[ "$twine_output" != "Checking $last_dist: PASSED" ]]; then echo $twine_output && exit 1;fi + - name: Install dist run: | last_dist=$(ls -t dist/autoPyTorch-*.tar.gz | head -n 1) pip install $last_dist + - name: PEP 561 Compliance run: | pip install mypy cd .. # required to use the installed version of autosklearn - if ! python -c "import autoPyTorch"; then exit 1; fi \ No newline at end of file + if ! python -c "import autoPyTorch"; then exit 1; fi diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index f4c1fe618..b612405ff 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,28 +1,51 @@ name: Docs -on: [pull_request, push] + +on: + # Allow to manually trigger through github API + # Wont trigger the push to github pages where the documentation is located + workflow_dispatch: + + # Triggers with push to these branches + push: + branches: + - master + - development + + # Triggers with push to a pr aimed at these branches + pull_request: + branches: + - master + - development jobs: build-and-deploy: runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v2 + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python uses: actions/setup-python@v2 with: python-version: 3.8 + - name: Install dependencies run: | git submodule update --init --recursive pip install -e .[docs,examples] + - name: Make docs run: | cd docs make html + - name: Pull latest gh-pages if: (contains(github.ref, 'develop') || contains(github.ref, 'master')) && github.event_name == 'push' run: | cd .. git clone https://github.com/automl/Auto-PyTorch.git --branch gh-pages --single-branch gh-pages + - name: Copy new doc into gh-pages if: (contains(github.ref, 'develop') || contains(github.ref, 'master')) && github.event_name == 'push' run: | @@ -30,6 +53,7 @@ jobs: cd ../gh-pages rm -rf $branch_name cp -r ../Auto-PyTorch/docs/build/html $branch_name + - name: Push to gh-pages if: (contains(github.ref, 'develop') || contains(github.ref, 'master')) && github.event_name == 'push' run: | diff --git a/.github/workflows/long_regression_test.yml b/.github/workflows/long_regression_test.yml index 135c45fb0..010b97809 100644 --- a/.github/workflows/long_regression_test.yml +++ b/.github/workflows/long_regression_test.yml @@ -7,29 +7,32 @@ on: #- cron: '0 07 * * 2' - cron: '0 07 * * *' - jobs: - ubuntu: + ubuntu: runs-on: ubuntu-latest + strategy: + fail-fast: false matrix: python-version: [3.8] - fail-fast: false steps: - uses: actions/checkout@v2 with: ref: development + - name: Setup Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} + - name: Install test dependencies run: | git submodule update --init --recursive python -m pip install --upgrade pip pip install -e .[test] + - name: Run tests run: | python -m pytest --durations=200 cicd/test_preselected_configs.py -vs diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml index 8f5b4bca8..d9fd438c5 100644 --- a/.github/workflows/pre-commit.yaml +++ b/.github/workflows/pre-commit.yaml @@ -1,23 +1,44 @@ name: pre-commit -on: [push, pull_request] +on: + # Allow to manually trigger through github API + workflow_dispatch: + + # Triggers with push to these branches + push: + branches: + - master + - development + + # Triggers with push to a pr aimed at these branches + pull_request: + branches: + - master + - development jobs: + run-all-files: runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v2 + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python 3.7 uses: actions/setup-python@v2 with: python-version: 3.7 + - name: Init Submodules run: | git submodule update --init --recursive + - name: Install pre-commit run: | pip install pre-commit pre-commit install + - name: Run pre-commit run: | pre-commit run --all-files diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index c1d561655..845bd9cc3 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -1,41 +1,114 @@ name: Tests -on: [push, pull_request] +on: + # Allow to manually trigger through github API + workflow_dispatch: + + # Triggers with push to these branches + push: + branches: + - master + - development + + # Triggers with push to pr targeting these branches + pull_request: + branches: + - master + - development + + schedule: + # Every day at 7AM UTC + - cron: '0 07 * * *' + +env: + + # Arguments used for pytest + pytest-args: >- + --forked + --durations=20 + --timeout=600 + --timeout-method=signal + -v + + # Arguments used for code-cov which is later used to annotate PR's on github + code-cov-args: >- + --cov=autoPyTorch + --cov-report=xml + --cov-config=.coveragerc jobs: - ubuntu: + tests: + + name: ${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.kind }} + runs-on: ${{ matrix.os }} - runs-on: ubuntu-latest strategy: + fail-fast: false matrix: - python-version: [3.7, 3.8, 3.9] + os: [windows-latest, macos-latest, ubuntu-latest] + python-version: ['3.7', '3.8', '3.9', '3.10'] + kind: ['source', 'dist'] + + exclude: + # Exclude all configurations *-*-dist, include one later + - kind: 'dist' + + # Exclude windows as bash commands wont work in windows runner + - os: windows-latest + + # Exclude macos as there are permission errors using conda as we do + - os: macos-latest + include: - - python-version: 3.8 + # Add the tag code-cov to ubuntu-3.7-source + - os: ubuntu-latest + python-version: 3.7 + kind: 'source' code-cov: true - fail-fast: false - max-parallel: 2 + + # Include one config with dist, ubuntu-3.7-dist + - os: ubuntu-latest + python-version: 3.7 + kind: 'dist' steps: - - uses: actions/checkout@v2 + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - - name: Install test dependencies + + - name: Source install + if: matrix.kind == "source" run: | git submodule update --init --recursive python -m pip install --upgrade pip pip install -e .[test] + + - name: Dist install + if: matrix.kind == "dist" + run: | + git submodule update --init --recursive + + python setup.py sdist + last_dist=$(ls -t dist/autoPyTorch-*.tar.gz | head -n 1) + pip install $last_dist[test] + - name: Store repository status id: status-before run: | echo "::set-output name=BEFORE::$(git status --porcelain -b)" + - name: Run tests run: | if [ ${{ matrix.code-cov }} ]; then - codecov='--cov=autoPyTorch --cov-report=xml --cov-config=.coveragerc'; + python -m pytest ${{ env.pytest-args }} ${{ env.code-cov-args }} test + else + python -m pytest ${{ env.pytest-args }} test fi - python -m pytest --forked --durations=20 --timeout=600 --timeout-method=signal -v $codecov test + - name: Check for files left behind by test if: ${{ always() }} run: | @@ -47,6 +120,7 @@ jobs: echo "Not all generated files have been deleted!" exit 1 fi + - name: Upload coverage if: matrix.code-cov && always() uses: codecov/codecov-action@v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 69cd8de26..46c9e94c3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,7 @@ on: - master jobs: - test: + publish: runs-on: "ubuntu-latest" steps: @@ -30,4 +30,4 @@ jobs: uses: pypa/gh-action-pypi-publish@master with: user: __token__ - password: ${{ secrets.pypi_token }} \ No newline at end of file + password: ${{ secrets.pypi_token }} diff --git a/.github/workflows/scheduled_test.yml b/.github/workflows/scheduled_test.yml deleted file mode 100644 index 68f37d72d..000000000 --- a/.github/workflows/scheduled_test.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Tests - -on: - schedule: - # Every Monday at 7AM UTC - - cron: '0 07 * * 1' - - -jobs: - ubuntu: - - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.8] - fail-fast: false - max-parallel: 2 - - steps: - - uses: actions/checkout@v2 - with: - ref: development - - name: Setup Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install test dependencies - run: | - git submodule update --init --recursive - python -m pip install --upgrade pip - pip install -e .[test] - - name: Run tests - run: | - python -m pytest --forked --durations=20 --timeout=600 --timeout-method=signal -v test \ No newline at end of file From 88b5c0966060a391036a3b82b1ed827e7771f4c6 Mon Sep 17 00:00:00 2001 From: eddiebergman Date: Wed, 15 Dec 2021 21:21:26 +0100 Subject: [PATCH 2/7] Remove double quotes --- .github/workflows/pytest.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 845bd9cc3..1b3f91983 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -81,14 +81,14 @@ jobs: python-version: ${{ matrix.python-version }} - name: Source install - if: matrix.kind == "source" + if: matrix.kind == 'source' run: | git submodule update --init --recursive python -m pip install --upgrade pip pip install -e .[test] - name: Dist install - if: matrix.kind == "dist" + if: matrix.kind == 'dist' run: | git submodule update --init --recursive From 27074813dc0d76e5d7b179f904d94f6a4a1daacd Mon Sep 17 00:00:00 2001 From: eddiebergman Date: Wed, 15 Dec 2021 21:30:34 +0100 Subject: [PATCH 3/7] Exclude python 3.10 --- .github/workflows/pytest.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 1b3f91983..e9be709d3 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -59,6 +59,9 @@ jobs: # Exclude macos as there are permission errors using conda as we do - os: macos-latest + # Exclude python 3.10 as torch is not support python 3.10 yet + - python-version: '3.10' + include: # Add the tag code-cov to ubuntu-3.7-source - os: ubuntu-latest From 0e41e34050e25f7e6dd7659387a3e9cd40a14d98 Mon Sep 17 00:00:00 2001 From: eddiebergman Date: Thu, 16 Dec 2021 13:35:14 +0100 Subject: [PATCH 4/7] Fix mypy compliance check --- .github/workflows/dist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dist.yml b/.github/workflows/dist.yml index 75de5a86b..46d8085b4 100644 --- a/.github/workflows/dist.yml +++ b/.github/workflows/dist.yml @@ -54,4 +54,4 @@ jobs: run: | pip install mypy cd .. # required to use the installed version of autosklearn - if ! python -c "import autoPyTorch"; then exit 1; fi + if ! mypy -c "import autoPyTorch"; then exit 1; fi From 913d2f89d646af50dbca84455ecdee99dab8ac7d Mon Sep 17 00:00:00 2001 From: eddiebergman Date: Thu, 16 Dec 2021 15:10:35 +0100 Subject: [PATCH 5/7] Added PEP 561 compliance --- .github/workflows/dist.yml | 4 ++++ autoPyTorch/py.typed | 1 + setup.py | 1 + 3 files changed, 6 insertions(+) create mode 100644 autoPyTorch/py.typed diff --git a/.github/workflows/dist.yml b/.github/workflows/dist.yml index 46d8085b4..608d3cbe7 100644 --- a/.github/workflows/dist.yml +++ b/.github/workflows/dist.yml @@ -53,5 +53,9 @@ jobs: - name: PEP 561 Compliance run: | pip install mypy + cd .. # required to use the installed version of autosklearn + + # Note this doesn't perform mypy checks, those are handled in pre-commit.yaml + # This only checks if autoPyTorch exports type information if ! mypy -c "import autoPyTorch"; then exit 1; fi diff --git a/autoPyTorch/py.typed b/autoPyTorch/py.typed new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/autoPyTorch/py.typed @@ -0,0 +1 @@ + diff --git a/setup.py b/setup.py index eed11b76f..43243506f 100755 --- a/setup.py +++ b/setup.py @@ -32,6 +32,7 @@ keywords="machine learning algorithm configuration hyperparameter" "optimization tuning neural architecture deep learning", packages=setuptools.find_packages(), + package_data={"autoPyTorch": ['py.typed']}, classifiers=[ "Development Status :: 3 - Alpha", "Topic :: Utilities", From 325bc65b3b80c38e378e7484a5aa6e9972c0bab4 Mon Sep 17 00:00:00 2001 From: eddiebergman Date: Thu, 16 Dec 2021 15:22:10 +0100 Subject: [PATCH 6/7] Add py.typed to MANIFEST for dist --- MANIFEST.in | 1 + 1 file changed, 1 insertion(+) diff --git a/MANIFEST.in b/MANIFEST.in index 2f6b9ae8b..4096cc1b6 100755 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,5 @@ include requirements.txt +include autoPyTorch/py.typed include autoPyTorch/utils/logging.yaml include autoPyTorch/configs/default_pipeline_options.json include autoPyTorch/configs/greedy_portfolio.json From eb0b123a34833245034689e08895018010cb242c Mon Sep 17 00:00:00 2001 From: Eddie Bergman Date: Mon, 20 Dec 2021 10:01:20 +0100 Subject: [PATCH 7/7] Update .github/workflows/dist.yml Co-authored-by: Ravin Kohli <13005107+ravinkohli@users.noreply.github.com> --- .github/workflows/dist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dist.yml b/.github/workflows/dist.yml index 608d3cbe7..d1b5d5989 100644 --- a/.github/workflows/dist.yml +++ b/.github/workflows/dist.yml @@ -54,7 +54,7 @@ jobs: run: | pip install mypy - cd .. # required to use the installed version of autosklearn + cd .. # required to use the installed version of autoPyTorch # Note this doesn't perform mypy checks, those are handled in pre-commit.yaml # This only checks if autoPyTorch exports type information