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