Skip to content

Commit

Permalink
migrate from Appveyor to GitHub Actions (#338)
Browse files Browse the repository at this point in the history
* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* Update rgf.vcxproj

* Update rgf.vcxproj

* Update rgf.vcxproj

* Update rgf.vcxproj

* Update rgf.vcxproj

* Update main.yml

* Update python_tests_windows.ps1

* test

* test

* test

* test

* test

* test

* Update r_tests_windows.ps1

* Update main.yml

* Update r_tests_windows.ps1

* Update main.yml

* Update r_tests_windows.ps1

* Update r_tests_windows.ps1

* Update r_tests_windows.ps1

* Update r_tests_windows.ps1

* Update r_tests_windows.ps1

* Update r_tests_windows.ps1

* Update r_tests_windows.ps1

* Update main.yml

* Update r_tests_windows.ps1

* Update r_tests_windows.ps1

* Update main.yml

* Update r_tests_windows.ps1

* Update r_tests_windows.ps1

* Update r_tests_windows.ps1

* Update r_tests_windows.ps1

* Update r_tests_windows.ps1

* Update r_tests_windows.ps1

* Update r_tests_windows.ps1

* Update r_tests_windows.ps1

* Update r_tests_windows.ps1

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update r_tests_windows.ps1
  • Loading branch information
StrikerRUS authored Mar 6, 2021
1 parent cd99ce8 commit ab328a0
Show file tree
Hide file tree
Showing 7 changed files with 152 additions and 189 deletions.
97 changes: 0 additions & 97 deletions .appveyor.yml

This file was deleted.

85 changes: 0 additions & 85 deletions .ci/.R.appveyor.ps1

This file was deleted.

25 changes: 25 additions & 0 deletions .ci/python_tests_windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
function Check-Output {
param( [bool]$Success )
if (!$Success) {
$host.SetShouldExit(-1)
Exit -1
}
}


$ProgressPreference = "SilentlyContinue" # progress bar bug extremely slows down download speed
$InstallerName = "$env:GITHUB_WORKSPACE\Miniconda3-latest-Windows-x86_64.exe"
Invoke-WebRequest -Uri "https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe" -OutFile $InstallerName
Start-Process -FilePath $InstallerName -ArgumentList "/InstallationType=JustMe /RegisterPython=0 /S /D=$env:CONDA_PATH" -Wait
conda init powershell
Invoke-Expression -Command "$env:USERPROFILE\Documents\WindowsPowerShell\profile.ps1"
conda config --set always_yes yes --set changeps1 no
conda update -q conda
conda create -q -n $env:CONDA_ENV python=$env:PYTHON_VERSION joblib numpy scikit-learn scipy pandas pytest
conda activate $env:CONDA_ENV
cd $env:GITHUB_WORKSPACE\python-package
python setup.py sdist --formats gztar ; Check-Output $?
pip install dist\rgf_python-$env:RGF_VER.tar.gz -v ; Check-Output $?
if ($env:TASK -ne "R_PACKAGE") {
pytest tests -v ; Check-Output $?
}
78 changes: 78 additions & 0 deletions .ci/r_tests_windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
function Check-Output {
param( [bool]$Success )
if (!$Success) {
$host.SetShouldExit(-1)
Exit -1
}
}


conda activate $env:CONDA_ENV

tzutil /s "GMT Standard Time"

$env:R_LIB_PATH = "$env:USERPROFILE\R"
$env:CTAN_PACKAGE_ARCHIVE = "https://ctan.math.illinois.edu/systems/win32/miktex/tm/packages/"
$env:PATH += ";$env:R_LIB_PATH\Rtools\usr\bin" + ";$env:R_LIB_PATH\Rtools\mingw64\bin" + ";$env:R_LIB_PATH\R\bin\x64" + ";$env:R_LIB_PATH\miktex\texmfs\install\miktex\bin\x64"
cd $env:GITHUB_WORKSPACE

[Void][System.IO.Directory]::CreateDirectory($env:R_LIB_PATH)
Remove-Item C:\rtools40 -Force -Recurse -ErrorAction Ignore

# ignore R CMD CHECK NOTE checking how long it has
# been since the last submission
$env:_R_CHECK_CRAN_INCOMING_ = 0
$env:_R_CHECK_CRAN_INCOMING_REMOTE_ = 0

$R_VER = "4.0.3"
$ProgressPreference = "SilentlyContinue" # progress bar bug extremely slows down download speed
Invoke-WebRequest -Uri https://cloud.r-project.org/bin/windows/base/old/$R_VER/R-$R_VER-win.exe -OutFile R-win.exe
Start-Process -FilePath R-win.exe -NoNewWindow -Wait -ArgumentList "/VERYSILENT /DIR=$env:R_LIB_PATH\R /COMPONENTS=main,x64" ; Check-Output $?

Invoke-WebRequest -Uri https://cran.r-project.org/bin/windows/Rtools/rtools40-x86_64.exe -OutFile Rtools.exe
Start-Process -FilePath Rtools.exe -NoNewWindow -Wait -ArgumentList "/VERYSILENT /SUPPRESSMSGBOXES /DIR=$env:R_LIB_PATH\Rtools" ; Check-Output $?

Invoke-WebRequest -Uri https://miktex.org/download/win/miktexsetup-x64.zip -OutFile miktexsetup-x64.zip
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::ExtractToDirectory("miktexsetup-x64.zip", "miktex")
.\miktex\miktexsetup_standalone.exe --remote-package-repository="$env:CTAN_PACKAGE_ARCHIVE" --local-package-repository=.\miktex\download --package-set=essential --quiet download ; Check-Output $?
.\miktex\download\miktexsetup_standalone.exe --remote-package-repository="$env:CTAN_PACKAGE_ARCHIVE" --portable="$env:R_LIB_PATH\miktex" --quiet install ; Check-Output $?

initexmf --set-config-value [MPM]AutoInstall=1
echo yes | pacman -S mingw-w64-x86_64-qpdf

cd "$env:GITHUB_WORKSPACE\R-package"
Add-Content .Renviron "R_LIBS=$env:R_LIB_PATH"
Add-Content .Rprofile "options(repos = 'https://cran.r-project.org')"
Add-Content .Rprofile "options(pkgType = 'binary')"
Add-Content .Rprofile "options(install.packages.check.source = 'no')"
Add-Content .Rprofile "Sys.setenv(RETICULATE_PYTHON = '$([RegEx]::Escape($env:CONDA_PREFIX))/python.exe')"

Rscript -e "install.packages('devtools', dependencies = TRUE)"
Rscript -e "devtools::install_deps(pkg = '.', dependencies = TRUE)"

R.exe CMD build . ; Check-Output $?

$PKG_FILE_NAME = Get-Item *.tar.gz
$PKG_NAME = $PKG_FILE_NAME.BaseName.split("_")[0]
$LOG_FILE_NAME = "$PKG_NAME.Rcheck/00check.log"
$COVERAGE_FILE_NAME = "$PKG_NAME.Rcheck/coverage.log"

R.exe CMD check "${PKG_FILE_NAME}" --as-cran ; Check-Output $?

if (Get-Content "$LOG_FILE_NAME" | Select-String -Pattern "NOTE|WARNING|ERROR" -CaseSensitive -Quiet) {
echo "NOTEs, WARNINGs or ERRORs have been found by R CMD check"
Check-Output $False
}

$ActualErrorPreference = $ErrorActionPreference
$ErrorActionPreference = "Continue"
Rscript -e "covr::codecov(quiet = FALSE)" *>&1 | Tee-Object "$COVERAGE_FILE_NAME" ; $LastExitCode = 0
$ErrorActionPreference = $ActualErrorPreference
$Coverage = 0
$Match = Get-Content "$COVERAGE_FILE_NAME" | Select-String -Pattern "RGF Coverage:" | Select-Object -First 1
$Coverage = [float]$Match.Line.Trim().Split(" ")[-1].Replace("%", "")
if ($Coverage -le 50) {
echo "Code coverage is extremely small!"
Check-Output $False
}
51 changes: 47 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,35 +25,50 @@ jobs:
python_version: 3.6
- os: macos-latest
python_version: 3.6
- os: windows-2016
python_version: 3.6
- os: ubuntu-latest
container: ubuntu:trusty
python_version: 3.7
- os: macos-latest
python_version: 3.7
- os: windows-2016
python_version: 3.7
- os: ubuntu-latest
container: ubuntu:trusty
python_version: 3.8
- os: macos-latest
python_version: 3.8
- os: windows-2016
python_version: 3.8
- os: ubuntu-latest
container: ubuntu:trusty
python_version: 3.9
- os: macos-latest
python_version: 3.9
- os: windows-2016
python_version: 3.9
- os: ubuntu-latest
container: rocker/verse:latest
python_version: 3.9
task: R_PACKAGE
- os: macos-latest
python_version: 3.9
task: R_PACKAGE
- os: windows-2016
python_version: 3.9
task: R_PACKAGE
container: ${{ matrix.container }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 5
- name: Setup and run tests
- name: Install pandoc
if: matrix.task == 'R_PACKAGE' && startsWith(matrix.os, 'windows')
uses: r-lib/actions/setup-pandoc@v1
- name: Setup and run tests on Linux and macOS
if: matrix.os == 'macOS-latest' || matrix.os == 'ubuntu-latest'
shell: bash
run: |
export OS_NAME="${{ matrix.os }}"
Expand All @@ -73,8 +88,26 @@ jobs:
if [[ $TASK == "R_PACKAGE" ]]; then
$GITHUB_WORKSPACE/.ci/r_tests.sh || exit -1
fi
- name: Create Wheel
if: matrix.python_version == 3.9 && matrix.task != 'R_PACKAGE' && startsWith(github.ref, 'refs/tags/')
- name: Setup and run tests on Windows
if: startsWith(matrix.os, 'windows')
run: |
$env:OS_NAME = "${{ matrix.os }}"
$env:PYTHON_VERSION = "${{ matrix.python_version }}"
$env:CONDA_ENV = "test-env"
echo "CONDA_ENV=$env:CONDA_ENV" >> $env:GITHUB_ENV
$env:CONDA_PATH = "$env:USERPROFILE\miniconda"
echo "CONDA_PATH=$env:CONDA_PATH" >> $env:GITHUB_ENV
$env:PATH += ";$env:CONDA_PATH\Scripts"
$env:PATH += ";C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin"
$env:TASK = "${{ matrix.task }}"
$env:RGF_VER = (Get-Content $env:GITHUB_WORKSPACE\python-package\rgf\VERSION).trim()
echo "RGF_VER=$env:RGF_VER" >> $env:GITHUB_ENV
& "$env:GITHUB_WORKSPACE\.ci\python_tests_windows.ps1"
if ($env:TASK -eq "R_PACKAGE") {
& "$env:GITHUB_WORKSPACE\.ci\r_tests_windows.ps1"
}
- name: Create wheel for Linux and macOS
if: (matrix.os == 'macOS-latest' || matrix.os == 'ubuntu-latest') && matrix.python_version == 3.9 && matrix.task != 'R_PACKAGE' && startsWith(github.ref, 'refs/tags/')
shell: bash
run: |
export PATH="${{ env.CONDA_PATH }}/bin:$PATH"
Expand All @@ -91,6 +124,14 @@ jobs:
else
python setup.py bdist_wheel --plat-name=manylinux1_x86_64 --python-tag py3;
fi
- name: Create wheel for Windows
if: startsWith(matrix.os, 'windows') && matrix.python_version == 3.9 && matrix.task != 'R_PACKAGE' && startsWith(github.ref, 'refs/tags/')
run: |
$env:PATH += ";${{ env.CONDA_PATH }}\Scripts"
$env:PATH += ";C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin"
conda activate ${{ env.CONDA_ENV }}
cd $env:GITHUB_WORKSPACE\python-package
python setup.py bdist_wheel --plat-name=win-amd64 --python-tag py3
- name: Create GitHub Release
if: matrix.python_version == 3.9 && matrix.task != 'R_PACKAGE' && startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
Expand All @@ -101,7 +142,9 @@ jobs:
name: ${{ env.RGF_VER }}
draft: true
prerelease: false
files: ${{ github.workspace }}/python-package/dist/*.whl
files: |
${{ github.workspace }}/python-package/dist/*.whl
${{ github.workspace }}/python-package/compile/RGF/bin/*.exe
all-successful:
# https://github.community/t/is-it-possible-to-require-all-github-actions-tasks-to-pass-without-enumerating-them/117957/4?u=graingert
runs-on: ubuntu-latest
Expand Down
Loading

0 comments on commit ab328a0

Please sign in to comment.