From 9e07dd91cd1272a6a3812f3d97e953bc730f13a3 Mon Sep 17 00:00:00 2001 From: Cheng Ho Ming Date: Wed, 27 Mar 2024 16:38:51 +0800 Subject: [PATCH] CI/CD: clang-format and make draft Use Github actions to automatically test compile and check code formatting for every pull requests and pushes. Signed-off-by: Cheng Ho Ming --- .github/workflows/clang-format.yml | 13 +++++++++++++ .github/workflows/make.yml | 23 +++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 .github/workflows/clang-format.yml create mode 100644 .github/workflows/make.yml diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml new file mode 100644 index 00000000..9e90b0b9 --- /dev/null +++ b/.github/workflows/clang-format.yml @@ -0,0 +1,13 @@ +name: clang-format + +on: [push, pull_request] + +jobs: + cpp-formatting-check: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + - uses: actions/checkout@v3 + - name: Run clang-format + run: | + clang-format --dry-run -style=google $(find . -name '*.cpp' -or -name '*.h') diff --git a/.github/workflows/make.yml b/.github/workflows/make.yml new file mode 100644 index 00000000..a95a4475 --- /dev/null +++ b/.github/workflows/make.yml @@ -0,0 +1,23 @@ +name: Make + +on: [push, pull_request] + +jobs: + Make: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Make + run: | + make clean + make + - name: Upload executable + uses: actions/upload-artifact@v4 + with: + # suppose we compiled our game and named it 'stocksim' + name: stocksim + path: stocksim + compression-level: 9 + retention-days: 90 + if-no-files-found: error