Skip to content

Commit

Permalink
Adding version checks into CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Armando Bañuelos committed Apr 9, 2024
1 parent 7802a4f commit 11b5d63
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 6 deletions.
40 changes: 40 additions & 0 deletions .github/check_latest_simulators.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import os
import requests
import re

def check_path_exists(version, simulator):
path = f"/software/{simulator}{version}"
if os.path.exists(path):
print(f"Latest {simulator} version {version} already present on the machine.\n")
else:
s = """
_
_ _____ ________ (_)__ ___ _
| |/|/ / _ `/ __/ _ \/ / _ \/ _ `/
|__,__/\_,_/_/ /_//_/_/_//_/\_, /
/___/
"""
print(s)
print(f"A new {simulator} version ({version}) needs to be installed and tested in CI.\n")

print("Checking for CARLA...")
carla_url = 'https://github.com/carla-simulator/carla/releases/latest'
carla_response = requests.get(carla_url)
carla_match = re.search(r'carla-simulator/carla/releases/tag/([^"]+)', carla_response.text)

try:
version = carla_match.group(1)
check_path_exists(version, "CARLA_")
except AttributeError:
print("Error: Unable to find the latest CARLA version using regex.")

print("Checking for Webots...")
webots_url = 'https://github.com/cyberbotics/webots/releases/latest'
webots_response = requests.get(webots_url)
webots_match = re.search(r'cyberbotics/webots/releases/tag/([^"]+)', webots_response.text)

try:
version = webots_match.group(1)
check_path_exists(version, 'webots')
except AttributeError:
print("Error: Unable to find the latest Webots version using regex.")
23 changes: 17 additions & 6 deletions .github/workflows/run-simulators.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,21 @@ jobs:
echo "Waiting 2 minutes for full startup..."
sleep 120
- name: Check for Simulator Version Updates
env:
PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
HOSTNAME: ${{secrets.SSH_HOST}}
USER_NAME: ${{secrets.SSH_USERNAME}}
run: |
echo "$PRIVATE_KEY" > private_key && chmod 600 private_key
ssh -o StrictHostKeyChecking=no -i private_key ${USER_NAME}@${HOSTNAME} '
cd /home/ubuntu/actions/ &&
rm -rf Scenic &&
git clone --branch $(basename "${{ github.ref }}") --single-branch https://[email protected]/BerkeleyLearnVerify/Scenic.git &&
cd Scenic &&
python3 .github/check_latest_simulators.py
'
- name: SSH into EC2 and Run Simulator Tests
env:
PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
Expand All @@ -56,19 +71,15 @@ jobs:
# Now we have got the access of EC2 and we will start the deploy .
bash /opt/carla-simulator/CarlaUE4.sh &
ls /home/ubuntu/ &&
cd /home/ubuntu/actions/ &&
git clone --branch $(basename "${{ github.ref }}") --single-branch https://[email protected]/BerkeleyLearnVerify/Scenic.git &&
cd Scenic &&
cd /home/ubuntu/actions/Scenic &&
python3 -m venv venv &&
source venv/bin/activate &&
python3 -m pip install -e . &&
python3 -m pip install -e .[test-full] &&
python3 -m pip install -e .[guideways] &&
pytest tests/simulators/* &&
cd /home/ubuntu/ &&
rm -rf /home/ubuntu/actions/Scenic
'
- name: Stop EC2 Instance
env:
INSTANCE_ID: ${{ secrets.AWS_EC2_INSTANCE_ID }}
Expand Down

0 comments on commit 11b5d63

Please sign in to comment.