Skip to content

Commit

Permalink
update test_all conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge committed Feb 13, 2025
1 parent c1664e5 commit e7c95eb
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 31 deletions.
35 changes: 21 additions & 14 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
# 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
branches: [main, master]
pull_request:
branches:
- main

name: test-coverage
name: test-coverage.yaml

jobs:
permissions: read-all

jobs:
test-coverage:

runs-on: ubuntu-latest

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
Expand All @@ -27,28 +24,38 @@ jobs:

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr
extra-packages: any::covr, any::xml2
needs: coverage

- name: Test coverage
run: |
covr::codecov(
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
covr::to_cobertura(cov)
shell: Rscript {0}

- uses: codecov/codecov-action@v4
with:
# Fail if error if not on PR, or if on PR and token is given
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
file: ./cobertura.xml
plugin: noop
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: gtfsrouter
Title: Routing with 'GTFS' (General Transit Feed Specification) Data
Version: 0.1.3.001
Version: 0.1.3.002
Authors@R: c(
person("Mark", "Padgham", , "mark.padgham@email.com", role = c("aut", "cre")),
person("Marcin", "Stepniak", , "marcinstepniak@ucm.es", role = "aut",
Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"codeRepository": "https://github.com/UrbanAnalyst/gtfsrouter",
"issueTracker": "https://github.com/UrbanAnalyst/gtfsrouter/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "0.1.3.001",
"version": "0.1.3.002",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-extract.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
context ("summary")

test_all <- (identical (Sys.getenv ("MPADGE_LOCAL"), "true") |
identical (Sys.getenv ("GITHUB_WORKFLOW"), "test-coverage"))
test_all <- (identical (Sys.getenv ("MPADGE_LOCAL"), "true") ||
identical (Sys.getenv ("GITHUB_JOB"), "test-coverage"))

nthr <- data.table::setDTthreads (1L)

Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-go-home.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ context ("go home")

nthr <- data.table::setDTthreads (1L)

test_all <- (identical (Sys.getenv ("MPADGE_LOCAL"), "true") |
identical (Sys.getenv ("GITHUB_WORKFLOW"), "test-coverage"))
test_all <- (identical (Sys.getenv ("MPADGE_LOCAL"), "true") ||
identical (Sys.getenv ("GITHUB_JOB"), "test-coverage"))

test_that ("go home set up", {
if (Sys.getenv ("gtfs_home") == "" |
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-route.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ context ("route")

nthr <- data.table::setDTthreads (1L)

test_all <- (identical (Sys.getenv ("MPADGE_LOCAL"), "true") |
identical (Sys.getenv ("GITHUB_WORKFLOW"), "test-coverage"))
test_all <- (identical (Sys.getenv ("MPADGE_LOCAL"), "true") ||
identical (Sys.getenv ("GITHUB_JOB"), "test-coverage"))

test_that ("extract", {
expect_error (
Expand Down
3 changes: 0 additions & 3 deletions tests/testthat/test-time-formats.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
context ("time formats")

test_all <- (identical (Sys.getenv ("MPADGE_LOCAL"), "true") |
identical (Sys.getenv ("GITHUB_WORKFLOW"), "test-coverage"))

nthr <- data.table::setDTthreads (1L)

test_that ("convert-time", {
Expand Down
3 changes: 0 additions & 3 deletions tests/testthat/test-transfers.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ context ("transfers")

nthr <- data.table::setDTthreads (1L)

test_all <- (identical (Sys.getenv ("MPADGE_LOCAL"), "true") |
identical (Sys.getenv ("GITHUB_WORKFLOW"), "test-coverage"))

test_that ("transfers works", {
berlin_gtfs_to_zip ()
f <- fs::path (fs::path_temp (), "vbb.zip")
Expand Down
3 changes: 0 additions & 3 deletions tests/testthat/test-traveltimes.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ context ("traveltimes")

nthr <- data.table::setDTthreads (1L)

test_all <- (identical (Sys.getenv ("MPADGE_LOCAL"), "true") |
identical (Sys.getenv ("GITHUB_WORKFLOW"), "test-coverage"))

berlin_gtfs_to_zip ()
f <- fs::path (fs::path_temp (), "vbb.zip")
g <- extract_gtfs (f, quiet = TRUE)
Expand Down

0 comments on commit e7c95eb

Please sign in to comment.