Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
MLopez-Ibanez committed Nov 12, 2023
1 parent 640b270 commit d8379c2
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 5 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/c.yaml → .github/workflows/C.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
# .github/workflows/build.yaml
name: C
on:
push:
branches: [ main ]
paths:
- '.github/workflows/c.yaml'
- '.github/workflows/C.yml'
- 'src/**'

pull_request:
branches: [ main ]
paths:
- '.github/workflows/c.yaml'
- '.github/workflows/C.yml'
- 'src/**'

concurrency:
Expand All @@ -19,14 +18,15 @@ concurrency:

jobs:
build:
name: build
if: "! contains(github.event.head_commit.message, '[skip ci]')"
name: Build C code on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
#os: [windows-latest, macOS-latest, ubuntu-latest]
os: [macOS-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install GSL
if: runner.os == 'macOS'
run: brew install gsl
Expand Down
100 changes: 100 additions & 0 deletions .github/workflows/R.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: R

on:
push:
branches-ignore: [gh-pages]
paths:
- ".github/workflows/R.yml"
- "src/**"
- "R/**"
pull_request:
branches-ignore: [gh-pages]
paths:
- ".github/workflows/R.yml"
- "src/**"
- "R/**"

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
_R_CHECK_FORCE_SUGGESTS_: false
_R_CHECK_CRAN_INCOMING_REMOTE_: false

concurrency:
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
cancel-in-progress: true


jobs:
R-CMD-check:
if: "! contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ${{ matrix.config.os }}
name: Check ${{ matrix.config.os }} (${{ matrix.config.r }})
strategy:
fail-fast: false
matrix:
config:
- {os: windows-latest, r: 'release'}
- {os: macOS-latest, r: 'release'}
- {os: ubuntu-22.04, r: 'release'}
- {os: ubuntu-20.04, r: '3.6'}
# Use latest ubuntu to make it easier to install dependencies
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::remotes, any::rcmdcheck
needs: check
working-directory: 'R'

- name: Install macos dependencies
if: runner.os == 'macOS'
run: brew install gsl gawk automake

- name: Check (CRAN)
env:
NOT_CRAN: false
run: |
setwd("R/")
options(crayon.enabled = TRUE)
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check", timeout = 360)
shell: Rscript {0}

- name: Check (NOT CRAN)
if: success()
env:
NOT_CRAN: true
run: |
setwd("R/")
options(crayon.enabled = TRUE)
rcmdcheck::rcmdcheck(args = c("--no-manual", "--run-donttest", "--run-dontrun", "--timings"), error_on = "warning", check_dir = "check", timeout = 360)
shell: Rscript {0}

- name: Show testthat output
if: failure()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Install package
run: |
remotes::install_local("R", force = TRUE, upgrade = "never", build_manual = TRUE, build_vignettes = TRUE)
shell: Rscript {0}

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: R/check
21 changes: 21 additions & 0 deletions src/libutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,26 @@ void fatal_error(const char *format,...)
va_end(ap);
exit(EXIT_FAILURE);
}

void errprintf(const char *format,...)
{
va_list ap;
fprintf(stderr, "error: ");
va_start(ap,format);
vfprintf(stderr, format, ap);
va_end(ap);
fprintf(stderr, "\n");
}

void warnprintf(const char *format,...)
{
va_list ap;
fprintf(stderr, "warning: ");
va_start(ap,format);
vfprintf(stderr, format, ap);
va_end(ap);
fprintf(stderr, "\n");
}

#endif // R_PACKAGE

0 comments on commit d8379c2

Please sign in to comment.