PX4-Autopilot/.github/workflows/build_deb_package.yml
Ramon Roche 9adda29da2
docs(sim): add Try PX4 quick-start and pre-built packages reference (#26957)
Adds documentation for the SITL containers and .deb packages introduced in #26495. The containers are now live on Docker Hub: [`px4io/px4-sitl:latest`](https://hub.docker.com/r/px4io/px4-sitl) and [`px4io/px4-sitl-gazebo:latest`](https://hub.docker.com/r/px4io/px4-sitl-gazebo).

The main addition is a [Try PX4 Simulation](https://docs.px4.io/main/en/dev_setup/try_px4) page that leads with a single `docker run` command and gets someone flying in under a minute. It lives in Getting Started, right after Recommended Hardware/Setup, so it's one of the first things new users see.

The existing `.deb` package reference has been moved from `packaging/px4_sitl_deb.md` to `simulation/px4_sitl.md` and expanded to cover both containers and `.deb` packages on one page. Sections are ordered by how people use them: what's available, install, configure, connect QGC/MAVSDK, connect ROS 2.

Other changes:
- README now has a "Try PX4" section with the docker one-liner above "Build from Source"
- Landing page (`index.md`) reworked to lead with "Try PX4" before "For Developers"
- Toolchain page (`dev_env.md`) gets a tip redirecting simulation-only users to pre-built packages
- `getting_started.md` and `SUMMARY.md` updated with links to the new pages
- Simulation index tip updated to mention containers alongside `.deb` packages

The SIH container image is published as `px4io/px4-sitl` (renamed from `px4io/px4-sitl-sih`) so the default lightweight option carries the simplest name. The Gazebo image remains `px4io/px4-sitl-gazebo`.

Also upgrades all GitHub Actions in the SITL workflow to Node.js 24 compatible versions (`actions/checkout@v6`, `actions/cache@v5`, `actions/upload-artifact@v7`, `actions/download-artifact@v8`, `docker/setup-buildx-action@v4`, `docker/build-push-action@v7`) to fix the Node.js 20 deprecation warning ahead of the June 2026 deadline.

---------

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
2026-04-09 08:51:22 -07:00

221 lines
9.3 KiB
YAML

name: SITL Packages and Containers
on:
push:
tags: ['v*']
pull_request:
paths:
- 'cmake/package.cmake'
- 'platforms/posix/CMakeLists.txt'
- 'Tools/packaging/**'
- 'boards/px4/sitl/sih.px4board'
- '.github/workflows/build_deb_package.yml'
- '.github/actions/build-deb/**'
workflow_dispatch:
inputs:
deploy_containers:
description: 'Push container images to registry'
required: false
type: boolean
default: false
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
packages: write
jobs:
# ---------------------------------------------------------------------------
# Setup: extract version and determine whether to push containers
# ---------------------------------------------------------------------------
setup:
name: Setup
runs-on: [runs-on,"runner=1cpu-linux-x64","image=ubuntu24-full-x64","run-id=${{ github.run_id }}",extras=s3-cache,spot=false]
outputs:
px4_version: ${{ steps.version.outputs.px4_version }}
should_push: ${{ steps.push.outputs.should_push }}
steps:
- uses: runs-on/action@v2
- uses: actions/checkout@v6
with:
fetch-tags: true
submodules: false
fetch-depth: 0
- name: Set PX4 version
id: version
run: echo "px4_version=$(git describe --tags --match 'v[0-9]*')" >> $GITHUB_OUTPUT
- name: Check if we should push containers
id: push
run: |
if [[ "${{ startsWith(github.ref, 'refs/tags/') }}" == "true" ]] || \
[[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ github.event.inputs.deploy_containers }}" == "true" ]]; then
echo "should_push=true" >> $GITHUB_OUTPUT
else
echo "should_push=false" >> $GITHUB_OUTPUT
fi
# ---------------------------------------------------------------------------
# Build .deb packages (all distros, arches, targets)
# ---------------------------------------------------------------------------
build-deb:
name: "Build .deb (${{ matrix.target }}/${{ matrix.codename }}/${{ matrix.arch }})"
needs: setup
runs-on: [runs-on,"runner=4cpu-linux-${{ matrix.runner }}","image=ubuntu24-full-${{ matrix.runner }}","run-id=${{ github.run_id }}",extras=s3-cache,spot=false]
container:
image: ${{ matrix.container }}
volumes:
- /github/workspace:/github/workspace
strategy:
fail-fast: false
matrix:
include:
- { codename: noble, arch: amd64, runner: x64, container: "ubuntu:24.04", target: default, setup_flags: "" }
- { codename: noble, arch: arm64, runner: arm64, container: "ubuntu:24.04", target: default, setup_flags: "" }
- { codename: jammy, arch: amd64, runner: x64, container: "ubuntu:22.04", target: default, setup_flags: "" }
- { codename: jammy, arch: arm64, runner: arm64, container: "ubuntu:22.04", target: default, setup_flags: "" }
- { codename: noble, arch: amd64, runner: x64, container: "ubuntu:24.04", target: sih, setup_flags: "--no-sim-tools" }
- { codename: noble, arch: arm64, runner: arm64, container: "ubuntu:24.04", target: sih, setup_flags: "--no-sim-tools" }
- { codename: jammy, arch: amd64, runner: x64, container: "ubuntu:22.04", target: sih, setup_flags: "--no-sim-tools" }
- { codename: jammy, arch: arm64, runner: arm64, container: "ubuntu:22.04", target: sih, setup_flags: "--no-sim-tools" }
env:
RUNS_IN_DOCKER: true
steps:
- uses: runs-on/action@v2
- name: Fix git in container
run: |
apt-get update && apt-get install -y git
git config --global --add safe.directory $(realpath .)
- uses: actions/checkout@v6
with:
fetch-depth: 0
fetch-tags: true
- name: Use AWS regional apt mirror
if: startsWith(runner.name, 'runs-on--')
run: ./Tools/ci/use_aws_apt_mirror.sh
- name: Cache apt packages
uses: actions/cache@v5
with:
path: /var/cache/apt/archives
key: apt-${{ matrix.target }}-${{ matrix.codename }}-${{ matrix.arch }}-${{ hashFiles('Tools/setup/ubuntu.sh') }}
restore-keys: apt-${{ matrix.target }}-${{ matrix.codename }}-${{ matrix.arch }}-
- name: Install dependencies
run: ./Tools/setup/ubuntu.sh --no-nuttx ${{ matrix.setup_flags }}
- name: Build and package .deb
uses: ./.github/actions/build-deb
with:
target: ${{ matrix.target }}
artifact-name: px4-sitl-debs-${{ matrix.target }}-${{ matrix.codename }}-${{ matrix.arch }}
ccache-key-prefix: deb-ccache-${{ matrix.target }}-${{ matrix.codename }}-${{ matrix.arch }}
# ---------------------------------------------------------------------------
# Build Docker images from Noble .debs
# ---------------------------------------------------------------------------
build-docker:
name: "Build Image (${{ matrix.image }}/${{ matrix.arch }})"
needs: [setup, build-deb]
runs-on: [runs-on,"runner=4cpu-linux-${{ matrix.runner }}","image=ubuntu24-full-${{ matrix.runner }}","run-id=${{ github.run_id }}",extras=s3-cache,spot=false]
strategy:
fail-fast: false
matrix:
include:
- { image: sih, repo: px4-sitl, target: sih, arch: amd64, runner: x64, platform: "linux/amd64", dockerfile: Dockerfile.sih }
- { image: sih, repo: px4-sitl, target: sih, arch: arm64, runner: arm64, platform: "linux/arm64", dockerfile: Dockerfile.sih }
- { image: gazebo, repo: px4-sitl-gazebo, target: default, arch: amd64, runner: x64, platform: "linux/amd64", dockerfile: Dockerfile.gazebo }
- { image: gazebo, repo: px4-sitl-gazebo, target: default, arch: arm64, runner: arm64, platform: "linux/arm64", dockerfile: Dockerfile.gazebo }
steps:
- uses: runs-on/action@v2
- uses: actions/checkout@v6
with:
submodules: false
fetch-depth: 1
- name: Download Noble .deb artifact
uses: actions/download-artifact@v4
with:
name: px4-sitl-debs-${{ matrix.target }}-noble-${{ matrix.arch }}
path: docker-context
- name: Prepare build context
run: cp Tools/packaging/px4-entrypoint.sh docker-context/
- name: Login to registries
if: needs.setup.outputs.should_push == 'true'
run: |
echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container
platforms: ${{ matrix.platform }}
- name: Build and push container image
uses: docker/build-push-action@v6
with:
context: docker-context
file: Tools/packaging/${{ matrix.dockerfile }}
tags: |
px4io/${{ matrix.repo }}:${{ needs.setup.outputs.px4_version }}-${{ matrix.arch }}
px4io/${{ matrix.repo }}:latest-${{ matrix.arch }}
ghcr.io/px4/${{ matrix.repo }}:${{ needs.setup.outputs.px4_version }}-${{ matrix.arch }}
ghcr.io/px4/${{ matrix.repo }}:latest-${{ matrix.arch }}
platforms: ${{ matrix.platform }}
load: false
push: ${{ needs.setup.outputs.should_push == 'true' }}
provenance: false
cache-from: type=gha,scope=sitl-${{ matrix.image }}-${{ matrix.arch }}
cache-to: type=gha,mode=max,scope=sitl-${{ matrix.image }}-${{ matrix.arch }}
# ---------------------------------------------------------------------------
# Deploy: create multi-arch manifests and push to registries
# ---------------------------------------------------------------------------
deploy:
name: "Deploy (${{ matrix.image }})"
needs: [setup, build-docker]
if: needs.setup.outputs.should_push == 'true'
runs-on: [runs-on,"runner=1cpu-linux-x64","image=ubuntu24-full-x64","run-id=${{ github.run_id }}",extras=s3-cache,spot=false]
strategy:
matrix:
include:
- { image: sih, repo: px4-sitl }
- { image: gazebo, repo: px4-sitl-gazebo }
steps:
- uses: runs-on/action@v2
- name: Login to registries
run: |
echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
- name: Create and push multi-arch manifests
run: |
VERSION="${{ needs.setup.outputs.px4_version }}"
for REGISTRY in px4io ghcr.io/px4; do
IMAGE="${REGISTRY}/${{ matrix.repo }}"
for TAG in ${VERSION} latest; do
docker manifest create ${IMAGE}:${TAG} \
--amend ${IMAGE}:${TAG}-arm64 \
--amend ${IMAGE}:${TAG}-amd64
docker manifest annotate ${IMAGE}:${TAG} ${IMAGE}:${TAG}-arm64 --arch arm64
docker manifest annotate ${IMAGE}:${TAG} ${IMAGE}:${TAG}-amd64 --arch amd64
docker manifest push ${IMAGE}:${TAG}
done
done