Skip to content

Commit 066bad3

Browse files
authored
Update README.md
1 parent 464589f commit 066bad3

File tree

1 file changed

+51
-3
lines changed

1 file changed

+51
-3
lines changed

README.md

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,61 @@ Coderrect Scanner Github Action with HTML report output.
1313
Please find more information in our official website: [Coderrect.com](coderrect.com)
1414

1515
## Example Usage
16+
Take [memcached](https://github.com/funemy/memcached) as an example for integrating Coderrect.
17+
Check [here](https://github.com/funemy/memcached/blob/master/.github/workflows/ci.yml) for the final script.
18+
19+
In general, integrating Coderrect requires two steps:
20+
21+
1. Install all dependencies required to build your project:
22+
```
23+
- name: Install deps
24+
run: |
25+
sudo apt-get update -y
26+
sudo apt-get install -y libevent-dev libseccomp-dev git libsasl2-dev
27+
```
28+
29+
2. Apply Coderrect Github Action
30+
```
31+
- name: Coderrect Scan
32+
uses: coderrect-inc/coderrect-github-action@v0.4
33+
```
34+
35+
### For CMake projects
36+
You will need to install and setup cmake first.
37+
```
38+
- name: download cmake
39+
run: |
40+
wget https://cmake.org/files/v3.18/cmake-3.18.2-Linux-x86_64.tar.gz
41+
tar xf cmake-3.18.2-Linux-x86_64.tar.gz
42+
mkdir build && cd build
43+
../cmake-3.18.2-Linux-x86_64/bin/cmake ..
44+
```
45+
Since we are building the project under the `build` directory instead of the root path.
46+
We will also need to specify the build directory for Coderrect.
1647
```
1748
- name: Coderrect Scan
18-
uses: coderrect-inc/coderrect-github-action@v1.0
49+
uses: coderrect-inc/coderrect-github-action@v0.4
1950
with:
20-
buildCommand: make all -j 6
51+
buildPath: "build"
52+
```
53+
54+
### For Fortran projects
55+
You will need to install the fortran compiler first. For example:
56+
```
57+
- name: Install fortran
58+
run: |
59+
sudo apt-get update -y
60+
sudo apt-get install -y gfortran
2161
```
22-
Take a look at this [cmake project](https://github.com/coderrect-inc/CloverLeaf_OpenMP) and [fortran project](https://github.com/coderrect-inc/covid-sim ) to learn how to integrate Coderrect into more complex projects
62+
Then it is likely you need to specify the fortran compiler when you use `make`. If so, we should also pass the full compilation command to Coderrect. (`gcc` is pre-installed in the Github Action environment.)
63+
```
64+
- name: coderrect scan
65+
uses: coderrect-inc/coderrect-github-action@v0.4
66+
with:
67+
buildCommand: "make COMPILER=GNU MPI_COMPILER=gfortran C_MPI_COMPILER=gcc"
68+
```
69+
70+
For more details, take a look at this [cmake project](https://github.com/coderrect-inc/covid-sim) and [fortran project](https://github.com/coderrect-inc/CloverLeaf_OpenMP) to learn how to integrate Coderrect into more complex projects
2371

2472
## Inputs
2573
- `buildCommand`

0 commit comments

Comments
 (0)