From 73f13e32179b40d18e59403e3dd8612bbf8e8911 Mon Sep 17 00:00:00 2001 From: arnfinn Date: Wed, 5 Jun 2024 15:16:21 +0200 Subject: [PATCH 1/3] Opprydning i github actions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fjernet ett par actions (doc-consistency, pr-commands og dependabot) Fjernet en del steg som sannsynligvis var unødvendig, og byttet ut manuelle steg med use: action. Sistnevnte gjaldt spesielt installasjon av avhengigheter. --- .github/dependabot.yml | 14 ------ .github/workflows/R-CMD-check.yaml | 65 +++++--------------------- .github/workflows/coverage.yaml | 57 ++++++---------------- .github/workflows/doc-consistency.yaml | 48 ------------------- .github/workflows/lint.yaml | 43 ++++------------- .github/workflows/pkgdown.yaml | 62 ++++++++++++------------ .github/workflows/pr-commands.yaml | 55 ---------------------- 7 files changed, 67 insertions(+), 277 deletions(-) delete mode 100644 .github/dependabot.yml delete mode 100644 .github/workflows/doc-consistency.yaml delete mode 100644 .github/workflows/pr-commands.yaml diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 37e56d97..00000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,14 +0,0 @@ -version: 2 -updates: - - # Maintain dependencies for docker - - package-ecosystem: "docker" - directory: "/" - schedule: - interval: "daily" - - # Maintain dependencies for GitHub Actions - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "daily" diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 36504217..c0990106 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -23,11 +23,11 @@ jobs: matrix: config: - {os: windows-latest, r: 'release'} - - {os: macOS-latest, r: 'release'} - - {os: ubuntu-20.04, r: 'release'} - - {os: ubuntu-20.04, r: 'devel'} - - {os: ubuntu-20.04, r: 'oldrel'} - - {os: ubuntu-20.04, r: '3.6'} + - {os: macos-latest, r: 'release'} + - {os: ubuntu-22.04, r: 'release'} + - {os: ubuntu-22.04, r: 'devel'} + - {os: ubuntu-22.04, r: 'oldrel'} + - {os: ubuntu-22.04, r: '3.6'} env: R_REMOTES_NO_ERRORS_FROM_WARNINGS: true @@ -62,56 +62,13 @@ jobs: run: | sudo /etc/init.d/mysql start - - name: Set up system fonts, macOS only - if: runner.os == 'macOS' - run: brew install --cask xquartz - - - name: Query dependencies - run: | - install.packages('remotes') - saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) - writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") - shell: Rscript {0} - - - name: Cache R packages - if: runner.os != 'Windows' - uses: actions/cache@v3 + - uses: r-lib/actions/setup-r-dependencies@v2 with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- - - - name: Install system dependencies - if: runner.os == 'Linux' - run: | - while read -r cmd - do - eval sudo $cmd - done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') - - - name: Session info - run: | - options(width = 100) - pkgs <- installed.packages()[, "Package"] - install.packages("sessioninfo") - sessioninfo::session_info(pkgs, include_base = TRUE) - shell: Rscript {0} - - - name: Install dependencies - run: | - remotes::install_deps(dependencies = TRUE) - remotes::install_cran("rcmdcheck") - shell: Rscript {0} + extra-packages: any::rcmdcheck + needs: check - name: Check - env: - _R_CHECK_CRAN_INCOMING_REMOTE_: false - run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "error", check_dir = "check") - shell: Rscript {0} - - - name: Upload check results - if: failure() - uses: actions/upload-artifact@main + uses: r-lib/actions/check-r-package@v2 with: - name: ${{ runner.os }}-r${{ matrix.config.r }}-results - path: check + upload-snapshots: true + build_args: 'c("--no-manual", "--as-cran", "--compact-vignettes=gs+qpdf")' diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index bfe1c6e9..41d89fdd 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -2,72 +2,43 @@ on: push: branches: - master + - main pull_request: branches: - master + - main name: test-coverage jobs: test-coverage: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 env: GITHUB_PAT: ${{ secrets.GH_TOKEN }} GITHUB_ACTIONS_RUN_DB_UNIT_TESTS: true + DB_HOST: localhost + DB_USER: root + DB_PASS: root steps: - uses: actions/checkout@v4 - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::covr, any::xml2 + needs: coverage - uses: r-lib/actions/setup-pandoc@v2 - uses: r-lib/actions/setup-tinytex@v2 - - name: Db unit tests in ubuntu/linux only - if: runner.os != 'Windows' - run: | - if [[ ${{ runner.os }} == Linux ]]; then - echo "GITHUB_ACTIONS_RUN_DB_UNIT_TESTS=true" >> $GITHUB_ENV - echo "DB_HOST=localhost" >> $GITHUB_ENV - echo "DB_USER=root" >> $GITHUB_ENV - echo "DB_PASS=root" >> $GITHUB_ENV - else - echo "GITHUB_ACTIONS_RUN_DB_UNIT_TESTS=false" >> $GITHUB_ENV - fi - - - name: Set up MySQL, ubuntu only - if: runner.os == 'Linux' + - name: Set up MySQL run: | sudo /etc/init.d/mysql start - - name: Query dependencies - run: | - install.packages('remotes') - saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) - writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") - shell: Rscript {0} - - - name: Cache R packages - uses: actions/cache@v3 - with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- - - - name: Install system dependencies - run: | - while read -r cmd - do - eval sudo $cmd - done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') - - - name: Install dependencies - run: | - install.packages(c("remotes")) - remotes::install_deps(dependencies = TRUE) - remotes::install_cran("covr") - shell: Rscript {0} - - name: Test coverage run: covr::codecov() shell: Rscript {0} \ No newline at end of file diff --git a/.github/workflows/doc-consistency.yaml b/.github/workflows/doc-consistency.yaml deleted file mode 100644 index d144ff56..00000000 --- a/.github/workflows/doc-consistency.yaml +++ /dev/null @@ -1,48 +0,0 @@ -on: - pull_request: - branches: - - master - -name: doc-consistency - -jobs: - doc-consistency: - runs-on: macOS-latest - env: - GITHUB_PAT: ${{ secrets.GH_TOKEN }} - steps: - - uses: actions/checkout@v4 - - - uses: r-lib/actions/setup-r@v2 - - - uses: r-lib/actions/setup-pandoc@v2 - - - name: Query dependencies - run: | - install.packages('remotes') - saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) - writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") - shell: Rscript {0} - - - name: Cache R packages - uses: actions/cache@v3 - with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- - - - name: Install dependencies - run: | - remotes::install_deps(dependencies = TRUE) - install.packages(c("pkgdown", "test"), type = "binary") - shell: Rscript {0} - - - name: Install package - run: R CMD INSTALL . - - - name: Test function reference site doc consistency - run: | - git config --local user.email "actions@github.com" - git config --local user.name "GitHub Actions" - Rscript -e "pkgdown::init_site()" - Rscript -e "testthat::expect_warning(pkgdown::build_reference(preview = FALSE), regexp = NA)" diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 0ac8a821..34c978f1 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -12,49 +12,26 @@ name: lint jobs: lint: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 env: GITHUB_PAT: ${{ secrets.GH_TOKEN }} steps: - uses: actions/checkout@v4 - - name: Install unmet sys deps - run: | - sudo apt update - sudo apt install -y --no-install-recommends libcurl4-openssl-dev libgit2-dev libharfbuzz-dev libfribidi-dev - - uses: r-lib/actions/setup-r@v2 - - - name: Query dependencies - run: | - install.packages('remotes') - saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) - writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") - shell: Rscript {0} - - - name: Cache R packages - uses: actions/cache@v3 with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- + use-public-rspm: true - - name: Install system dependencies - run: | - while read -r cmd - do - eval sudo $cmd - done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') - - - name: Install dependencies - run: | - install.packages(c("remotes", "devtools")) - remotes::install_deps(dependencies = TRUE) - remotes::install_cran("lintr") - shell: Rscript {0} + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + cache-version: 2 + extra-packages: | + any::lintr + needs: lint - name: Lint run: | - devtools::load_all() lintr::lint_package() shell: Rscript {0} + env: + LINTR_ERROR_ON_LINT: true diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index d01ca91e..5ac0f6ae 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -1,47 +1,49 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples on: push: - branches: - - master + branches: [main, master] + pull_request: + branches: [main, master] + release: + types: [published] + workflow_dispatch: name: pkgdown +permissions: read-all + jobs: pkgdown: - runs-on: macOS-latest + runs-on: ubuntu-22.04 + # Only restrict concurrency for non-PR jobs + concurrency: + group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} env: - GITHUB_PAT: ${{ secrets.GH_TOKEN }} + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + permissions: + contents: write steps: - uses: actions/checkout@v4 - - uses: r-lib/actions/setup-r@v2 - - uses: r-lib/actions/setup-pandoc@v2 - - name: Query dependencies - run: | - install.packages('remotes') - saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) - writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") - shell: Rscript {0} + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true - - name: Cache R packages - uses: actions/cache@v3 + - uses: r-lib/actions/setup-r-dependencies@v2 with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- - - - name: Install dependencies - run: | - remotes::install_deps(dependencies = TRUE) - install.packages("pkgdown", type = "binary") - shell: Rscript {0} + extra-packages: any::pkgdown, local::. + needs: website - - name: Install package - run: R CMD INSTALL . + - name: Build site + run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) + shell: Rscript {0} - - name: Deploy package - run: | - git config --local user.email "actions@github.com" - git config --local user.name "GitHub Actions" - Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)' + - name: Deploy to GitHub pages 🚀 + if: github.event_name != 'pull_request' + uses: JamesIves/github-pages-deploy-action@v4.5.0 + with: + clean: false + branch: gh-pages + folder: docs \ No newline at end of file diff --git a/.github/workflows/pr-commands.yaml b/.github/workflows/pr-commands.yaml deleted file mode 100644 index 2d4fe66a..00000000 --- a/.github/workflows/pr-commands.yaml +++ /dev/null @@ -1,55 +0,0 @@ -on: - issue_comment: - types: [created] -name: Commands -jobs: - document: - if: startsWith(github.event.comment.body, '/document') - name: document - runs-on: ubuntu-20.04 - env: - GITHUB_PAT: ${{ secrets.GH_TOKEN }} - steps: - - uses: actions/checkout@v4 - - uses: r-lib/actions/pr-fetch@v2 - with: - repo-token: ${{ secrets.GH_TOKEN }} - - uses: r-lib/actions/setup-r@v2 - - name: Install dependencies - run: Rscript -e 'install.packages(c("remotes", "roxygen2"))' -e 'remotes::install_deps(dependencies = TRUE)' - - name: Document - run: Rscript -e 'roxygen2::roxygenise()' - - name: commit - run: | - git config --local user.email "actions@github.com" - git config --local user.name "GitHub Actions" - git add man/\* NAMESPACE - git commit -m 'Document' - - uses: r-lib/actions/pr-push@v2 - with: - repo-token: ${{ secrets.GH_TOKEN }} - style: - if: startsWith(github.event.comment.body, '/style') - name: style - runs-on: macOS-latest - env: - GITHUB_PAT: ${{ secrets.GH_TOKEN }} - steps: - - uses: actions/checkout@v4 - - uses: r-lib/actions/pr-fetch@v2 - with: - repo-token: ${{ secrets.GH_TOKEN }} - - uses: r-lib/actions/setup-r@v2 - - name: Install dependencies - run: Rscript -e 'install.packages("styler")' - - name: Style - run: Rscript -e 'styler::style_pkg()' - - name: commit - run: | - git config --local user.email "actions@github.com" - git config --local user.name "GitHub Actions" - git add \*.R - git commit -m 'Style' - - uses: r-lib/actions/pr-push@v2 - with: - repo-token: ${{ secrets.GH_TOKEN }} From 9914ac93231232c858f61bc23e6c8b61b35900b2 Mon Sep 17 00:00:00 2001 From: arnfinn Date: Wed, 5 Jun 2024 15:45:37 +0200 Subject: [PATCH 2/3] =?UTF-8?q?Fix=20for=20=C3=A5=20f=C3=A5=20ting=20gjenn?= =?UTF-8?q?om?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/R-CMD-check.yaml | 4 ++-- .github/workflows/lint.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index c0990106..b6a9ab17 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -23,11 +23,11 @@ jobs: matrix: config: - {os: windows-latest, r: 'release'} - - {os: macos-latest, r: 'release'} + - {os: macOS-latest, r: 'release'} - {os: ubuntu-22.04, r: 'release'} - {os: ubuntu-22.04, r: 'devel'} - {os: ubuntu-22.04, r: 'oldrel'} - - {os: ubuntu-22.04, r: '3.6'} + - {os: ubuntu-20.04, r: '3.6'} env: R_REMOTES_NO_ERRORS_FROM_WARNINGS: true diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 34c978f1..bcaa45a9 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -34,4 +34,4 @@ jobs: lintr::lint_package() shell: Rscript {0} env: - LINTR_ERROR_ON_LINT: true + LINTR_ERROR_ON_LINT: false From 5cc4776719ab369fa500dc93052dd58355bf765d Mon Sep 17 00:00:00 2001 From: arnfinn Date: Wed, 5 Jun 2024 16:00:50 +0200 Subject: [PATCH 3/3] =?UTF-8?q?fra=2020.04=20til=2022.04=20for=20r=203.6?= =?UTF-8?q?=20ogs=C3=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/R-CMD-check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index b6a9ab17..3a0b8889 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -27,7 +27,7 @@ jobs: - {os: ubuntu-22.04, r: 'release'} - {os: ubuntu-22.04, r: 'devel'} - {os: ubuntu-22.04, r: 'oldrel'} - - {os: ubuntu-20.04, r: '3.6'} + - {os: ubuntu-22.04, r: '3.6'} env: R_REMOTES_NO_ERRORS_FROM_WARNINGS: true