http-snapshots #45
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Workflow derived for http snapshots at a cron schedule (once a week on monday at 00:00) | |
on: | |
schedule: | |
- cron: '0 2 * * 1' | |
name: http-snapshots | |
jobs: | |
http-snapshots: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
R_KEEP_PKG_SOURCE: yes | |
RENV_PATHS_ROOT: ~/.local/share/renv | |
steps: | |
- name: Install rirods | |
uses: actions/checkout@v3 | |
with: | |
path: rirods | |
- name: Install irods_demo | |
uses: actions/checkout@v3 | |
with: | |
repository: irods/irods_demo | |
path: irods_demo | |
- name: Setup iRODS demo | |
run: | | |
cd ./irods_demo | |
git submodule sync --recursive | |
git submodule update --init --force --recursive --remote | |
docker compose up -d nginx-reverse-proxy irods-client-http-api irods-client-icommands | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
- name: Install system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libcurl4-openssl-dev | |
- name: Cache packages | |
uses: actions/cache@v1 | |
with: | |
path: ${{ env.RENV_PATHS_ROOT }} | |
key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }} | |
restore-keys: | | |
${{ runner.os }}-renv- | |
- name: Restore packages | |
working-directory: ./rirods | |
shell: Rscript {0} | |
run: | | |
if (!requireNamespace("renv", quietly = TRUE)) install.packages("renv") | |
renv::restore(repos = c(CRAN = "https://cloud.r-project.org")) | |
if (!requireNamespace("rcmdcheck", quietly = TRUE)) install.packages("rcmdcheck") | |
if (!requireNamespace("pkgload", quietly = TRUE)) install.packages("pkgload") | |
if (!requireNamespace("knitr", quietly = TRUE)) install.packages("knitr") | |
if (!requireNamespace("rmarkdown", quietly = TRUE)) install.packages("rmarkdown") | |
# On linux we remove httptest2 mock files to force a realistic test against | |
# the irods_demo server | |
- name: Remove mock files on Linux | |
working-directory: ./rirods | |
shell: Rscript {0} | |
run: | | |
pkgload::load_all() | |
remove_mock_files() | |
- name: R CMD check of rirods | |
uses: r-lib/actions/check-r-package@v2 | |
with: | |
working-directory: ./rirods | |
# upload-snapshots: true | |
- name: Commit and push snapshots | |
run: | | |
cp -TR ./rirods/check/**/tests/testthat/ ./rirods/tests/testthat/ | |
cd ./rirods | |
git config --local user.name "$GITHUB_ACTOR" | |
git config --local user.email "[email protected]" | |
git add ./tests/testthat/\*\*/\*\.R | |
git commit -m "Snapshots http response" || echo "No changes to commit" | |
git pull --ff-only | |
git push origin | |
git rm --cached tests/testthat/\*\*/\*.R |