Skip to content

REFACTORING: TCP flow #1903

REFACTORING: TCP flow

REFACTORING: TCP flow #1903

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: |
python3 -m venv venv
./venv/bin/pip install "clang-format==19.1.3"
- name: Check Clang format
run:
./venv/bin/clang-format --version
./venv/bin/clang-format --dry-run -Werror $(git ls-files 'source/*.cpp' 'source/*.hpp' 'test/*.cpp' 'test/*.hpp')
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:
- name: Apt update
run: sudo apt update
- name: Install dependencies
run: |
sudo apt install --fix-missing gnuplot
sudo apt install --fix-missing graphviz
pip install graphviz
- uses: actions/checkout@v4
- 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}}
check-generators:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: Download nons executable
uses: actions/download-artifact@v4
with:
name: build-artifact
- name: Add executable flag
run: chmod +x ${{env.EXECUTABLE_NAME}}
- name: Update PYTHONPOATH
run: echo "PYTHONPATH=${{ github.workspace }}/scripts" >> $GITHUB_ENV
- name: Check generators in script directory
run: python3 scripts/check_generators.py -g scripts/generators/ -e ./${{env.EXECUTABLE_NAME}}