Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
msperlin committed Jun 3, 2024
1 parent 651c14b commit a0a57df
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 2 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# 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:
branches: [main, master]

name: test-coverage

permissions: read-all

jobs:
test-coverage:
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

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

- name: Test coverage
run: |
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
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_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
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
shell: bash

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Package: eodhd2
Type: Package
Title: Second and backward-incompatible version of R package for eodhd API
Title: Second and backward-incompatible version of R package eodhd
Version: 0.5.0
Author: Who wrote it
Maintainer: Marcelo S. Perlin <marceloperlin@gmail.com>
Description: Allows for access to EODHD api directly within an R session, also ofering data handling functinos for financial data.
Description: Allows for access to the eodhd data repository <https://eodhd.com/>
directly within an R session, also offering data handling functios for financial data.
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Expand Down
10 changes: 10 additions & 0 deletions tests/testthat/test-statuscode.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
test_that("status codes", {

flag <- parse_status_code(200)

expect_true(flag)
expect_error(parse_status_code(400))
expect_error(parse_status_code(403))


})

0 comments on commit a0a57df

Please sign in to comment.