File tree Expand file tree Collapse file tree 1 file changed +60
-0
lines changed Expand file tree Collapse file tree 1 file changed +60
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Unit Tests 
2+ 
3+ on :
4+   pull_request :
5+     #  Only run workflow if a file in these paths are modified
6+     paths :
7+       - " .github/workflows/unit-tests.yml" 
8+       - " test/**" 
9+       - " api/**" 
10+ 
11+   push :
12+     paths :
13+       - " .github/workflows/unit-tests.yml" 
14+       - " test/**" 
15+       - " api/**" 
16+ 
17+ jobs :
18+   test :
19+     name : Run unit tests 
20+     runs-on : ubuntu-latest 
21+ 
22+     env :
23+       BUILD_PATH : ${{ github.workspace }}/test/build 
24+ 
25+     steps :
26+       - name : Checkout repository 
27+         uses : actions/checkout@v2 
28+ 
29+       - name : Install valgrind 
30+         run : sudo apt-get --assume-yes install valgrind 
31+ 
32+       - name : Run unit tests 
33+         run : | 
34+           mkdir "$BUILD_PATH" 
35+           cd "$BUILD_PATH" 
36+           # Generate makefile 
37+           cmake .. 
38+           # Compile tests 
39+           make 
40+           # Run tests and check for memory leaks 
41+           valgrind --leak-check=yes --error-exitcode=1 bin/test-ArduinoCore-API 
42+ 
43+ name : Install lcov 
44+         run : sudo apt-get --assume-yes install lcov 
45+ 
46+       - name : Report code coverage 
47+         run : | 
48+           cd "$BUILD_PATH" 
49+           lcov --directory . --capture --output-file coverage.info 
50+           # Remove external files from coverage data 
51+           lcov --quiet --remove coverage.info '*/test/*' '/usr/*' --output-file coverage.info 
52+           # Print coverage report in the workflow log 
53+           lcov --list coverage.info 
54+ 
55+ #  See: https://github.com/codecov/codecov-action/blob/master/README.md
56+       - name : Upload coverage report to Codecov 
57+         uses : codecov/codecov-action@v1 
58+         with :
59+           file : ${{ env.BUILD_PATH }}/coverage.info 
60+           fail_ci_if_error : true 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments