Skip to content

Commit 1110378

Browse files
committedDec 15, 2023
fix tests
1 parent a9344a5 commit 1110378

3 files changed

+31
-27
lines changed
 

‎inst/templates/ghactions-core.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050
- name: "[Stage] Upload R CMD check artifacts"
5151
if: failure()
52-
uses: actions/upload-artifact@v3
52+
uses: actions/upload-artifact@v4
5353
with:
5454
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
5555
path: check

‎inst/testdata/ghactions-test-update-yaml-env-and-blocks-solution.yml

+16-9
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
5454

5555
steps:
56-
- uses: actions/checkout@v3
56+
- uses: actions/checkout@v4
5757

5858
- uses: r-lib/actions/setup-r@v2
5959
with:
@@ -65,6 +65,10 @@ jobs:
6565

6666
- uses: r-lib/actions/setup-pandoc@v2
6767

68+
- name: Install sys deps for Ubuntu
69+
if: runner.os == 'Linux'
70+
run: sudo apt update && sudo apt install -y libgit2-dev libcurl4-openssl-dev
71+
6872
# set date/week for use in cache creation
6973
# https://github.community/t5/GitHub-Actions/How-to-set-and-access-a-Workflow-variable/m-p/42970
7074
# - cache R packages daily
@@ -73,23 +77,26 @@ jobs:
7377
id: date
7478
run: echo "date=$(date '+%d-%m')" >> $GITHUB_OUTPUT
7579

76-
- name: "[Cache] Cache R packages"
80+
- name: "[Cache] Restore R package cache"
7781
if: runner.os != 'Windows'
78-
uses: pat-s/always-upload-cache@v3
82+
uses: actions/cache/restore@v3
7983
with:
8084
path: ${{ env.R_LIBS_USER }}
8185
key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{steps.date.outputs.date}}
82-
restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-${{steps.date.outputs.date}}
8386

8487
- name: "[Custom block] Test custom user block"
8588
run: |
8689
echo 'test'
8790
88-
- name: "[Stage] Install pak"
89-
run: Rscript -e "install.packages('pak', repos = 'https://r-lib.github.io/p/pak/stable')"
90-
9191
- name: "[Stage] Install"
92-
run: Rscript -e "if (grepl('Ubuntu', Sys.info()[['version']]) && !grepl('Under development', R.version[['status']])) {options(repos = c(CRAN = sprintf('https://packagemanager.rstudio.com/all/__linux__/%s/latest', system('lsb_release -cs', intern = TRUE))))}else{options(repos = c(CRAN = 'cloud.r-project.org'))}; pak::pkg_install('ropensci/tic')" -e "print(tic::dsl_load())" -e "tic::prepare_all_stages()" -e "tic::before_install()" -e "tic::install()"
92+
run: Rscript -e "install.packages('tic', repos = c('https://ropensci.r-universe.dev', if (grepl('Ubuntu', Sys.info()[['version']])) {sprintf('https://packagemanager.rstudio.com/all/__linux__/%s/latest', system('lsb_release -cs', intern = TRUE))} else {'https://cloud.r-project.org'}))" -e "print(tic::dsl_load())" -e "tic::prepare_all_stages()" -e "tic::before_install()" -e "tic::install()"
93+
94+
- name: "[Cache] Save R package cache"
95+
if: runner.os != 'Windows' && always()
96+
uses: actions/cache/save@v3
97+
with:
98+
path: ${{ env.R_LIBS_USER }}
99+
key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{steps.date.outputs.date}}
93100

94101
- name: "[Stage] Script"
95102
run: Rscript -e 'tic::script()'
@@ -103,7 +110,7 @@ jobs:
103110

104111
- name: "[Stage] Upload R CMD check artifacts"
105112
if: failure()
106-
uses: actions/upload-artifact@v3
113+
uses: actions/upload-artifact@v4
107114
with:
108115
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
109116
path: check

‎inst/testdata/ghactions-test-update-yaml-env-and-blocks.yml

+14-17
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ jobs:
7373

7474
- uses: r-lib/actions/setup-pandoc@master
7575

76+
- name: Install sys deps for Ubuntu
77+
if: runner.os == 'Linux'
78+
run: sudo apt update && sudo apt install -y libgit2-dev libcurl4-openssl-dev
79+
7680
# set date/week for use in cache creation
7781
# https://github.community/t5/GitHub-Actions/How-to-set-and-access-a-Workflow-variable/m-p/42970
7882
# - cache R packages daily
@@ -82,31 +86,17 @@ jobs:
8286
id: date
8387
run: echo "date=$(date '+%d-%m')" >> $GITHUB_OUTPUT
8488

85-
- name: "[Cache] Cache R packages"
89+
- name: "[Cache] Restore R package cache"
8690
if: runner.os != 'Windows'
87-
uses: pat-s/always-upload-cache@v1.2.0
91+
uses: actions/cache/restore@v3
8892
with:
8993
path: ${{ env.R_LIBS_USER }}
9094
key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{steps.date.outputs.date}}
91-
restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-${{steps.date.outputs.date}}
92-
93-
# install ccache and write config file
94-
- name: "[Linux] ccache"
95-
if: runner.os == 'Linux'
96-
run: |
97-
sudo apt install ccache libcurl4-openssl-dev
98-
mkdir -p ~/.R && echo -e 'CC=ccache gcc -std=gnu99\nCXX=ccache g++\nFC=ccache gfortran\nF77=ccache gfortran' > $HOME/.R/Makevars
9995

10096
- name: "[Custom block] Test custom user block"
10197
run: |
10298
echo 'test'
10399
104-
# for some strange Windows reason this step and the next one need to be decoupled
105-
- name: "[Stage] Prepare"
106-
run: |
107-
Rscript -e "if (!requireNamespace('remotes')) install.packages('remotes', type = 'source')"
108-
Rscript -e "if (getRversion() < '3.2' && !requireNamespace('curl')) install.packages('curl', type = 'source')"
109-
110100
- name: "[Stage] Install"
111101
if: matrix.config.os != 'macOS-latest' || matrix.config.r != 'devel'
112102
run: Rscript -e "remotes::install_github('ropensci/tic')" -e "print(tic::dsl_load())" -e "tic::prepare_all_stages()" -e "tic::before_install()" -e "tic::install()"
@@ -118,6 +108,13 @@ jobs:
118108
echo -e 'options(Ncpus = 4, pkgType = "source", repos = structure(c(CRAN = "https://cloud.r-project.org/")))' > $HOME/.Rprofile
119109
Rscript -e "remotes::install_github('ropensci/tic')" -e "print(tic::dsl_load())" -e "tic::prepare_all_stages()" -e "tic::before_install()" -e "tic::install()"
120110
111+
- name: "[Cache] Save R package cache"
112+
if: runner.os != 'Windows' && always()
113+
uses: actions/cache/save@v3
114+
with:
115+
path: ${{ env.R_LIBS_USER }}
116+
key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{steps.date.outputs.date}}
117+
121118
- name: "[Stage] Script"
122119
run: Rscript -e 'tic::script()'
123120

@@ -131,7 +128,7 @@ jobs:
131128

132129
- name: "[Stage] Upload R CMD check artifacts"
133130
if: failure()
134-
uses: actions/upload-artifact@v3
131+
uses: actions/upload-artifact@v4
135132
with:
136133
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
137134
path: check

0 commit comments

Comments
 (0)