This commit is contained in:
Hong Ooi 2019-08-16 19:08:50 +10:00
Родитель ff1529a7fd
Коммит 44091e6511
4 изменённых файлов: 51 добавлений и 34 удалений

Просмотреть файл

@ -1,8 +0,0 @@
language: r
sudo: false
cache: packages
r_packages:
- drat
after_success:
- test $TRAVIS_PULL_REQUEST == "false" && test $TRAVIS_BRANCH == "master" && bash drat.sh

Просмотреть файл

@ -2,7 +2,7 @@
[![CRAN](https://www.r-pkg.org/badges/version/AzureKeyVault)](https://cran.r-project.org/package=AzureKeyVault)
![Downloads](https://cranlogs.r-pkg.org/badges/AzureKeyVault)
[![Travis Build Status](https://travis-ci.org/Azure/AzureKeyVault.svg?branch=master)](https://travis-ci.org/Azure/AzureKeyVault)
[![Build Status](https://asiadatascience.visualstudio.com/AzureR/_apis/build/status/Azure.AzureKeyVault?branchName=master)](https://asiadatascience.visualstudio.com/AzureR/_build/latest?definitionId=9&branchName=master)
[Azure Key Vault](https://azure.microsoft.com/services/key-vault/) enables Microsoft Azure applications and users to store and use several types of secret/key data:

Просмотреть файл

@ -1,9 +1,55 @@
trigger:
- master
variables:
- group: GH
- name: R_LIBS_USER
value: '$(Agent.BuildDirectory)/R/library'
pool:
vmImage: 'ubuntu-latest'
container: $[variables['rockerImage']]
steps:
- script: 'git push --prune https://$(ghPat)@github.com/cloudyr/AzureKeyVault +refs/remotes/origin/*:refs/heads/* +refs/tags/*:refs/tags/*'
displayName: 'copy to cloudyr'
- bash: |
export CLOUDYR_REPO=$(echo $(Build.Repository.Name) | sed "s/Azure/cloudyr/")
git push --prune https://$(ghPat)@github.com/$CLOUDYR_REPO +refs/remotes/origin/*:refs/heads/* +refs/tags/*:refs/tags/*
displayName: 'Copy to Cloudyr'
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
- bash: |
echo "options(repos = '$(cranRepo)')" > ~/.Rprofile
echo ".libPaths(c('$R_LIBS_USER', .libPaths()))" >> ~/.Rprofile
mkdir -p $R_LIBS_USER
displayName: 'Setup R library directory'
- task: CacheBeta@0
inputs:
key: ./DESCRIPTION | "$(rockerImage)" | "$(cranRepo)"
path: $(R_LIBS_USER)
displayName: 'Caching packages'
- bash: |
Rscript -e "pkgs <- c('remotes', 'rcmdcheck', 'drat'); if(length(find.package(pkgs, quiet=TRUE)) != length(pkgs)) install.packages(pkgs)"
Rscript -e "remotes::install_deps(dependencies=TRUE)"
displayName: 'Installing package dependencies'
- bash: |
Rscript -e "f <- pkgbuild::build(dest_path='$(Build.ArtifactStagingDirectory)'); rcmdcheck::rcmdcheck(f, args='--no-manual', error_on='warning', check_dir='check')"
displayName: 'Checking package'
- bash: |
export PKGBUILD_GZ=$(ls $(Build.ArtifactStagingDirectory)/*.gz)
mkdir drat
cd drat
git init
git config user.email "dummy@example.com"
git config user.name "Azure Pipelines"
git remote add upstream "https://$(ghPat)@github.com/cloudyr/cloudyr.github.io.git"
git fetch upstream
git checkout master
Rscript -e "drat::insertPackage('$PKGBUILD_GZ', repodir='./drat')"
git add --all
git commit -m "add $PKGBUILD_GZ (build $(Build.BuildId))"
git push
displayName: 'Update Cloudyr drat'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))

21
drat.sh
Просмотреть файл

@ -1,21 +0,0 @@
#!/bin/bash
set -o errexit -o nounset
addToDrat(){
mkdir drat; cd drat
## Set up Repo parameters
git init
git config --global push.default simple
## Get drat repo
git remote add upstream "https://$ghPat@github.com/cloudyr/cloudyr.github.io.git"
git fetch upstream
git checkout master
Rscript -e "drat::insertPackage('../$PKG_TARBALL', repodir = './drat')"
git add --all
git commit -m "add $PKG_TARBALL (build $TRAVIS_BUILD_ID)"
git push
}
addToDrat