| 1 |
name: Continuous Integration |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: [ "master" ] |
| 6 |
pull_request: |
| 7 |
branches: [ "master" ] |
| 8 |
|
| 9 |
env: |
| 10 |
|
| 11 |
BUILD_TYPE: Release |
| 12 |
CFLAGS: -fsanitize=address |
| 13 |
CXXFLAGS: -fsanitize=address |
| 14 |
|
| 15 |
jobs: |
| 16 |
build: |
| 17 |
strategy: |
| 18 |
matrix: |
| 19 |
os: [ubuntu-latest, macos-latest] |
| 20 |
runs-on: ${{ matrix.os }} |
| 21 |
|
| 22 |
steps: |
| 23 |
- uses: actions/checkout@v3 |
| 24 |
with: |
| 25 |
submodules: 'true' |
| 26 |
|
| 27 |
- name: Install dependencies for Ubuntu |
| 28 |
run: | |
| 29 |
sudo apt-get update |
| 30 |
sudo apt-get install --yes help2man qtbase5-dev qttools5-dev qttools5-dev-tools libchewing3-dev lcov libgtest-dev |
| 31 |
gcc --version |
| 32 |
g++ --version |
| 33 |
gcov --version |
| 34 |
if: ${{ matrix.os == 'ubuntu-latest' }} |
| 35 |
|
| 36 |
- name: Install dependencies for macOS |
| 37 |
run: | |
| 38 |
# dependencies |
| 39 |
brew update |
| 40 |
brew install libchewing qt@5 googletest |
| 41 |
|
| 42 |
# Allow CMake to find qt@5 by passing down the environment variable |
| 43 |
echo "CMAKE_PREFIX_PATH=$(brew --prefix qt@5)" >> $GITHUB_ENV |
| 44 |
if: ${{ matrix.os == 'macos-latest' }} |
| 45 |
|
| 46 |
- name: Configure CMake |
| 47 |
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DENABLE_GCOV=yes |
| 48 |
|
| 49 |
- name: Show config |
| 50 |
run: cmake -B ${{github.workspace}}/build -LA |
| 51 |
|
| 52 |
- name: Build |
| 53 |
run: cmake --build ${{github.workspace}}/build -v --config ${{env.BUILD_TYPE}} |
| 54 |
|
| 55 |
- name: Test |
| 56 |
working-directory: ${{github.workspace}}/build |
| 57 |
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure |
| 58 |
|
| 59 |
- name: Collect coverage stats |
| 60 |
run: scripts/lcov.sh |
| 61 |
if: ${{ matrix.os == 'ubuntu-latest' }} |
| 62 |
|
| 63 |
- name: Coveralls |
| 64 |
uses: coverallsapp/[email protected] |
| 65 |
with: |
| 66 |
github-token: ${{ secrets.GITHUB_TOKEN }} |
| 67 |
path-to-lcov: coverage.info |
| 68 |
if: ${{ matrix.os == 'ubuntu-latest' }} |