From 5ae522bf3e527ad9514255b55217c335af26e57b Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 11 Jan 2025 23:25:00 -0600 Subject: [PATCH 1/8] restructure CI --- .ci/build-package.sh | 17 ++++ .ci/setup.sh | 37 ++++----- .ci/test.sh | 13 ++- .github/dependabot.yml | 15 ++++ .github/workflows/ci.yml | 175 ++++++++++++++++++++++++--------------- 5 files changed, 159 insertions(+), 98 deletions(-) create mode 100644 .ci/build-package.sh create mode 100644 .github/dependabot.yml diff --git a/.ci/build-package.sh b/.ci/build-package.sh new file mode 100644 index 0000000..a10baeb --- /dev/null +++ b/.ci/build-package.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# failure is a natural part of life +set -e -u -o pipefail + +apt-get update +apt-get install \ + --no-install-recommends \ + -y \ + curl \ + texinfo \ + texlive-latex-recommended \ + texlive-fonts-recommended \ + texlive-fonts-extra \ + qpdf + +R CMD build ./r-pkg diff --git a/.ci/setup.sh b/.ci/setup.sh index 42e8f05..5545676 100755 --- a/.ci/setup.sh +++ b/.ci/setup.sh @@ -3,25 +3,20 @@ # failure is a natural part of life set -e -u -o pipefail -# If language: r, -# install these testing packages we need -if [[ "$TASK" == "rpkg" ]]; then +# `devscripts` is required for 'checkbashisms' (https://github.com/r-lib/actions/issues/111) +sudo apt-get update +sudo apt-get install \ + --no-install-recommends \ + -y \ + --allow-downgrades \ + libcurl4-openssl-dev \ + curl \ + devscripts \ + texinfo \ + texlive-latex-recommended \ + texlive-fonts-recommended \ + texlive-fonts-extra \ + qpdf - # `devscripts` is required for 'checkbashisms' (https://github.com/r-lib/actions/issues/111) - sudo apt-get update - sudo apt-get install \ - --no-install-recommends \ - -y \ - --allow-downgrades \ - libcurl4-openssl-dev \ - curl \ - devscripts \ - texinfo \ - texlive-latex-recommended \ - texlive-fonts-recommended \ - texlive-fonts-extra \ - qpdf - - Rscript -e "install.packages(c('assertthat', 'covr', 'data.table', 'futile.logger', 'httr', 'jsonlite', 'knitr', 'lintr', 'purrr', 'rmarkdown', 'stringr', 'testthat', 'uuid'), repos = 'https://cran.r-project.org', Ncpus = parallel::detectCores())" - cp test-data/* r-pkg/inst/testdata/ -fi +Rscript -e "install.packages(c('assertthat', 'covr', 'data.table', 'futile.logger', 'httr', 'jsonlite', 'knitr', 'lintr', 'purrr', 'rmarkdown', 'stringr', 'testthat', 'uuid'), repos = 'https://cran.r-project.org', Ncpus = parallel::detectCores())" +cp test-data/* r-pkg/inst/testdata/ diff --git a/.ci/test.sh b/.ci/test.sh index 1ec51ff..fbeb506 100755 --- a/.ci/test.sh +++ b/.ci/test.sh @@ -3,11 +3,8 @@ # failure is a natural part of life set -e -u -o pipefail -if [[ "$TASK" == "rpkg" ]]; then - Rscript .ci/lint_r_code.R "$(pwd)" - R CMD build ./r-pkg - export _R_CHECK_CRAN_INCOMING_=false - R CMD check \ - --as-cran \ - ./*.tar.gz -fi +R CMD build ./r-pkg +export _R_CHECK_CRAN_INCOMING_=false +R CMD check \ + --as-cran \ + ./*.tar.gz diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..fdb6eba --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,15 @@ +--- +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: monthly + groups: + ci-dependencies: + patterns: + - "*" + commit-message: + prefix: "[ci]" + labels: + - maintenance diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 274ee75..b229337 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,80 +9,117 @@ on: - main jobs: - test: - name: ${{ matrix.task }} (ES ${{ matrix.es_version }}) + lint: + name: lint runs-on: ubuntu-latest - timeout-minutes: 60 - strategy: - fail-fast: false - matrix: - include: - #---# - # R # - #---# - - task: rpkg - es_version: 1.7.6 - - task: rpkg - es_version: 2.4.6 - - task: rpkg - es_version: 5.6.16 - - task: rpkg - es_version: 6.0.1 - - task: rpkg - es_version: 6.8.15 - - task: rpkg - es_version: 7.1.1 - - task: rpkg - es_version: 7.2.1 - - task: rpkg - es_version: 7.3.2 - - task: rpkg - es_version: 7.4.2 - - task: rpkg - es_version: 7.5.2 - - task: rpkg - es_version: 7.6.2 - - task: rpkg - es_version: 7.7.1 - - task: rpkg - es_version: 7.8.1 - - task: rpkg - es_version: 7.9.3 - - task: rpkg - es_version: 7.10.2 - - task: rpkg - es_version: 7.11.2 - - task: rpkg - es_version: 7.12.1 steps: - - name: checkout repository - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 1 - - name: set up R - if: matrix.task == 'rpkg' - uses: r-lib/actions/setup-r@v2 + - uses: pre-commit/action@v3.0.1 + - uses: r-lib/actions/setup-r@v2 with: - r-version: release - - name: set up pandoc - if: matrix.task == 'rpkg' - uses: r-lib/actions/setup-pandoc@v2 - - name: run tests - shell: bash + r-version: r-devel + - name: lint R code run: | - export CONDA_DIR=${HOME}/miniconda3 - export ES_VERSION=${{ matrix.es_version }} - export PATH=${CONDA_DIR}/bin:${HOME}/.local/bin:$PATH - export TASK="${{ matrix.task }}" - $GITHUB_WORKSPACE/.ci/setup.sh - $GITHUB_WORKSPACE/.ci/install.sh - $GITHUB_WORKSPACE/setup_local.sh ${{ matrix.es_version }} - $GITHUB_WORKSPACE/.ci/test.sh - $GITHUB_WORKSPACE/.ci/report_to_covr.sh - # https://github.community/t/is-it-possible-to-require-all-github-actions-tasks-to-pass-without-enumerating-them/117957/4?u=graingert - all-successful: + Rscript -e "install.packages('lintr')" + Rscript ./.ci/lint_r_code.R $(pwd) + build: + name: build runs-on: ubuntu-latest - needs: [test] steps: - - name: Note that all tests succeeded - run: echo "🎉" + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + - uses: r-lib/actions/setup-r@v2 + with: + r-version: r-devel + - uses: r-lib/actions/setup-pandoc@v2 + - name: build package + run: | + sh ./.ci/build-package.sh + mkdir -p ./artifacts + mv ./uptasticsearch*.tar.gz ./artifacts + - name: upload + uses: actions/upload-artifact@v4 + with: + name: r-package + path: ./artifacts + if-no-files-found: error + # test: + # name: ${{ matrix.task }} (ES ${{ matrix.es_version }}) + # runs-on: ubuntu-latest + # timeout-minutes: 60 + # strategy: + # fail-fast: false + # matrix: + # include: + # #---# + # # R # + # #---# + # - task: rpkg + # es_version: 1.7.6 + # - task: rpkg + # es_version: 2.4.6 + # - task: rpkg + # es_version: 5.6.16 + # - task: rpkg + # es_version: 6.0.1 + # - task: rpkg + # es_version: 6.8.15 + # - task: rpkg + # es_version: 7.1.1 + # - task: rpkg + # es_version: 7.2.1 + # - task: rpkg + # es_version: 7.3.2 + # - task: rpkg + # es_version: 7.4.2 + # - task: rpkg + # es_version: 7.5.2 + # - task: rpkg + # es_version: 7.6.2 + # - task: rpkg + # es_version: 7.7.1 + # - task: rpkg + # es_version: 7.8.1 + # - task: rpkg + # es_version: 7.9.3 + # - task: rpkg + # es_version: 7.10.2 + # - task: rpkg + # es_version: 7.11.2 + # - task: rpkg + # es_version: 7.12.1 + # steps: + # - name: checkout repository + # uses: actions/checkout@v2 + # with: + # fetch-depth: 1 + # - name: set up R + # if: matrix.task == 'rpkg' + # uses: r-lib/actions/setup-r@v2 + # with: + # r-version: release + # - name: set up pandoc + # if: matrix.task == 'rpkg' + # uses: r-lib/actions/setup-pandoc@v2 + # - name: run tests + # shell: bash + # run: | + # export CONDA_DIR=${HOME}/miniconda3 + # export ES_VERSION=${{ matrix.es_version }} + # export PATH=${CONDA_DIR}/bin:${HOME}/.local/bin:$PATH + # export TASK="${{ matrix.task }}" + # $GITHUB_WORKSPACE/.ci/setup.sh + # $GITHUB_WORKSPACE/.ci/install.sh + # $GITHUB_WORKSPACE/setup_local.sh ${{ matrix.es_version }} + # $GITHUB_WORKSPACE/.ci/test.sh + # $GITHUB_WORKSPACE/.ci/report_to_covr.sh + # # https://github.community/t/is-it-possible-to-require-all-github-actions-tasks-to-pass-without-enumerating-them/117957/4?u=graingert + # all-successful: + # runs-on: ubuntu-latest + # needs: [test] + # steps: + # - name: Note that all tests succeeded + # run: echo "🎉" From 0b16ca1097a0300c7bb87458e221fc1fb46d7239 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 11 Jan 2025 23:26:16 -0600 Subject: [PATCH 2/8] devel --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b229337..e3043f4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: fetch-depth: 1 - uses: r-lib/actions/setup-r@v2 with: - r-version: r-devel + r-version: devel - uses: r-lib/actions/setup-pandoc@v2 - name: build package run: | From 7ee874d8a71f397c919dfa749ccda7021300c2ab Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 11 Jan 2025 23:29:35 -0600 Subject: [PATCH 3/8] make executable --- .ci/build-package.sh | 0 .github/workflows/ci.yml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 .ci/build-package.sh diff --git a/.ci/build-package.sh b/.ci/build-package.sh old mode 100644 new mode 100755 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e3043f4..a906f33 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,7 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 - name: build package run: | - sh ./.ci/build-package.sh + ./.ci/build-package.sh mkdir -p ./artifacts mv ./uptasticsearch*.tar.gz ./artifacts - name: upload From 62562f9f329d128c8ee7a6b0c2bd6e67df8e44f6 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 11 Jan 2025 23:32:11 -0600 Subject: [PATCH 4/8] beep boop --- .ci/build-package.sh | 4 ++-- .github/workflows/ci.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.ci/build-package.sh b/.ci/build-package.sh index a10baeb..e68a0b1 100755 --- a/.ci/build-package.sh +++ b/.ci/build-package.sh @@ -3,8 +3,8 @@ # failure is a natural part of life set -e -u -o pipefail -apt-get update -apt-get install \ +sudo apt-get update +sudo apt-get install \ --no-install-recommends \ -y \ curl \ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a906f33..590d6e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: - uses: pre-commit/action@v3.0.1 - uses: r-lib/actions/setup-r@v2 with: - r-version: r-devel + r-version: devel - name: lint R code run: | Rscript -e "install.packages('lintr')" From 5f54b66cbf7dafaa1a270905b3f5f9d9ea64fb19 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 12 Jan 2025 01:09:01 -0600 Subject: [PATCH 5/8] better logs, install build deps --- .ci/lint_r_code.R | 2 ++ .github/workflows/ci.yml | 1 + 2 files changed, 3 insertions(+) diff --git a/.ci/lint_r_code.R b/.ci/lint_r_code.R index 2c42670..8202b7e 100755 --- a/.ci/lint_r_code.R +++ b/.ci/lint_r_code.R @@ -106,4 +106,6 @@ if (issues_found > 0L) { print(results) } +print("Done linting R code") + quit(save = "no", status = issues_found) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 590d6e0..5556ffc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,6 +37,7 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 - name: build package run: | + Rscript -e "install.packages(c('rmarkdown', 'knitr'), repos = 'https://cran.r-project.org')" ./.ci/build-package.sh mkdir -p ./artifacts mv ./uptasticsearch*.tar.gz ./artifacts From 62e036196de019dfed7712aa77601bbfc4bce0af Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 12 Jan 2025 01:40:40 -0600 Subject: [PATCH 6/8] install all deps --- .ci/install-deps.R | 15 +++++++++++++++ .github/workflows/ci.yml | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 .ci/install-deps.R diff --git a/.ci/install-deps.R b/.ci/install-deps.R new file mode 100644 index 0000000..80a3dde --- /dev/null +++ b/.ci/install-deps.R @@ -0,0 +1,15 @@ +install.packages( # nolint: undesirable_function + pkgs = c( + "assertthat" + , "data.table" + , "futile.logger" + , "httr" + , "knitr" + , "purrr" + , "rmarkdown" + , "stringr" + , "uuid" + ) + , repos = "https://cran.r-project.org" + , Ncpus = 2 +) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5556ffc..a5fa26b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,7 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 - name: build package run: | - Rscript -e "install.packages(c('rmarkdown', 'knitr'), repos = 'https://cran.r-project.org')" + Rscript ./.ci/install-deps.R ./.ci/build-package.sh mkdir -p ./artifacts mv ./uptasticsearch*.tar.gz ./artifacts From ef9aca8661e7ac9906aae097ff5f5a5d34248f65 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 12 Jan 2025 01:48:16 -0600 Subject: [PATCH 7/8] use r-release --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a5fa26b..f8f4837 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: - uses: pre-commit/action@v3.0.1 - uses: r-lib/actions/setup-r@v2 with: - r-version: devel + r-version: release - name: lint R code run: | Rscript -e "install.packages('lintr')" @@ -33,7 +33,7 @@ jobs: fetch-depth: 1 - uses: r-lib/actions/setup-r@v2 with: - r-version: devel + r-version: release - uses: r-lib/actions/setup-pandoc@v2 - name: build package run: | From 4b9182143266d4ee13e811607a82da41dad14bc8 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sun, 12 Jan 2025 02:02:01 -0600 Subject: [PATCH 8/8] fix builds of curl --- .ci/install-build-deps.R | 15 +++++++++++++++ .ci/setup.sh | 3 --- .ci/test.sh | 2 ++ .github/workflows/ci.yml | 3 ++- 4 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 .ci/install-build-deps.R diff --git a/.ci/install-build-deps.R b/.ci/install-build-deps.R new file mode 100644 index 0000000..80a3dde --- /dev/null +++ b/.ci/install-build-deps.R @@ -0,0 +1,15 @@ +install.packages( # nolint: undesirable_function + pkgs = c( + "assertthat" + , "data.table" + , "futile.logger" + , "httr" + , "knitr" + , "purrr" + , "rmarkdown" + , "stringr" + , "uuid" + ) + , repos = "https://cran.r-project.org" + , Ncpus = 2 +) diff --git a/.ci/setup.sh b/.ci/setup.sh index 5545676..ebf2a7e 100755 --- a/.ci/setup.sh +++ b/.ci/setup.sh @@ -17,6 +17,3 @@ sudo apt-get install \ texlive-fonts-recommended \ texlive-fonts-extra \ qpdf - -Rscript -e "install.packages(c('assertthat', 'covr', 'data.table', 'futile.logger', 'httr', 'jsonlite', 'knitr', 'lintr', 'purrr', 'rmarkdown', 'stringr', 'testthat', 'uuid'), repos = 'https://cran.r-project.org', Ncpus = parallel::detectCores())" -cp test-data/* r-pkg/inst/testdata/ diff --git a/.ci/test.sh b/.ci/test.sh index fbeb506..654137d 100755 --- a/.ci/test.sh +++ b/.ci/test.sh @@ -3,6 +3,8 @@ # failure is a natural part of life set -e -u -o pipefail +cp -R test-data/* r-pkg/inst/testdata/ + R CMD build ./r-pkg export _R_CHECK_CRAN_INCOMING_=false R CMD check \ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f8f4837..caaed12 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,8 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 - name: build package run: | - Rscript ./.ci/install-deps.R + ./.ci/setup.sh + Rscript ./.ci/install-build-deps.R ./.ci/build-package.sh mkdir -p ./artifacts mv ./uptasticsearch*.tar.gz ./artifacts