diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 03ba1706..00000000 --- a/.travis.yml +++ /dev/null @@ -1,65 +0,0 @@ -language: python -sudo: false -cache: pip -language: python -env: - global: - - SKGGM_VERSION=a0ed406586c4364ea3297a658f415e13b5cbdaf8 -matrix: - include: - - name: "Pytest python 3.6 without skggm" - python: "3.6" - before_install: - - sudo apt-get install liblapack-dev - - pip install --upgrade pip pytest - - pip install wheel cython numpy scipy codecov pytest-cov scikit-learn - script: - - pytest test --cov; - after_success: - - bash <(curl -s https://codecov.io/bash) - - name: "Pytest python 3.6 with skggm" - python: "3.6" - before_install: - - sudo apt-get install liblapack-dev - - pip install --upgrade pip pytest - - pip install wheel cython numpy scipy codecov pytest-cov scikit-learn - - pip install git+https://github.com/skggm/skggm.git@${SKGGM_VERSION}; - script: - - pytest test --cov; - after_success: - - bash <(curl -s https://codecov.io/bash) - - name: "Pytest python 3.7 with skggm" - python: "3.7" - before_install: - - sudo apt-get install liblapack-dev - - pip install --upgrade pip pytest - - pip install wheel cython numpy scipy codecov pytest-cov scikit-learn - - pip install git+https://github.com/skggm/skggm.git@${SKGGM_VERSION}; - script: - - pytest test --cov; - after_success: - - bash <(curl -s https://codecov.io/bash) - - name: "Pytest python 3.6 with skggm + scikit-learn 0.20.3" - # checks that tests work for the oldest supported scikit-learn version - python: "3.6" - before_install: - - sudo apt-get install liblapack-dev - - pip install --upgrade pip pytest - - pip install wheel cython numpy scipy codecov pytest-cov - - pip install scikit-learn==0.20.3 - - pip install git+https://github.com/skggm/skggm.git@${SKGGM_VERSION}; - script: - - pytest test --cov; - after_success: - - bash <(curl -s https://codecov.io/bash) - - name: "Syntax checking with flake8" - python: "3.7" - before_install: - - pip install flake8 - script: - - flake8 --extend-ignore=E111,E114 --show-source; - # Use this instead to have a syntax check only on the diff: - # - source ./build_tools/travis/flake8_diff.sh; -branches: - only: - - master diff --git a/README.rst b/README.rst index 41181ee8..681e29f6 100644 --- a/README.rst +++ b/README.rst @@ -1,4 +1,4 @@ -|Travis-CI Build Status| |License| |PyPI version| |Code coverage| +|GitHub Actions Build Status| |License| |PyPI version| |Code coverage| metric-learn: Metric Learning in Python ======================================= @@ -67,8 +67,8 @@ Bibtex entry:: .. _sphinx documentation: http://contrib.scikit-learn.org/metric-learn/ -.. |Travis-CI Build Status| image:: https://api.travis-ci.org/scikit-learn-contrib/metric-learn.svg?branch=master - :target: https://travis-ci.org/scikit-learn-contrib/metric-learn +.. |GitHub Actions Build Status| image:: https://github.com/scikit-learn-contrib/metric-learn/workflows/CI/badge.svg + :target: https://github.com/scikit-learn-contrib/metric-learn/actions?query=event%3Apush+branch%3Amaster .. |License| image:: http://img.shields.io/:license-mit-blue.svg?style=flat :target: http://badges.mit-license.org .. |PyPI version| image:: https://badge.fury.io/py/metric-learn.svg diff --git a/build_tools/travis/flake8_diff.sh b/build_tools/travis/flake8_diff.sh deleted file mode 100644 index aea926c8..00000000 --- a/build_tools/travis/flake8_diff.sh +++ /dev/null @@ -1,132 +0,0 @@ -# This file is not used yet but we keep it in case we need to check the pep8 difference -# on the diff (see .travis.yml) -# -#!/bin/bash -# copied-pasted and adapted from http://github.com/sklearn-contrib/imbalanced-learn -# (more precisely: https://raw.githubusercontent.com/glemaitre/imbalanced-learn -# /adcb9d8e6210b321dac2c1b06879e5e889d52d77/build_tools/travis/flake8_diff.sh) - -# This script is used in Travis to check that PRs do not add obvious -# flake8 violations. It relies on two things: -# - find common ancestor between branch and -# scikit-learn/scikit-learn remote -# - run flake8 --diff on the diff between the branch and the common -# ancestor -# -# Additional features: -# - the line numbers in Travis match the local branch on the PR -# author machine. -# - ./build_tools/travis/flake8_diff.sh can be run locally for quick -# turn-around - -set -e -# pipefail is necessary to propagate exit codes -set -o pipefail - -PROJECT=scikit-learn-contrib/metric-learn -PROJECT_URL=https://github.com/$PROJECT.git - -# Find the remote with the project name (upstream in most cases) -REMOTE=$(git remote -v | grep $PROJECT | cut -f1 | head -1 || echo '') - -# Add a temporary remote if needed. For example this is necessary when -# Travis is configured to run in a fork. In this case 'origin' is the -# fork and not the reference repo we want to diff against. -if [[ -z "$REMOTE" ]]; then - TMP_REMOTE=tmp_reference_upstream - REMOTE=$TMP_REMOTE - git remote add $REMOTE $PROJECT_URL -fi - -echo "Remotes:" -echo '--------------------------------------------------------------------------------' -git remote --verbose - -# Travis does the git clone with a limited depth (50 at the time of -# writing). This may not be enough to find the common ancestor with -# $REMOTE/master so we unshallow the git checkout -if [[ -a .git/shallow ]]; then - echo -e '\nTrying to unshallow the repo:' - echo '--------------------------------------------------------------------------------' - git fetch --unshallow -fi - -if [[ "$TRAVIS" == "true" ]]; then - if [[ "$TRAVIS_PULL_REQUEST" == "false" ]] - then - # In main repo, using TRAVIS_COMMIT_RANGE to test the commits - # that were pushed into a branch - if [[ "$PROJECT" == "$TRAVIS_REPO_SLUG" ]]; then - if [[ -z "$TRAVIS_COMMIT_RANGE" ]]; then - echo "New branch, no commit range from Travis so passing this test by convention" - exit 0 - fi - COMMIT_RANGE=$TRAVIS_COMMIT_RANGE - fi - else - # We want to fetch the code as it is in the PR branch and not - # the result of the merge into master. This way line numbers - # reported by Travis will match with the local code. - LOCAL_BRANCH_REF=travis_pr_$TRAVIS_PULL_REQUEST - # In Travis the PR target is always origin - git fetch origin pull/$TRAVIS_PULL_REQUEST/head:refs/$LOCAL_BRANCH_REF - fi -fi - -# If not using the commit range from Travis we need to find the common -# ancestor between $LOCAL_BRANCH_REF and $REMOTE/master -if [[ -z "$COMMIT_RANGE" ]]; then - if [[ -z "$LOCAL_BRANCH_REF" ]]; then - LOCAL_BRANCH_REF=$(git rev-parse --abbrev-ref HEAD) - fi - echo -e "\nLast 2 commits in $LOCAL_BRANCH_REF:" - echo '--------------------------------------------------------------------------------' - git log -2 $LOCAL_BRANCH_REF - - REMOTE_MASTER_REF="$REMOTE/master" - # Make sure that $REMOTE_MASTER_REF is a valid reference - echo -e "\nFetching $REMOTE_MASTER_REF" - echo '--------------------------------------------------------------------------------' - git fetch $REMOTE master:refs/remotes/$REMOTE_MASTER_REF - LOCAL_BRANCH_SHORT_HASH=$(git rev-parse --short $LOCAL_BRANCH_REF) - REMOTE_MASTER_SHORT_HASH=$(git rev-parse --short $REMOTE_MASTER_REF) - - COMMIT=$(git merge-base $LOCAL_BRANCH_REF $REMOTE_MASTER_REF) || \ - echo "No common ancestor found for $(git show $LOCAL_BRANCH_REF -q) and $(git show $REMOTE_MASTER_REF -q)" - - if [ -z "$COMMIT" ]; then - exit 1 - fi - - COMMIT_SHORT_HASH=$(git rev-parse --short $COMMIT) - - echo -e "\nCommon ancestor between $LOCAL_BRANCH_REF ($LOCAL_BRANCH_SHORT_HASH)"\ - "and $REMOTE_MASTER_REF ($REMOTE_MASTER_SHORT_HASH) is $COMMIT_SHORT_HASH:" - echo '--------------------------------------------------------------------------------' - git show --no-patch $COMMIT_SHORT_HASH - - COMMIT_RANGE="$COMMIT_SHORT_HASH..$LOCAL_BRANCH_SHORT_HASH" - - if [[ -n "$TMP_REMOTE" ]]; then - git remote remove $TMP_REMOTE - fi - -else - echo "Got the commit range from Travis: $COMMIT_RANGE" -fi - -echo -e '\nRunning flake8 on the diff in the range' "$COMMIT_RANGE" \ - "($(git rev-list $COMMIT_RANGE | wc -l) commit(s)):" -echo '--------------------------------------------------------------------------------' - -# to not include the context (some lines before and after the modified lines), add the -# flag --unified=0 (warning: it will not include some errors like for instance adding too -# much blank lines -check_files() { - git diff $COMMIT_RANGE | flake8 --diff --show-source --extend-ignore=E111,E114 -} - -check_files - -echo -e "No problem detected by flake8\n" -