-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Github Actions to automatically build on every push
- Loading branch information
Showing
2 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Build and Test | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build-and-test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
compiler: [gcc, clang] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Cache directories | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache | ||
key: ${{ runner.os }}-cache | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install lcov | ||
- name: Create build directory | ||
run: mkdir build | ||
|
||
- name: Configure CMake | ||
run: | | ||
cd build | ||
cmake .. -DCODE_COVERAGE=ON -DEXAMPLES=OFF | ||
- name: Build and test | ||
run: | | ||
cd build | ||
make | ||
make test | ||
- name: Collect code coverage | ||
run: | | ||
lcov --directory . --capture --output-file coverage.info | ||
lcov --remove coverage.info '/usr/*' "${HOME}"'/.cache/*' --output-file coverage.info | ||
lcov --list coverage.info | ||
- name: Upload code coverage to Codecov | ||
run: | | ||
bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports" | ||
- name: Upload code coverage to GitHub | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: coverage | ||
path: coverage.info |
This file contains 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