Skip to content

FEAT: fix topology generator #1244

FEAT: fix topology generator

FEAT: fix topology generator #1244

name: Build and run project
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "*" ]
env:
EXECUTABLE_NAME: nons
TEST_EXECUTABLE_NAME: test_nons
METRICS_ARTIFACT_DIR: metrics
jobs:
clang-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Clang Format
run: sudo apt-get install clang-format
- name: Collect files for Clang
run:
files_for_clang="
main.cpp
$(
find source -type f -name "*.cpp" -o -name "*.hpp";
find test -type f -name "*.cpp" -o -name "*.hpp"
)"
- name: Clang format
run:
clang-format --dry-run -Werror $files_for_clang
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update submodules
run: git submodule update --init --recursive
- name: Configure CMake for building project
run: cmake -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_PROJECT=ON -DBUILD_TESTS=OFF
- name: Build project
run: cmake --build build --config Debug -j $(nproc)
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: build-artifact
path: build/**
run-simulations:
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Apt update
run: sudo apt update
- name: Install gnuplot
run: sudo apt install --fix-missing gnuplot
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: build-artifact
- name: Add executable flag
run: chmod +x ${{env.EXECUTABLE_NAME}}
- name: Run simulation
run: python3 scripts/run_simulations.py -e ./${{env.EXECUTABLE_NAME}} -c configuration_examples/simulation_examples --output-dir ./${{env.METRICS_ARTIFACT_DIR}}
- name: Create html
run: python3 scripts/generate-html.py ./metrics
- name: Upload metrics
uses: actions/upload-artifact@v4
with:
name: metrics
path: ${{env.METRICS_ARTIFACT_DIR}}/**
- name: Put github context to json file
run: echo '${{ toJson(github) }}' > github_context.json
- name: Calculate deploy destination dir
run: |
DEPLOY_DIR=$(python3 scripts/calculate_deploy_dir.py -c github_context.json);
echo "DEPLOY_DIR=${DEPLOY_DIR}/${{env.METRICS_ARTIFACT_DIR}}" >> $GITHUB_ENV;
- name: Deploy to GitHub Pages
if: ${{env.DEPLOY_DIR}} != ''
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{env.METRICS_ARTIFACT_DIR}}
destination_dir: ${{env.DEPLOY_DIR}}
- name: Wait for artifacts to be available
run:
python3 scripts/check_artifacts.py -u 'https://cloud-storage-team.github.io/algnet/${{env.DEPLOY_DIR}}'
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update submodules
run: git submodule update --init --recursive
- name: Configure CMake for building tests
run: cmake -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBUILD_PROJECT=OFF -DBUILD_TESTS=ON
- name: Build tests
run: cmake --build build --config Debug -j $(nproc)
- name: Run tests
working-directory: build
run: ./${{env.TEST_EXECUTABLE_NAME}}