Adds function to read token file in C #230
This file contains 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: 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 |