Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: test

on: [push]

jobs:
test:
name: Unit tests
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2

- name: Test via build
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile_unittests
push: false

37 changes: 37 additions & 0 deletions Dockerfile_unittests
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM rocker/r-ver:latest

LABEL org.opencontainers.image.authors="us@couchbits.com"
LABEL org.opencontainers.image.vendor="couchbits GmbH"

ENV PROJECT_DIR=/moveapps-r-sdk
ENV RENV_PATHS_CACHE=/renv/cache

RUN apt-get update && apt-get install -y \
libcurl4-openssl-dev \
libssl-dev \
libxml2-dev \
libudunits2-dev \
libgdal-dev

# Create the project directory
RUN mkdir -p $PROJECT_DIR

# Set the working directory
WORKDIR $PROJECT_DIR

# Copy necessary files
COPY renv.lock ./
COPY sdk.R ./
COPY src/ ./src/
COPY data/ ./data/
COPY tests/ ./tests/
COPY RFunction.R ./

# Install renv and restore packages
RUN R -e 'install.packages("renv")' && \
R -e 'renv::consent(provided = TRUE); renv::restore()' && \
R -e 'renv::clean()'

# Run tests
RUN R -e 'install.packages("testthat")' && \
R -e 'testthat::test_dir("tests")'
1 change: 1 addition & 0 deletions tests/testthat.R
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
library(testthat)
1 change: 0 additions & 1 deletion tests/testthat/testthat.R

This file was deleted.