From cb55e785c4a41764dd10b93b87c85f401eb5ae66 Mon Sep 17 00:00:00 2001 From: Shamy <110725453+shamykyzer@users.noreply.github.com> Date: Wed, 2 Jul 2025 08:43:27 +0300 Subject: [PATCH] Refine CI workflow and document container-based steps --- .github/workflows/c-cpp.yml | 74 ++++++++++++++++++++++++++++++++----- .gitignore | 2 + README.md | 9 +++++ 3 files changed, 76 insertions(+), 9 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 69a4793..75d5164 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -7,17 +7,73 @@ on: branches: [ "main" ] jobs: + install-dependencies: + name: Installing Dependencies + runs-on: ubuntu-latest + container: ghcr.io/gravity-sim/deps:latest + steps: + - uses: actions/checkout@v4 + - name: Cache build artifacts + uses: actions/cache@v3 + with: + path: | + src/*.o + tests/*.o + key: ${{ runner.os }}-build-${{ hashFiles('**/*.c') }} + restore-keys: ${{ runner.os }}-build- + - name: Setup complete + run: echo "Dependencies are pre-installed in the container" + build: + name: Build + runs-on: ubuntu-latest + needs: install-dependencies + container: ghcr.io/gravity-sim/deps:latest + steps: + - uses: actions/checkout@v4 + - name: Restore build cache + uses: actions/cache@v3 + with: + path: | + src/*.o + tests/*.o + key: ${{ runner.os }}-build-${{ hashFiles('**/*.c') }} + restore-keys: ${{ runner.os }}-build- + - name: Build + run: make + test: + name: Test runs-on: ubuntu-latest + needs: build + container: ghcr.io/gravity-sim/deps:latest + steps: + - uses: actions/checkout@v4 + - name: Restore build cache + uses: actions/cache@v3 + with: + path: | + src/*.o + tests/*.o + key: ${{ runner.os }}-build-${{ hashFiles('**/*.c') }} + restore-keys: ${{ runner.os }}-build- + - name: Test + run: make test + make: + name: Make + runs-on: ubuntu-latest + needs: test + container: ghcr.io/gravity-sim/deps:latest steps: - - uses: actions/checkout@v4 - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y build-essential libgl1-mesa-dev libglew-dev libglfw3-dev libopenmpi-dev - - name: Build - run: make - - name: Test - run: make test + - uses: actions/checkout@v4 + - name: Restore build cache + uses: actions/cache@v3 + with: + path: | + src/*.o + tests/*.o + key: ${{ runner.os }}-build-${{ hashFiles('**/*.c') }} + restore-keys: ${{ runner.os }}-build- + - name: Make + run: make diff --git a/.gitignore b/.gitignore index 392d5f9..1cf7a02 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ obj/ # Object files *.o src/*.o +gravity-simulation/ +tests/test_quadtree diff --git a/README.md b/README.md index e52a7bc..5370b9c 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ This project is a continuation of fluid simulation concepts, extended to simulat - [Installation](#installation) - [Build](#build) - [Usage](#usage) +- [Continuous Integration](#continuous-integration) - [Project Layout](#project-layout) - [Acknowledgments](#acknowledgments) - [License](#license) @@ -74,6 +75,14 @@ To set up and compile the project on your local machine, follow these steps: ./gravity_simulation ``` +## Continuous Integration + +This project uses a GitHub Actions workflow that runs inside a prebuilt Docker +container containing all required OpenGL dependencies. The workflow consists of +four sequential jobs: **Installing Dependencies**, **Build**, **Test**, and +**Make**. Compiled object files are cached between jobs to speed up subsequent +steps. + ## Usage To run the simulation: