-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (83 loc) · 3.21 KB
/
cli.yml
File metadata and controls
107 lines (83 loc) · 3.21 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Rust Mockery CLI + Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
EXAMPLE_BUILD_TYPE: Release
jobs:
configure-example:
name: Configure example
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Configure example CMake
run: >
cmake -S ${{github.workspace}}/example
-B ${{github.workspace}}/example/build
-DCMAKE_BUILD_TYPE=${{env.EXAMPLE_BUILD_TYPE}}
-DBUILD_TESTING=OFF
- name: Upload example compilation database
uses: actions/upload-artifact@v2
with:
name: compile_commands.json
path: ${{github.workspace}}/example/build/compile_commands.json
cargo-build-and-test:
name: Cargo build & test & run
needs: configure-example
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install libclang
run: sudo apt install -y libclang-dev
- name: Build Cargo project
run: cargo build --release --verbose
- name: Run unit tests
run: cargo test --release --verbose -- --test-threads=1
- name: Download example compilation database
uses: actions/download-artifact@v2
with:
name: compile_commands.json
path: ${{github.workspace}}/example/build
- name: Generate mock class definition for example
run: cargo run --release -- create ${{github.workspace}}/example/src/project/Project.cpp -i ProjectStorage | tee ${{github.workspace}}/example/test/ProjectStorageMock.h
- name: Upload mock class definition for example
uses: actions/upload-artifact@v2
with:
name: ProjectStorageMock.h
path: ${{github.workspace}}/example/test/ProjectStorageMock.h
build-and-test-example:
name: Build & test example project
needs: cargo-build-and-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get Conan
uses: turtlebrowser/get-conan@v1.0
- name: Create default Conan profile
run: conan profile new default --detect
- name: Update Conan profile
run: |
conan profile update settings.build_type=${{env.EXAMPLE_BUILD_TYPE}} default
conan profile update settings.compiler.cppstd=17 default
conan profile update settings.compiler.libcxx=libstdc++11 default
- name: Install dependencies
run: conan install example --build=missing --install-folder=${{github.workspace}}/example/build
- name: Download mock class definition for example
uses: actions/download-artifact@v2
with:
name: ProjectStorageMock.h
path: ${{github.workspace}}/example/test
- name: Configure example CMake
run: >
cmake -S ${{github.workspace}}/example
-B ${{github.workspace}}/example/build
-DCMAKE_BUILD_TYPE=${{env.EXAMPLE_BUILD_TYPE}}
-DBUILD_TESTING=ON
- name: Build example
run: cmake --build ${{github.workspace}}/example/build
- name: Run example tests
working-directory: ${{github.workspace}}/example/build
run: ctest -C ${{env.EXAMPLE_BUILD_TYPE}}