Skip to content

Commit

Permalink
Opprydning i github actions (#161)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
arnfinn authored Jun 5, 2024
1 parent d4330ec commit 9beafef
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 276 deletions.
14 changes: 0 additions & 14 deletions .github/dependabot.yml

This file was deleted.

63 changes: 10 additions & 53 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ jobs:
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: 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
Expand Down Expand Up @@ -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")'
57 changes: 14 additions & 43 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
48 changes: 0 additions & 48 deletions .github/workflows/doc-consistency.yaml

This file was deleted.

43 changes: 10 additions & 33 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: false
62 changes: 32 additions & 30 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 9beafef

Please sign in to comment.