Skip to content

Commit

Permalink
Transition from Travis CI to github workflow (#1004)
Browse files Browse the repository at this point in the history
* Transition from travis

* Fix examples

* Give rerun failures a try

* Try pytest directly

* Trying to make cov work

* removed wrong long

* Try serial runs as before

* No Rerun

* Incorporated PR comments

* Fix conda and dist failures

* Fix flake

* Output check
  • Loading branch information
franchuterivera committed Nov 19, 2020
1 parent 5351b0d commit 37a0d7d
Show file tree
Hide file tree
Showing 19 changed files with 295 additions and 383 deletions.
7 changes: 7 additions & 0 deletions .flake8
@@ -0,0 +1,7 @@
[flake8]
max-line-length = 100
show-source = True
application-import-names = autosklearn
exclude =
venv
build
31 changes: 31 additions & 0 deletions .github/workflows/dist.yml
@@ -0,0 +1,31 @@
name: dist-check

on: [push, pull_request]

jobs:
dist:
runs-on: ubuntu-latest
steps:
- 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/auto-sklearn-*.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/auto-sklearn-*.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 autosklearn"; then exit 1; fi
43 changes: 43 additions & 0 deletions .github/workflows/docs.yml
@@ -0,0 +1,43 @@
name: Docs
on: [pull_request, push]

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
pip install -e .[docs,examples,examples_unix]
- name: Make docs
run: |
cd doc
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-sklearn.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: |
branch_name=${GITHUB_REF##*/}
cd ../gh-pages
rm -rf $branch_name
cp -r ../autosklearn/doc/build/html $branch_name
- name: Push to gh-pages
if: (contains(github.ref, 'develop') || contains(github.ref, 'master')) && github.event_name == 'push'
run: |
last_commit=$(git log --pretty=format:"%an: %s")
cd ../gh-pages
branch_name=${GITHUB_REF##*/}
git add $branch_name/
git config --global user.name 'Github Actions'
git config --global user.email 'not@mail.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git commit -am "$last_commit"
git push
20 changes: 20 additions & 0 deletions .github/workflows/pre-commit.yaml
@@ -0,0 +1,20 @@
name: pre-commit

on: [push, pull_request]

jobs:
run-all-files:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install pre-commit
run: |
pip install pre-commit
pre-commit install
- name: Run pre-commit
run: |
pre-commit run --all-files
83 changes: 83 additions & 0 deletions .github/workflows/pytest.yml
@@ -0,0 +1,83 @@
name: Tests

on: [push, pull_request]

jobs:
ubuntu:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
use-conda: [true, false]
use-dist: [false]
include:
- python-version: 3.8
code-cov: true
- python-version: 3.7
use-conda: false
use-dist: true
fail-fast: false

steps:
- uses: actions/checkout@v2
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Conda Install test dependencies
if: matrix.use-conda == true
run: |
# Miniconda is available in $CONDA env var
$CONDA/bin/conda create -n testenv --yes pip wheel gxx_linux-64 gcc_linux-64 swig python=${{ matrix.python-version }}
$CONDA/envs/testenv/bin/python3 -m pip install --upgrade pip
$CONDA/envs/testenv/bin/pip3 install -e .[test]
- name: Install test dependencies
if: matrix.use-conda == false && matrix.use-dist == false
run: |
python -m pip install --upgrade pip
pip install -e .[test]
sudo apt-get update
sudo apt-get remove swig
sudo apt-get install swig3.0
sudo ln -s /usr/bin/swig3.0 /usr/bin/swig
- name: Dist Install test dependencies
if: matrix.use-conda == false && matrix.use-dist == true
run: |
python -m pip install --upgrade pip
sudo apt-get update
sudo apt-get remove swig
sudo apt-get install swig3.0
sudo ln -s /usr/bin/swig3.0 /usr/bin/swig
# We need to install for the dependencies, like pytest
pip install -e .[test]
# Then we remove autosklearn and install from DIST
pip uninstall --yes auto-sklearn
python setup.py sdist
last_dist=$(ls -t dist/auto-sklearn-*.tar.gz | head -n 1)
pip install $last_dist
- name: Conda Run tests
if: matrix.use-conda == true
run: |
export OPENBLAS_NUM_THREADS=1
export OMP_NUM_THREADS=1
export MKL_NUM_THREADS=1
# We activate conda as metalearning uses python directly, so we need
# to change the default python
export PATH="$CONDA/envs/testenv/bin:$PATH"
if [ ${{ matrix.code-cov }} ]; then codecov='--cov=autosklearn --cov-report=xml'; fi
$CONDA/envs/testenv/bin/python3 -m pytest --durations=20 -sv $codecov test
- name: Run tests
if: matrix.use-conda == false
run: |
export OPENBLAS_NUM_THREADS=1
export OMP_NUM_THREADS=1
export MKL_NUM_THREADS=1
if [ ${{ matrix.code-cov }} ]; then codecov='--cov=autosklearn --cov-report=xml'; fi
pytest --durations=20 -sv $codecov test
- name: Upload coverage
if: matrix.code-cov && always()
uses: codecov/codecov-action@v1
with:
fail_ci_if_error: true
verbose: true
45 changes: 45 additions & 0 deletions .pre-commit-config.yaml
@@ -0,0 +1,45 @@
repos:
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.761
hooks:
- id: mypy
name: mypy auto-sklearn-ensembles
files: autosklearn/ensembles
- id: mypy
name: mypy auto-sklearn-metrics
files: autosklearn/metrics
- id: mypy
name: mypy auto-sklearn-data
files: autosklearn/data
- id: mypy
name: mypy auto-sklearn-util
files: autosklearn/util
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.3
hooks:
- id: flake8
name: flake8 auto-sklearn
files: autosklearn/*
- id: flake8
name: flake8 file-order-data
files: autosklearn/data
additional_dependencies:
- flake8-import-order
- id: flake8
name: flake8 file-order-ensemble
files: autosklearn/ensembles
additional_dependencies:
- flake8-import-order
- id: flake8
name: flake8 file-order-metrics
files: autosklearn/metrics
additional_dependencies:
- flake8-import-order
- id: flake8
name: flake8 file-order-util
files: autosklearn/util
additional_dependencies:
- flake8-import-order
- id: flake8
name: flake8 autosklearn-test
files: test/*
83 changes: 0 additions & 83 deletions .travis.yml

This file was deleted.

61 changes: 0 additions & 61 deletions ci_scripts/create_doc.sh

This file was deleted.

0 comments on commit 37a0d7d

Please sign in to comment.