Skip to content

Commit

Permalink
Maintenance/package update (#125)
Browse files Browse the repository at this point in the history
* Updating packages and fixing cookies link to not conflict with master cookies info

* Adding acceptable GBP symbol encoding

* Updating shinytests to be in line with bslib value boxes

* Update lintr

* Added CHROMOTE_HEADLESS=new to automated tests workflow

* Lintr workflow behaving weirdly, so re-initialised it using usethis::use_github_action

* Switching to lint_dir in workflow script from lint_package

* Adding necessary environment in lintr workflow

* Cleaned up beta banner
  • Loading branch information
rmbielby authored Feb 4, 2025
1 parent aed4abe commit b48665b
Show file tree
Hide file tree
Showing 14 changed files with 153 additions and 177 deletions.
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
^renv$
^renv\.lock$
^\.github$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
3 changes: 3 additions & 0 deletions .github/workflows/automated-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ jobs:
- uses: r-lib/actions/setup-renv@v2

- name: Set Chromote to new headless mode
run: export CHROMOTE_HEADLESS="new"

- name: Run tests
shell: Rscript {0}
run: |
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:

name: lint.yaml

permissions: read-all

jobs:
lint:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- name: Install git2r dependencies
run: sudo apt-get install -y libgit2-dev

- name: Install proj library (terra depdencies)
run: sudo apt-get install libproj-dev

- name: Install gdal library (terra dependencies)
run: sudo apt-get install libgdal-dev

- name: Install udunits library (units dependencies)
run: sudo apt-get install libudunits2-dev

- name: Cache renv packages
id: cache-renv
uses: actions/cache@v4
with:
path: cache-renv
key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
restore-keys: |
${{ runner.os }}-renv-
- uses: r-lib/actions/setup-renv@v2

- name: Restore renv snapshot
shell: Rscript {0}
run: |
if (!requireNamespace("lintr", quietly = TRUE)) install.packages("lintr")
- name: Lint
run: lintr::lint_dir()
shell: Rscript {0}
env:
LINTR_ERROR_ON_LINT: true
56 changes: 0 additions & 56 deletions .github/workflows/lintr.yml

This file was deleted.

8 changes: 4 additions & 4 deletions R/plotting.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ create_avg_rev_timeseries <- function(df, input_area) {
aes(
tooltip = paste0(
"<p><b>", area_name, ", ", year, "</b></p>",
unlist(lapply(average_revenue_balance, pretty_num, prefix = "£")), "</p>"
unlist(lapply(average_revenue_balance, pretty_num, prefix = gbp)), "</p>"
)
),
size = 0.5
Expand All @@ -38,7 +38,7 @@ create_avg_rev_timeseries <- function(df, input_area) {
legend.position = "top"
) +
scale_y_continuous(
labels = scales::number_format(accuracy = 1, big = ",", prefix = "£")
labels = scales::number_format(accuracy = 1, big = ",", prefix = gbp)
) +
xlab("Academic year end") +
ylab(str_wrap("Average revenue balance", 16)) +
Expand All @@ -58,7 +58,7 @@ plot_avg_rev_benchmark <- function(df_revenue_balance, input_area) {
id = area_name,
tooltip = paste(
"<p><b>", area_name, "</b></p>",
unlist(lapply(average_revenue_balance, pretty_num, prefix = "£")), "</p>"
unlist(lapply(average_revenue_balance, pretty_num, prefix = gbp)), "</p>"
)
)) +
geom_col_interactive() +
Expand All @@ -74,7 +74,7 @@ plot_avg_rev_benchmark <- function(df_revenue_balance, input_area) {
legend.position = "none"
) +
scale_y_continuous(
labels = scales::number_format(accuracy = 1, big = ",", prefix = "£")
labels = scales::number_format(accuracy = 1, big = ",", prefix = gbp)
) +
xlab("Area") +
ylab(str_wrap("Average revenue balance", 12)) +
Expand Down
2 changes: 2 additions & 0 deletions global.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ source("R/read_data.R")
# Source custom functions script
source("R/helper_functions.R")

gbp <- enc2utf8("\u00A3")

# Source all files in the ui_panels folder
lapply(list.files("R/ui_panels/", full.names = TRUE), source)

Expand Down
Loading

0 comments on commit b48665b

Please sign in to comment.