-
Notifications
You must be signed in to change notification settings - Fork 1
37 lines (35 loc) · 1.36 KB
/
mergesort_gtest.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: mergesort-gtest
# 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/**'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Cache gtest library
uses: actions/cache@v2
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: Check out the code
uses: actions/checkout@v2
- name: Compile test code
run: g++ -Wall -g -o mergesort_test mergesort.c mergesort_test.cpp -lgtest -pthread -std=c++0x
working-directory: mergesort
- name: Run test
run: ./mergesort_test
working-directory: mergesort