fix: moved unit test runner from docker to podman #112
This file contains hidden or 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: Relis unit test | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
relis_unit_testing: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Check if Podman is installed | |
run: | | |
if podman info; then | |
echo "Podman is installed in your repository." | |
else | |
echo "Podman is not installed, please install Podman in your Github Repository." | |
fi | |
- name: Install podman compose | |
run: pip3 install podman-compose | |
- name: Build Podman Image | |
run: podman-compose build | |
working-directory: deployment | |
- name: Run Podman Containers | |
run: podman-compose up -d | |
working-directory: deployment | |
- name: Wait for Application to Start | |
run: sleep 30 | |
- name: Set relis-app Container permission | |
run: | | |
podman exec relis-app chmod -R 777 /u/relis/public_html/relis_app/ | |
podman exec relis-app chmod -R 777 /u/relis/public_html/cside/export_r | |
- name: Run Unit test | |
run: | | |
response=$(php -r 'echo file_get_contents("http://localhost:8083/test/unit_test/relis_unit_test/last_result", false, stream_context_create(["http" => ["timeout" => 900]]));') | |
if [ "$response" == "successful" ]; then | |
echo "The unit test passed. Proceeding with the workflow." | |
echo "All Unit test passed" > ~/test_report.html | |
elif [ "$response" == "failed" ]; then | |
echo "The unit test failed" | |
echo "Browse to http://localhost:8083/test/unit_test/relis_unit_test in you local browser for more details" | |
echo $response | |
curl http://localhost:8083/test/unit_test/relis_unit_test -o ~/test_report.html | |
exit 1 | |
else | |
echo "The unit test has an error :" | |
echo $response | |
echo $response > ~/test_report.html | |
exit 1 | |
fi | |
- name: Upload the HTML Report | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-report.html | |
path: ~/test_report.html | |
- name: Stop all running Podman Containers | |
run: podman stop $(podman ps -q) |