MSUStudentWork/.github/workflows/compile-and-test.yml
2024-12-21 20:43:50 +03:00

61 lines
1.3 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
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" > input.txt
echo "$file" >> input.txt
# Запускаем программу
./a.out < input.txt
if [ $? -ne 0 ]; then
echo "::error::Test failed for $file"
exit 1
fi
done