Add Required v1
API Features With Tests & CI
#8
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: CMake Build and Test | |
on: | |
push: # Trigger on any push to any branch | |
pull_request: # Trigger on any PR | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the repository | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Set up dependencies | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y cmake gcc g++ ninja-build libcurl4-openssl-dev pkg-config | |
# Configure the build | |
- name: Configure with CMake | |
run: | | |
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release | |
# Build the project | |
- name: Build the project | |
run: | | |
ninja -C build | |
# Create temporary directory for logs | |
- name: Create temporary directory | |
run: | | |
export TMP=$(mktemp -d) | |
echo "Temporary directory created at $TMP" | |
echo "TMP=$TMP" >> $GITHUB_ENV | |
# Run tests | |
- name: Run tests | |
run: | | |
./build/bin/reai_test | |
# Output logs from the temporary directory | |
- name: Display logs | |
run: | | |
echo "Logs from $TMP:" | |
ls "$TMP" | |
cat "$TMP"/* || echo "No log files found" |