Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 137 additions & 0 deletions .github/workflows/aas-amd64-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: aas ci/cd main

on:
schedule:
- cron: '0 3 * * 6'
workflow_dispatch: {}
pull_request:
branches: [ "main" ]

permissions:
contents: read
packages: write

jobs:
build-aircraft:
uses: ./.github/workflows/aircraft-amd64-build.yml

build-ground:
Comment thread Fixed
uses: ./.github/workflows/ground-amd64-build.yml

build-simulation:
Comment thread Fixed
uses: ./.github/workflows/simulation-amd64-build.yml

integration-test:
Comment thread Fixed
runs-on: ubuntu-22.04
needs: [build-aircraft, build-ground, build-simulation]
timeout-minutes: 150
permissions:
contents: read
packages: read
defaults:
run:
shell: bash -el {0}

steps:
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet &
sudo rm -rf /usr/local/lib/android &
sudo rm -rf /opt/ghc &
sudo rm -rf /opt/hostedtoolcache/CodeQL &
sudo rm -rf /usr/local/share/boost &
sudo rm -rf /usr/share/swift &
sudo rm -rf "$AGENT_TOOLSDIRECTORY" &
wait
sudo docker image prune --all --force
sudo apt-get clean
sudo rm -rf /var/lib/apt/lists/*

- name: Add swap space
run: |
sudo swapoff -a || true
sudo rm -f /swapfile
sudo fallocate -l 10G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

- name: Check swap
run: |
free -h
sudo swapon --show

- name: Check disk space
run: df -h

- name: Checkout the repository
uses: actions/checkout@v4

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Determine Docker tag
env:
EVENT_NAME: ${{ github.event_name }}
EVENT_NUMBER: ${{ github.event.number }}
REF_NAME: ${{ github.ref_name }}
REF: ${{ github.ref }}
run: |
if [ "$EVENT_NAME" == "pull_request" ]; then
echo "DOCKER_TAG=pr-${EVENT_NUMBER}" >> $GITHUB_ENV
elif [ "$REF" == "refs/heads/main" ]; then
echo "DOCKER_TAG=latest" >> $GITHUB_ENV
else
BRANCH_TAG=$(echo "$REF_NAME" | tr '/' '-')
echo "DOCKER_TAG=${BRANCH_TAG}" >> $GITHUB_ENV
fi

- name: Pull and re-tag images
run: |
echo "Pulling images with tag: ${{ env.DOCKER_TAG }}"
docker pull ghcr.io/jacopopan/aircraft-image:${{ env.DOCKER_TAG }}
docker pull ghcr.io/jacopopan/ground-image:${{ env.DOCKER_TAG }}
docker pull ghcr.io/jacopopan/simulation-image:${{ env.DOCKER_TAG }}
echo "Locally retagging the images as latest for aas_env.py"
docker tag ghcr.io/jacopopan/aircraft-image:${{ env.DOCKER_TAG }} aircraft-image:latest
docker tag ghcr.io/jacopopan/ground-image:${{ env.DOCKER_TAG }} ground-image:latest
docker tag ghcr.io/jacopopan/simulation-image:${{ env.DOCKER_TAG }} simulation-image:latest
docker images | grep latest

- name: Set up Conda with Python 3.13
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: aas
python-version: 3.13
auto-activate: true
use-only-tar-bz2: true

- name: Remove GPU requests
run: |
sed -i 's/devices=device_binds,/devices=[],/' ./aas-gym/src/aas_gym/aas_env.py
sed -i 's/device_requests=gpu_requests,/device_requests=[],/' ./aas-gym/src/aas_gym/aas_env.py

- name: Install aas-gym package
run: |
cd ./aas-gym/
pip install -e .

- name: Run aas-gym test 1
run: |
python3 ./scripts/gym_run.py --mode speedup --num_quads 1 --no-camera --no-lidar --autopilot px4

- name: Safety cleanup between tests
if: always()
run: |
docker kill $(docker ps -q) || true
docker rm $(docker ps -a -q) || true
docker network prune -f
sleep 10

- name: Run aas-gym test 2
run: |
python3 ./scripts/gym_run.py --mode speedup --num_quads 1 --no-camera --no-lidar --autopilot ardupilot
2 changes: 1 addition & 1 deletion .github/workflows/aas-gym-pip-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
with:
activate-environment: aas
python-version: 3.13
auto-activate-base: false
auto-activate: true
use-only-tar-bz2: true

- name: Install aas-gym package
Expand Down
26 changes: 19 additions & 7 deletions .github/workflows/aircraft-amd64-build.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
name: aircraft-image amd64

on:
schedule:
- cron: '0 3 * * 6'
workflow_dispatch: {}
pull_request:
branches: [ "main" ]
workflow_call: {}

jobs:
build:
Expand Down Expand Up @@ -63,5 +59,21 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build the aircraft image (optionally, add --push)
run: docker buildx build -t ghcr.io/jacopopan/aircraft-image:latest -f ./scripts/docker/Dockerfile.aircraft .
- name: Determine Docker tag
env:
EVENT_NAME: ${{ github.event_name }}
EVENT_NUMBER: ${{ github.event.number }}
REF_NAME: ${{ github.ref_name }}
REF: ${{ github.ref }}
run: |
if [ "$EVENT_NAME" == "pull_request" ]; then
echo "DOCKER_TAG=pr-${EVENT_NUMBER}" >> $GITHUB_ENV
elif [ "$REF" == "refs/heads/main" ]; then
echo "DOCKER_TAG=latest" >> $GITHUB_ENV
else
BRANCH_TAG=$(echo "$REF_NAME" | tr '/' '-')
echo "DOCKER_TAG=${BRANCH_TAG}" >> $GITHUB_ENV
fi

- name: Build the aircraft
run: docker buildx build --push -t ghcr.io/jacopopan/aircraft-image:${{ env.DOCKER_TAG }} -f ./scripts/docker/Dockerfile.aircraft .
26 changes: 26 additions & 0 deletions .github/workflows/cleanup-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: cleanup packages

on:
schedule:
- cron: '0 3 * * 0'
workflow_dispatch: {}

jobs:
delete-old-versions:
runs-on: ubuntu-22.04
permissions:
packages: write

steps:
- name: Prune images older than 10 days (except latest)
uses: snok/container-retention-policy@v3.0.0
with:
image-names: |
aircraft-image
ground-image
simulation-image
cut-off: 10d
skip-tags: latest
keep-at-least: 1
account-type: personal
token: ${{ secrets.GITHUB_TOKEN }}
26 changes: 19 additions & 7 deletions .github/workflows/ground-amd64-build.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
name: ground-image amd64

on:
schedule:
- cron: '0 3 * * 6'
workflow_dispatch: {}
pull_request:
branches: [ "main" ]
workflow_call: {}

jobs:
build:
Expand Down Expand Up @@ -63,5 +59,21 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build the ground image (optionally, add --push)
run: docker buildx build -t ghcr.io/jacopopan/ground-image:latest -f ./scripts/docker/Dockerfile.ground .
- name: Determine Docker tag
env:
EVENT_NAME: ${{ github.event_name }}
EVENT_NUMBER: ${{ github.event.number }}
REF_NAME: ${{ github.ref_name }}
REF: ${{ github.ref }}
run: |
if [ "$EVENT_NAME" == "pull_request" ]; then
echo "DOCKER_TAG=pr-${EVENT_NUMBER}" >> $GITHUB_ENV
elif [ "$REF" == "refs/heads/main" ]; then
echo "DOCKER_TAG=latest" >> $GITHUB_ENV
else
BRANCH_TAG=$(echo "$REF_NAME" | tr '/' '-')
echo "DOCKER_TAG=${BRANCH_TAG}" >> $GITHUB_ENV
fi

- name: Build the ground image
run: docker buildx build --push -t ghcr.io/jacopopan/ground-image:${{ env.DOCKER_TAG }} -f ./scripts/docker/Dockerfile.ground .
26 changes: 19 additions & 7 deletions .github/workflows/simulation-amd64-build.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
name: simulation-image amd64

on:
schedule:
- cron: '0 3 * * 6'
workflow_dispatch: {}
pull_request:
branches: [ "main" ]
workflow_call: {}

jobs:
build:
Expand Down Expand Up @@ -63,5 +59,21 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build the simulation image (optionally, add --push)
run: docker buildx build -t ghcr.io/jacopopan/simulation-image:latest -f ./scripts/docker/Dockerfile.simulation .
- name: Determine Docker tag
env:
EVENT_NAME: ${{ github.event_name }}
EVENT_NUMBER: ${{ github.event.number }}
REF_NAME: ${{ github.ref_name }}
REF: ${{ github.ref }}
run: |
if [ "$EVENT_NAME" == "pull_request" ]; then
echo "DOCKER_TAG=pr-${EVENT_NUMBER}" >> $GITHUB_ENV
elif [ "$REF" == "refs/heads/main" ]; then
echo "DOCKER_TAG=latest" >> $GITHUB_ENV
else
BRANCH_TAG=$(echo "$REF_NAME" | tr '/' '-')
echo "DOCKER_TAG=${BRANCH_TAG}" >> $GITHUB_ENV
fi

- name: Build the simulation image
run: docker buildx build --push -t ghcr.io/jacopopan/simulation-image:${{ env.DOCKER_TAG }} -f ./scripts/docker/Dockerfile.simulation .
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ cd aerial-autonomy-stack/scripts/

./sim_build.sh
# Note: the 1st build takes ~30GB of space and ~25' with good internet (`Ctrl + c` and restart if needed)
# Alternatively, pre-build images are available on ghcr.io:
# docker pull ghcr.io/jacopopan/[aircraft|ground|simulation]-image:latest
```

<div align="right">
Expand Down
Loading