From f859c563bbe7d88d02a3970321669f4c7104ab97 Mon Sep 17 00:00:00 2001 From: kwu130 <38401766+kwu130@users.noreply.github.com> Date: Wed, 1 Oct 2025 23:51:25 +0800 Subject: [PATCH] add run-all-problems.yml --- .github/workflows/run-all-problems.yml | 44 ++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/run-all-problems.yml diff --git a/.github/workflows/run-all-problems.yml b/.github/workflows/run-all-problems.yml new file mode 100644 index 0000000..0291abf --- /dev/null +++ b/.github/workflows/run-all-problems.yml @@ -0,0 +1,44 @@ +name: Build and Run All Problems + +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + build-and-run: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y cmake build-essential + + - name: Configure project + run: cmake -S . -B build + + - name: Build all + run: cmake --build build -- -j$(nproc) + + - name: Run all executables (stop on failure) + run: | + set -e + echo "Find and run all problems..." + + find build -type f -perm /111 | while read exe; do + if [[ "$(basename "$exe")" =~ ^[0-9]+- ]]; then + echo "▶️ Run: $exe" + if ! "$exe"; then + echo "❌ Failed: $exe" + exit 1 + fi + fi + done