diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 16f7ff6..17727fb 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -7,7 +7,7 @@ on: branches: [ "master" ] jobs: - build: + validate: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -15,22 +15,8 @@ jobs: with: java-version: '17' distribution: 'temurin' - - name: Pull c2eo Docker image - run: | - mkdir out - docker pull yegor256/c2eo:0.1.24 - - name: Copy c2o.cooperators - run: bash copy.sh - - name: Run c2eo Docker image - run: docker run -v $(pwd):/eo yegor256/c2eo:0.1.24 examples/div-by-zero.c out/global.eo - - name: Check out/global.eo - run: cat out/global.eo - - name: Removing goto - run: bash dejump.sh - - name: Start Polystat Check - run: bash polystat.sh - - name: Check polystat-eo-out.txt - run: cat polystat-eo-out.txt + - name: Validate + run: bash examples/run.sh examples/div-by-zero.c - name: Upload results as artifact uses: actions/upload-artifact@v3 with: diff --git a/copy.sh b/copy.sh deleted file mode 100644 index 8b7a503..0000000 --- a/copy.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -mkdir out/c2eo -git clone "https://github.com/polystat/c2eo.git" --branch master -cp -r c2eo/project/eo-lib out/c2eo diff --git a/dejump.sh b/dejump.sh deleted file mode 100644 index e6d1f78..0000000 --- a/dejump.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -# Download Dejump jar file -curl -L -o dejump-0.0.2-jar-with-dependencies.jar "https://repo1.maven.org/maven2/org/eolang/dejump/0.0.2/dejump-0.0.2-jar-with-dependencies.jar" -echo "Dejump jar was downloaded" -java -jar dejump-0.0.2-jar-with-dependencies.jar --eo out/global.eo -echo "GOTO was removed, check the result: " -cat out/generated/global_transformed.eo -echo "Rename file" -mv out/generated/global_transformed.eo out/generated/global.eo \ No newline at end of file diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000..b5bbb2d --- /dev/null +++ b/examples/README.md @@ -0,0 +1,21 @@ + + +[![EO principles respected here](https://www.elegantobjects.org/badge.svg)](https://www.elegantobjects.org) +[![DevOps By Rultor.com](http://www.rultor.com/b/polystat/far)](http://www.rultor.com/p/polystat/far) +[![We recommend IntelliJ IDEA](https://www.elegantobjects.org/intellij-idea.svg)](https://www.jetbrains.com/idea/) + +[![CI checks](https://github.com/polystat/far/actions/workflows/mvn.yml/badge.svg)](https://github.com/polystat/far/actions/workflows/mvn.yml) +[![PDD status](http://www.0pdd.com/svg?name=polystat/far)](http://www.0pdd.com/p?name=polystat/far) +[![codecov](https://codecov.io/gh/polystat/far/branch/master/graph/badge.svg)](https://codecov.io/gh/polystat/far) + +[![Javadoc](http://www.javadoc.io/badge/org.polystat/far.svg)](http://www.javadoc.io/doc/org.polystat/far) +[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/polystat/far/blob/master/LICENSE.txt) +[![Maven Central](https://img.shields.io/maven-central/v/org.polystat/far.svg)](https://maven-badges.herokuapp.com/maven-central/org.polystat/far) +[![Hits-of-Code](https://hitsofcode.com/github/polystat/far)](https://hitsofcode.com/view/github/polystat/far) +![Lines of code](https://img.shields.io/tokei/lines/github/polystat/far) + +To start validating C/C++ file and checking it for division by zero error, just do: +```shell +bash run.sh {your C/C++ file path} +``` + diff --git a/examples/run.sh b/examples/run.sh new file mode 100644 index 0000000..b61126c --- /dev/null +++ b/examples/run.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +file=$1 + +echo "Pull c2eo Docker image" +mkdir out +docker pull yegor256/c2eo:0.1.24 +echo "Finished pulling" + +echo "Run c2eo Docker image" +docker run -v $(pwd):/eo yegor256/c2eo:0.1.24 $file out/global.eo +echo "Finished running" + +echo "Check out/global.eo" +ls -la out +cat out/global.eo +echo "Finished cheking" + +echo "Copy c2o.cooperators" +mkdir out/c2eo +git clone "https://github.com/polystat/c2eo.git" --branch master +cp -r c2eo/project/eo-lib out/c2eo +echo "Finished copy" + +echo "Removing goto" +# Download Dejump jar file +curl -L -o dejump-0.0.2-jar-with-dependencies.jar "https://repo1.maven.org/maven2/org/eolang/dejump/0.0.2/dejump-0.0.2-jar-with-dependencies.jar" +echo "Dejump jar was downloaded" +java -jar dejump-0.0.2-jar-with-dependencies.jar --eo out/global.eo +echo "GOTO was removed, check the result: " +cat out/generated/global_transformed.eo +echo "Rename file" +mv out/generated/global_transformed.eo out/generated/global.eo +echo "Finished Removing" + +echo "Run Polystat Jar" +# Run Polystat (EO) and save reports to "results" folder +curl -L -o polystat.jar "https://github.com/polystat/polystat-cli/releases/download/v0.1.11/polystat.jar" +echo "Polystat (EO) analysis has started" +touch polystat-eo-out.txt +java -jar polystat.jar eo --in out/generated --to file=polystat-eo-out.txt --sarif +echo "Polystat (EO) analysis has finished"o polystat.jar "https://github.com/polystat/polystat-cli/releases/download/v0.1.11/polystat.jar" +echo "Finished running" + +echo "Check polystat-eo-out.txt" +cat polystat-eo-out.txt diff --git a/polystat.sh b/polystat.sh deleted file mode 100644 index 7101acc..0000000 --- a/polystat.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -# Run Polystat (EO) and save reports to "results" folder -curl -L -o polystat.jar "https://github.com/polystat/polystat-cli/releases/download/v0.1.11/polystat.jar" -echo "Polystat (EO) analysis has started" -touch polystat-eo-out.txt -java -jar polystat.jar eo --in out --to file=polystat-eo-out.txt --sarif -echo "Polystat (EO) analysis has finished"o polystat.jar "https://github.com/polystat/polystat-cli/releases/download/v0.1.11/polystat.jar" \ No newline at end of file