Skip to content
Merged
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
27 changes: 27 additions & 0 deletions .github/workflows/action-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
on:
push:
branches: [initial-prototype]
pull_request:
branches: [initial-prototype]

name: RcppDeepState

jobs:
RcppDeepState:
runs-on: ubuntu-latest

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

steps:
- uses: actions/checkout@v2

- uses: actions/checkout@v2 # checkout 'FabrizioSandri/RcppDeepState' containing the 'testSAN' package
with:
repository: FabrizioSandri/RcppDeepState
path: RcppDeepState

- name: Analyze the package with RcppDeepState # run RccpDeepState on 'testSAN'
uses: ./
with:
location: /RcppDeepState/inst/testpkgs/testSAN
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM ubuntu:latest

# setup zoneinfo
RUN ln -snf /usr/share/zoneinfo/$INPUT_ZONEINFO /etc/localtime && echo $INPUT_ZONEINFO > /etc/timezone

RUN apt update
RUN apt install -y build-essential gcc-multilib g++-multilib cmake python3-setuptools python3-dev libffi-dev clang valgrind libcurl4-gnutls-dev libxml2-dev libssl-dev wget
RUN apt install -y r-base

# Copy the files to the root filesystem of the container
COPY src/entrypoint.sh /entrypoint.sh
COPY src/analyze_package.R /analyze_package.R
RUN chmod +x /entrypoint.sh

# Executes `entrypoint.sh` when the Docker container starts up
ENTRYPOINT ["/entrypoint.sh"]
35 changes: 33 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,39 @@ RcppDeepState is a fuzz testing library made as a composition of three tools: Rc
* Link to [RcppDeepState](https://github.com/FabrizioSandri/RcppDeepState)

## Inputs

- **location** (default value: `/`) - Relative path under `$GITHUB_WORKSPACE` that contains the package that needs to be analyzed. Default uses the `/` location relative to `$GITHUB_WORKSPACE`, that is `$GITHUB_WORKSPACE`.

## Outputs

## Example usage
## Usage
Before running this GitHub Action it's mandatory to run the [actions/checkout](https://github.com/actions/checkout) Action to check-out the repository containing the Rcpp package that needs to be analyzed. Remember that you must specify the parameter `location` for this action if you use the `path` argument for `actions/checkout` or if the package that has to be analyzed isn't located in the root of the repository, otherwise RcppDeepState won't be able to find your package.

```yaml
- uses: actions/checkout@v2

- uses: FabrizioSandri/RcppDeepState-action
with:
# Relative path under $GITHUB_WORKSPACE where the package that needs to be
# analyzed is located.
# Default: /
location: ''
```

#### Basic example
This simple workflow can be run inside a repository containing a Rcpp-based package, stored in the root of the repository.
```yaml
- uses: actions/checkout@v2

- uses: FabrizioSandri/RcppDeepState-action
```

#### Custom path example
Assume the package you wish to test is not at the repository's root, but rather, for instance, in the `/inst/testpkgs/testSAN` subdirectory. In this case, the package can be analyzed specifying the `location` parameter.

```yaml
- uses: actions/checkout@v2

- uses: FabrizioSandri/RcppDeepState-action
with:
location: '/inst/testpkgs/testSAN'
```
13 changes: 13 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: 'RcppDeepState'
author: 'Fabrizio Sandri'
description: 'This Action runs RcppDeepState in any Rcpp-based projects hosted on GitHub'
inputs:
location:
description: 'Location of the package if not in the root of the repository'
required: false
default: '/'
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.location }}
10 changes: 10 additions & 0 deletions src/analyze_package.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
require(RcppDeepState)

GitHub_workspace <- Sys.getenv("GITHUB_WORKSPACE")
location <- Sys.getenv("INPUT_LOCATION")

deepstate_harness_compile_run(file.path(GitHub_workspace, location))
result <- deepstate_harness_analyze_pkg(file.path(GitHub_workspace, location))

print(result)
print(result$logtable)
16 changes: 16 additions & 0 deletions src/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

### Dependencies installation
Rscript -e 'install.packages("devtools", repos="https://cloud.r-project.org")'
Rscript -e 'devtools::install_github("FabrizioSandri/RcppDeepState")'

# disable optimization options
mkdir -p ~/.R
echo -e "CXXFLAGS = \nCXX11FLAGS = \nCXX14FLAGS = \nCXX17FLAGS = \nCXX20FLAGS = \n" > ~/.R/Makevars

### Start the analysis
echo "RcppDeepState analysis started"

Rscript "/analyze_package.R"

echo "RcppDeepState analysis completed"