ci: add lint and cppcheck #9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: build-hello-world | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| build-hello-world: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: install g++ | |
| run: sudo apt install -y g++ cppcheck | |
| - name: run cppcheck | |
| run: | | |
| cppcheck hello_world.cpp --output-file=report.txt | |
| if [ -s report.txt ]; then # if file is not empty | |
| cat report.txt | |
| exit 1 # let github action fails | |
| fi | |
| - name: check build | |
| run: | | |
| g++ hello_world.cpp -o hello_world | |
| ./hello_world |