Improved tests.yml #120
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: tests | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
types: [ opened, synchronize, reopened, edited ] | |
jobs: | |
tests: | |
name: tests | |
runs-on: self-hosted | |
steps: | |
- name: Ensure workspace ownership | |
run: echo "chown -R $USER $GITHUB_WORKSPACE" && sudo chown -R $USER $GITHUB_WORKSPACE | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Start builder container | |
run: sudo docker rm -f infinity_build && sudo docker run -d --name infinity_build --network=host -v $PWD:/infinity infiniflow/infinity_build:0.1 | |
- name: Build debug version | |
run: sudo docker exec infinity_build bash -c "cd /infinity && rm -fr cmake-build-debug && mkdir -p cmake-build-debug && cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -S /infinity -B /infinity/cmake-build-debug && cmake --build /infinity/cmake-build-debug" | |
- name: Install pysdk | |
run: sudo docker exec infinity_build bash -c "cd /infinity/python && python3 setup.py install" | |
- name: Start infinity debug version | |
run: | | |
# Run a command in the background | |
sudo docker exec infinity_build bash -c "cd /infinity/ && rm -fr /tmp/infinity && cmake-build-debug/src/infinity > debug.log 2>&1" & | |
# Save its process ID to a file for later use | |
echo $! > background_process_pid.txt | |
- name: pysdk & sqllogictest debug version | |
run: sudo docker exec infinity_build bash -c "cd /infinity/ && python3 tools/sqllogictest.py" | |
- name: Collect infinity debug output and stop it | |
run: cat debug.log && sudo kill $(cat background_process_pid.txt) && rm -f background_process_pid.txt | |
if: always() # always run this step even if previous steps failed | |
- name: Build release version | |
run: sudo docker exec infinity_build bash -c "cd /infinity && rm -fr cmake-build-release && mkdir -p cmake-build-release && cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -S /infinity -B /infinity/cmake-build-release && cmake --build /infinity/cmake-build-release" | |
- name: Start infinity release version | |
run: | | |
sudo docker exec infinity_build bash -c "cd /infinity/ &&rm -fr /tmp/infinity && cmake-build-release/src/infinity > release.log 2>&1" & | |
echo $! > background_process_pid.txt | |
- name: pysdk & sqllogictest release version | |
run: sudo docker exec infinity_build bash -c "cd /infinity/ && python3 tools/sqllogictest.py" | |
- name: Collect infinity release output and stop it | |
run: cat release.log && sudo kill $(cat background_process_pid.txt) && rm -f background_process_pid.txt | |
if: always() # always run this step even if previous steps failed |