Merge pull request #15 from UMM-CSci-Systems/update-workflows #14
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: mergesort-test-valgrind | |
| # The `workflow_dispatch` lets us manually trigger this action | |
| # through the GitHub web interface. See | |
| # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch | |
| # for more details. | |
| on: | |
| push: | |
| paths: | |
| - 'mergesort/**' | |
| - '.github/workflows/mergesort_gtest.yml' | |
| - '.github/workflows/mergesort_test_valgrind.yml' | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Cache gtest library | |
| uses: actions/cache@v4 | |
| env: | |
| cache-name: cache-gtest-lib | |
| with: | |
| key: $${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('/usr/local/lib/libgtest.a') }} | |
| path: /usr/local/lib/libgtest.a | |
| restore-keys: | | |
| ${{ runner.os }}-build-${{ env.cache-name }}- | |
| ${{ runner.os }}-build- | |
| ${{ runner.os }}- | |
| - name: Install gtest manually | |
| run: sudo apt-get install libgtest-dev && cd /usr/src/gtest && sudo cmake CMakeLists.txt && sudo make && sudo cp lib/*.a /usr/lib && sudo ln -s /usr/lib/libgtest.a /usr/local/lib/libgtest.a && sudo ln -s /usr/lib/libgtest_main.a /usr/local/lib/libgtest_main.a | |
| - name: Install valgrind | |
| run: sudo apt-get install -y valgrind | |
| - name: Check out the code | |
| uses: actions/checkout@v2 | |
| - name: Compile code | |
| run: g++ -Wall -g -o mergesort_test mergesort.c mergesort_test.cpp -lgtest -pthread -std=c++14 | |
| working-directory: mergesort | |
| - name: Run test | |
| run: valgrind -v --leak-check=full --show-leak-kinds=all --error-exitcode=1 ./mergesort_test | |
| working-directory: mergesort |