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
29 changes: 29 additions & 0 deletions .github/workflows/docker-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
on:
push:
paths:
- 'docker/**'

name: docker

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
with:
context: ./docker
push: true
tags: fabriziosandri/rcppdeepstate:latest
9 changes: 2 additions & 7 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,9 @@ runs:
using: "composite"
steps:

- uses: actions/checkout@v2
with:
repository: FabrizioSandri/RcppDeepState-action
path: RcppDeepState-action

- name: Analyze the package with RcppDeepState
id: rcppdeepstate
uses: ./RcppDeepState-action/docker
uses: docker://fabriziosandri/rcppdeepstate:latest
with:
fail_ci_if_error: ${{ inputs.fail_ci_if_error }}
location: ${{ inputs.location }}
Expand Down Expand Up @@ -89,7 +84,7 @@ runs:
// Find the comment generated by RcppDeepState-action
const comment_identifier = "<!-- RcppDeepState-action comment-->"
const action_comment = comments.find(comment => comment.body.includes(comment_identifier))
const new_comment_body = `${comment_identifier}\n## RcppDeepState Report\n${report}`
const new_comment_body = `${comment_identifier}\n${report}`

if (action_comment) {
await github.rest.issues.updateComment({
Expand Down
4 changes: 4 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ FROM ubuntu:latest
# setup zoneinfo
RUN ln -snf /usr/share/zoneinfo/$INPUT_ZONEINFO /etc/localtime && echo $INPUT_ZONEINFO > /etc/timezone

### Dependencies installation
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 \
libfontconfig1-dev libharfbuzz-dev libfribidi-dev \
libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev r-base

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

# Copy the files to the root filesystem of the container
COPY src/entrypoint.sh /entrypoint.sh
COPY src/analyze_package.R /analyze_package.R
Expand Down
35 changes: 21 additions & 14 deletions docker/src/analyze_package.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ report_file <- file.path(GitHub_workspace, "report.md")
errors <- sapply(result$logtable, getErrors)
status <- 0

rcppdeepstate_repo <- "https://github.com/FabrizioSandri/RcppDeepState"
title <- paste0("## [RcppDeepState](", rcppdeepstate_repo, ") Report")
write(title, report_file)


# print all the errors and return a proper exit status code
if (any(errors)) {
print(result)
Expand Down Expand Up @@ -129,7 +134,7 @@ if (any(errors)) {
report_table <- rbind(report_table, new_row)
}

write(knitr::kable(report_table), report_file)
write(knitr::kable(report_table), report_file, append=TRUE)

if (fail_ci_if_error == "true") {
status <- 1
Expand All @@ -138,19 +143,21 @@ if (any(errors)) {
output_errors <- paste0("echo ::set-output name=errors::false")
system(output_errors, intern = FALSE)

# get all the analyzed functions name
analyzed_functions <- unlist(lapply(result$binaryfile, getFunctionName))
analyzed_table <- cbind(data.table(func=analyzed_functions),result)
colnames(analyzed_table)[1] <- "function_name"

# this table contains for each function analyzed, the number of inputs tested
count_inputs <- analyzed_table[,.N, by=function_name]
colnames(count_inputs)[2] <- "tested_inputs"

no_error_message <- paste("No error has been reported by RcppDeepState",
"### Analyzed functions summary", sep="\n")
write(no_error_message, report_file)
write(knitr::kable(count_inputs), report_file, append=TRUE)
no_error_message <- "No error has been reported by RcppDeepState"
write(no_error_message, report_file, append=TRUE)
}

# print the summary table: this table contains for each function analyzed, the
# number of inputs tested
analyzed_functions <- unlist(lapply(result$binaryfile, getFunctionName))
analyzed_table <- cbind(data.table(func=analyzed_functions),result)
colnames(analyzed_table)[1] <- "function_name"

count_inputs <- analyzed_table[,.N, by=function_name]
colnames(count_inputs)[2] <- "tested_inputs"

summary_header <- "### Analyzed functions summary"
write(summary_header, report_file, append=TRUE)
write(knitr::kable(count_inputs), report_file, append=TRUE)

quit(status=status) # return an error code
10 changes: 3 additions & 7 deletions docker/src/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/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
Expand All @@ -17,10 +13,10 @@ retVal=$?
echo "RcppDeepState analysis completed"

# remove vgcore files and adjust permissions
find . -name 'vgcore*' | xargs rm
find "$GITHUB_WORKSPACE/$INPUT_LOCATION/inst/testfiles" -maxdepth 2 -name 'vgcore*' | xargs rm

find "$GITHUB_WORKSPACE/$INPUT_LOCATION/inst/testfiles" -type d -exec chmod 755 {} \;
find "$GITHUB_WORKSPACE/$INPUT_LOCATION/inst/testfiles" -type f -exec chmod 644 {} \;
find "$GITHUB_WORKSPACE/$INPUT_LOCATION/inst/testfiles" -type d | xargs chmod 755;
find "$GITHUB_WORKSPACE/$INPUT_LOCATION/inst/testfiles" -type f | xargs chmod 644;

# return the exit status to the action
exit $retVal