Run Tests on Pull Request #3
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: Run Tests on Pull Request | |
on: | |
pull_request: | |
branches: | |
- '**' | |
workflow_dispatch: # Manual trigger | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the repository | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Install Docker Compose (if necessary) | |
- name: Install Docker Compose | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y docker-compose | |
# Start the Python container to build the dist file first | |
- name: Build dist file in Python container | |
run: | | |
sudo docker-compose up -d python_app | |
sudo docker-compose exec python_app sh -c "pyinstaller server.spec && ls /tmp/dist" | |
# Start all other containers after the dist is generated | |
- name: Start the rest of the containers | |
run: | | |
sudo docker-compose up -d ubuntu_server centos_server debian_server fedora_server arch_server | |
# Check if the dist file exists in all containers | |
- name: Verify dist file in all containers | |
run: | | |
sudo docker-compose exec ubuntu_server ls /tmp/dist | |
sudo docker-compose exec centos_server ls /tmp/dist | |
sudo docker-compose exec debian_server ls /tmp/dist | |
sudo docker-compose exec fedora_server ls /tmp/dist | |
sudo docker-compose exec arch_server ls /tmp/dist | |
# Run pytest in the python_app container | |
- name: Run Pytest | |
run: | | |
sudo docker-compose exec python_app pytest |