MSUStudentWork/.github/workflows/compile-and-test.yml

57 lines
No EOL
1.2 KiB
YAML

name: Compile and Test on Linux
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Make `makefile.sh` executable
run: |
chmod +x makefile.sh
- name: Run `makefile.sh` to prepare Makefile
run: |
./makefile.sh delete
if [ $? -ne 0 ]; then
echo "::error::makefile.sh failed"
exit 1
fi
- name: Compile using Makefile
run: |
cd ComputationalGeometry/6Ex
make
if [ $? -ne 0 ]; then
echo "::error::Compilation failed"
exit 1
fi
- name: Run Tests
run: |
cd ComputationalGeometry/6Ex
if [ ! -f "./a.out" ]; then
echo "::error::Executable not found: a.out"
exit 1
fi
for file in t/*; do
echo "Testing with file: $file"
# Создаём файл ввода
(echo "0"; echo "$file") | ./a.out
if [ $? -ne 0 ]; then
echo "::error::Test failed for $file"
exit 1
fi
done