-
Notifications
You must be signed in to change notification settings - Fork 2
134 lines (132 loc) · 4.73 KB
/
fdp_cpp_api.yaml
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: FDP C++ API
on: [push, workflow_dispatch]
jobs:
Build_Ubuntu:
name: Build Ubuntu
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.9"
architecture: "x64"
- name: Install graphviz
run: |
sudo apt-get install graphviz
- name: Install local registry
run: curl -fsSL https://data.scrc.uk/static/localregistry.sh | /bin/bash -s -- -b main
- name: Checkout FAIRDataPipeline/FAIR-CLI
uses: actions/checkout@v3
with:
repository: FAIRDataPipeline/FAIR-CLI
path: FAIR-CLI
- name: Move FAIR-CLI
run: mv FAIR-CLI ../FAIR-CLI
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install and initialise FAIR CLI
run: |
cd ../FAIR-CLI
poetry install
source .venv/bin/activate
cd ${{ github.workspace }}
fair init --ci
fair registry start
- name: Install Dependencies
run: |
sudo apt update
sudo apt install -y lcov curl libcurl4-openssl-dev libyaml-cpp-dev gcovr
- name: Configure Library
run: |
cmake -Bbuild -DFDPAPI_BUILD_TESTS=ON -DFDPAPI_CODE_COVERAGE=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=install
- name: Fetch cache
uses: actions/cache@v3
with:
path: sonarCache
key: ${{ runner.os }}-sonarCache-${{ github.sha }}
restore-keys: ${{ runner.os }}-sonarCache-
- name: Prepare Sonar scanner
run: |
wget -nv https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.0.2311-linux.zip
unzip -q sonar-scanner-cli-4.6.0.2311-linux.zip
echo "${PWD}/sonar-scanner-4.6.0.2311-linux/bin/" >> $GITHUB_PATH
wget -nv https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
unzip -q build-wrapper-linux-x86.zip
echo "${PWD}/build-wrapper-linux-x86" >> $GITHUB_PATH
- name: Build and Run Unit Tests
run: |
build-wrapper-linux-x86-64 --out-dir bw-outputs cmake --build build --target coverage
if [ $? -eq 0 ]; then
echo "Unit tests completed successfully"
exit 0
else
echo "Unit tests failed"
exit 1
fi
env:
CIBuild: 1
BUILD_TESTS: True
- name: SonarCloud Scan
run: |
sonar-scanner -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN -X
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Build from Install
run: |
cmake --build build --target install
cmake -B build_from_install -DFDPAPI_BUILD_TESTS=ON -DFDPAPI_CODE_COVERAGE=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=install -DFDPAPI_NEVER_FETCH=ON
cmake --build build_from_install
build-wrapper-linux-x86-64 --out-dir bw-outputs cmake --build build --target coverage
if [ $? -eq 0 ]; then
echo "Unit tests completed successfully"
exit 0
else
echo "Unit tests failed"
exit 1
fi
Build_MacOS:
name: Build MacOS
runs-on: macOS-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Install Dependencies
run: |
brew install cmake
brew install curl
- name: Configure Library
run: |
cmake -Bbuild -DFDPAPI_BUILD_TESTS=ON -DCMAKE_INSTALL_PREFIX=install
- name: Build Library
run: |
cmake --build build
- name: Build from Install
run: |
cmake --build build --target install
cmake -B build_from_install -DFDPAPI_BUILD_TESTS=ON -DCMAKE_INSTALL_PREFIX=install -DFDPAPI_NEVER_FETCH=ON
cmake --build build_from_install
Build_Windows:
name: Build Windows
runs-on: windows-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: ilammy/msvc-dev-cmd@v1
- name: Configure Library
run: |
cmake -Bbuild -DFDPAPI_BUILD_TESTS=ON -DCMAKE_INSTALL_PREFIX=install
- name: Compile FDP-Cpp-API
run: cmake --build build --config=Release
- name: Build from Install
run: |
cmake --build build --config=Release --target install
cmake -B build_from_install -DFDPAPI_BUILD_TESTS=ON -DCMAKE_INSTALL_PREFIX=install -DFDPAPI_NEVER_FETCH=ON
cmake --build build_from_install --config=Release