mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-31 18:47:21 +08:00
ci: introduce px4-dev container with multi arch support (#24022)
This commit is contained in:
@@ -17,12 +17,14 @@ on:
|
|||||||
paths-ignore:
|
paths-ignore:
|
||||||
- 'docs/**'
|
- 'docs/**'
|
||||||
- '.github/**'
|
- '.github/**'
|
||||||
|
- 'Tools/**'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- '*'
|
- '*'
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- 'docs/**'
|
- 'docs/**'
|
||||||
- '.github/**'
|
- '.github/**'
|
||||||
|
- 'Tools/**'
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
@@ -36,7 +38,6 @@ jobs:
|
|||||||
outputs:
|
outputs:
|
||||||
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||||
timestamp: ${{ steps.set-timestamp.outputs.timestamp }}
|
timestamp: ${{ steps.set-timestamp.outputs.timestamp }}
|
||||||
tagname: ${{ steps.set-tag.outputs.tagname }}
|
|
||||||
branchname: ${{ steps.set-branch.outputs.branchname }}
|
branchname: ${{ steps.set-branch.outputs.branchname }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@@ -67,9 +68,9 @@ jobs:
|
|||||||
echo "$(./Tools/ci/generate_board_targets_json.py --group --verbose)"
|
echo "$(./Tools/ci/generate_board_targets_json.py --group --verbose)"
|
||||||
|
|
||||||
setup:
|
setup:
|
||||||
name: Build Group [${{ matrix.group }}]
|
name: Build Group [${{ matrix.group }}][${{ matrix.arch == 'nuttx' && 'x86' || 'arm64' }}]
|
||||||
# runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
runs-on: [runs-on,runner=8cpu-linux-x64,image=ubuntu22-full-x64,"run-id=${{ github.run_id }}",spot=false]
|
runs-on: [runs-on,"runner=8cpu-linux-x64","image=ubuntu24-full-x64","run-id=${{ github.run_id }}",spot=false]
|
||||||
needs: group_targets
|
needs: group_targets
|
||||||
strategy:
|
strategy:
|
||||||
matrix: ${{ fromJson(needs.group_targets.outputs.matrix) }}
|
matrix: ${{ fromJson(needs.group_targets.outputs.matrix) }}
|
||||||
@@ -104,7 +105,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Building [${{ matrix.group }}]
|
- name: Building [${{ matrix.group }}]
|
||||||
run: |
|
run: |
|
||||||
./Tools/ci/build_all_runner.sh ${{matrix.targets}}
|
./Tools/ci/build_all_runner.sh ${{matrix.targets}} ${{matrix.arch}}
|
||||||
|
|
||||||
- name: Arrange Build Artifacts
|
- name: Arrange Build Artifacts
|
||||||
run: |
|
run: |
|
||||||
@@ -122,7 +123,7 @@ jobs:
|
|||||||
artifacts:
|
artifacts:
|
||||||
name: Upload Artifacts to S3
|
name: Upload Artifacts to S3
|
||||||
# runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
runs-on: [runs-on,runner=1cpu-linux-x64,image=ubuntu22-full-x64,"run-id=${{ github.run_id }}",spot=false]
|
runs-on: [runs-on,runner=1cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",spot=false]
|
||||||
needs: [setup, group_targets]
|
needs: [setup, group_targets]
|
||||||
if: contains(fromJSON('["main", "stable", "beta"]'), needs.group_targets.outputs.branchname)
|
if: contains(fromJSON('["main", "stable", "beta"]'), needs.group_targets.outputs.branchname)
|
||||||
steps:
|
steps:
|
||||||
@@ -150,10 +151,12 @@ jobs:
|
|||||||
|
|
||||||
release:
|
release:
|
||||||
name: Create Release and Upload Artifacts
|
name: Create Release and Upload Artifacts
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
# runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
runs-on: [runs-on,runner=1cpu-linux-x64,image=ubuntu22-full-x64,"run-id=${{ github.run_id }}",spot=false]
|
runs-on: [runs-on,runner=1cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",spot=false]
|
||||||
needs: [setup, group_targets]
|
needs: [setup, group_targets]
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
steps:
|
steps:
|
||||||
- name: Download Artifacts
|
- name: Download Artifacts
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ on:
|
|||||||
- 'docs/**'
|
- 'docs/**'
|
||||||
- '.github/**'
|
- '.github/**'
|
||||||
|
|
||||||
|
env:
|
||||||
|
RUNS_IN_DOCKER: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_and_test:
|
build_and_test:
|
||||||
name: Build and Test
|
name: Build and Test
|
||||||
|
|||||||
@@ -10,35 +10,132 @@ on:
|
|||||||
- 'release/**'
|
- 'release/**'
|
||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- 'v*'
|
||||||
paths-ignore:
|
paths:
|
||||||
- 'docs/**'
|
- 'Tools/setup/ubuntu.sh'
|
||||||
- '.github/**'
|
- 'Tools/setup/requirements.txt'
|
||||||
|
- 'Tools/setup/Dockerfile'
|
||||||
|
- 'Tools/setup/docker-entrypoint.sh'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- '*'
|
- '*'
|
||||||
paths-ignore:
|
paths:
|
||||||
- 'docs/**'
|
- 'Tools/setup/ubuntu.sh'
|
||||||
- '.github/**'
|
- 'Tools/setup/requirements.txt'
|
||||||
|
- 'Tools/setup/Dockerfile'
|
||||||
|
- 'Tools/setup/docker-entrypoint.sh'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
setup:
|
||||||
name: Build and Push Container
|
name: Set Tags and Variables
|
||||||
runs-on: [runs-on,runner=8cpu-linux-x64,image=ubuntu24-full-x64,"run-id=${{ github.run_id }}",spot=false]
|
permissions:
|
||||||
|
contents: read
|
||||||
|
runs-on: [runs-on,"runner=1cpu-linux-x64","image=ubuntu24-full-x64","run-id=${{ github.run_id }}",spot=false,extras=s3-cache]
|
||||||
|
outputs:
|
||||||
|
px4_version: ${{ steps.px4_version.outputs.px4_version }}
|
||||||
|
meta_tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
meta_labels: ${{ steps.meta.outputs.labels }}
|
||||||
steps:
|
steps:
|
||||||
|
- uses: runs-on/action@v1
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-tags: true
|
fetch-tags: true
|
||||||
submodules: false
|
submodules: false
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Set PX4 Tag
|
- name: Set PX4 Tag Version
|
||||||
id: px4-tag
|
id: px4_version
|
||||||
run: |
|
run: |
|
||||||
echo "tag=$(git describe --tags --match 'v[0-9]*')" >> $GITHUB_OUTPUT
|
echo "px4_version=$(git describe --tags --match 'v[0-9]*')" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Extract metadata (tags, labels) for Docker
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
ghcr.io/PX4/px4-dev
|
||||||
|
px4io/px4-dev
|
||||||
|
tags: |
|
||||||
|
type=raw,enable=true,value=${{ steps.px4_version.outputs.px4_version }},priority=1000
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: Build Container (${{ matrix.arch }})
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
needs: setup
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- platform: linux/arm64
|
||||||
|
arch: arm64
|
||||||
|
runner: arm64
|
||||||
|
- platform: linux/amd64
|
||||||
|
arch: amd64
|
||||||
|
runner: x64
|
||||||
|
runs-on: [runs-on,"runner=8cpu-linux-${{ matrix.runner }}","image=ubuntu24-full-${{ matrix.runner }}","run-id=${{ github.run_id }}",spot=false,extras=s3-cache]
|
||||||
|
steps:
|
||||||
|
- uses: runs-on/action@v1
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-tags: true
|
||||||
|
submodules: false
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
driver: docker-container
|
||||||
|
platforms: ${{ matrix.platform }}
|
||||||
|
|
||||||
|
- name: Build and Load Container Image
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
id: docker
|
||||||
|
with:
|
||||||
|
context: Tools/setup
|
||||||
|
tags: |
|
||||||
|
ghcr.io/px4/px4-dev:${{ needs.setup.outputs.px4_version }}-${{ matrix.arch }}
|
||||||
|
px4io/px4-dev:${{ needs.setup.outputs.px4_version }}-${{ matrix.arch }}
|
||||||
|
labels: ${{ needs.setup.outputs.meta_labels }}
|
||||||
|
platforms: ${{ matrix.platform }}
|
||||||
|
load: false
|
||||||
|
push: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||||
|
provenance: false
|
||||||
|
cache-from: type=gha,version=1
|
||||||
|
cache-to: type=gha,version=1,mode=max
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
name: Deploy To Registry
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
runs-on: [runs-on,"runner=8cpu-linux-x64","image=ubuntu24-full-x64","run-id=${{ github.run_id }}",spot=false,extras=s3-cache]
|
||||||
|
needs: [build, setup]
|
||||||
|
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||||
|
steps:
|
||||||
|
- uses: runs-on/action@v1
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-tags: true
|
||||||
|
submodules: false
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
@@ -50,58 +147,31 @@ jobs:
|
|||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
- name: Verify Images Exist Before Creating Manifest
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: |
|
|
||||||
ghcr.io/PX4/px4-dev
|
|
||||||
${{ (github.event_name != 'pull_request') && 'px4io/px4-dev' || '' }}
|
|
||||||
tags: |
|
|
||||||
type=raw,enable=true,value=${{ steps.px4-tag.outputs.tag }},priority=1000
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Build and load container image
|
|
||||||
uses: docker/build-push-action@v6
|
|
||||||
id: docker
|
|
||||||
with:
|
|
||||||
context: Tools/setup
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
platforms: |
|
|
||||||
linux/amd64
|
|
||||||
load: true
|
|
||||||
push: false
|
|
||||||
cache-from: type=s3,blobs_prefix=cache/${{ github.repository }}/,manifests_prefix=cache/${{ github.repository }}/,region=${{ env.RUNS_ON_AWS_REGION }},bucket=${{ env.RUNS_ON_S3_BUCKET_CACHE }}
|
|
||||||
cache-to: type=s3,blobs_prefix=cache/${{ github.repository }}/,manifests_prefix=cache/${{ github.repository }}/,region=${{ env.RUNS_ON_AWS_REGION }},bucket=${{ env.RUNS_ON_S3_BUCKET_CACHE }},mode=max
|
|
||||||
|
|
||||||
- name: Get Tag Name
|
|
||||||
id: tag_name
|
|
||||||
run: |
|
run: |
|
||||||
echo "::set-output name=tag_name::$(echo '${{ fromJSON(steps.docker.outputs.metadata)['image.name'] }}' | sed 's/,.*$//')"
|
docker manifest inspect px4io/px4-dev:${{ needs.setup.outputs.px4_version }}-arm64 || echo "⚠️ Warning: No ARM64 image found!"
|
||||||
|
docker manifest inspect px4io/px4-dev:${{ needs.setup.outputs.px4_version }}-amd64 || echo "⚠️ Warning: No AMD64 image found!"
|
||||||
|
docker manifest inspect ghcr.io/px4/px4-dev:${{ needs.setup.outputs.px4_version }}-arm64 || echo "⚠️ Warning: No ARM64 image found!"
|
||||||
|
docker manifest inspect ghcr.io/px4/px4-dev:${{ needs.setup.outputs.px4_version }}-amd64 || echo "⚠️ Warning: No AMD64 image found!"
|
||||||
|
|
||||||
- name: make quick_check
|
- name: Create and Push Multi-Arch Manifest for Docker Hub
|
||||||
uses: addnab/docker-run-action@v3
|
|
||||||
with:
|
|
||||||
image: ${{ steps.tag_name.outputs.tag_name }}
|
|
||||||
options: -v ${{ github.workspace }}:/workspace
|
|
||||||
run: |
|
run: |
|
||||||
cd /workspace
|
docker manifest create px4io/px4-dev:${{ needs.setup.outputs.px4_version }} \
|
||||||
git config --global --add safe.directory /workspace
|
--amend px4io/px4-dev:${{ needs.setup.outputs.px4_version }}-arm64 \
|
||||||
make px4_sitl_default
|
--amend px4io/px4-dev:${{ needs.setup.outputs.px4_version }}-amd64
|
||||||
make px4_fmu-v6x_default
|
|
||||||
|
|
||||||
- name: Push container image
|
docker manifest annotate px4io/px4-dev:${{ needs.setup.outputs.px4_version }} px4io/px4-dev:${{ needs.setup.outputs.px4_version }}-arm64 --arch arm64
|
||||||
uses: docker/build-push-action@v6
|
docker manifest annotate px4io/px4-dev:${{ needs.setup.outputs.px4_version }} px4io/px4-dev:${{ needs.setup.outputs.px4_version }}-amd64 --arch amd64
|
||||||
with:
|
|
||||||
context: Tools/setup
|
docker manifest push px4io/px4-dev:${{ needs.setup.outputs.px4_version }}
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
- name: Create and Push Multi-Arch Manifest for GHCR
|
||||||
platforms: |
|
run: |
|
||||||
linux/amd64
|
docker manifest create ghcr.io/px4/px4-dev:${{ needs.setup.outputs.px4_version }} \
|
||||||
provenance: mode=max
|
--amend ghcr.io/px4/px4-dev:${{ needs.setup.outputs.px4_version }}-arm64 \
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
--amend ghcr.io/px4/px4-dev:${{ needs.setup.outputs.px4_version }}-amd64
|
||||||
cache-from: type=s3,blobs_prefix=cache/${{ github.repository }}/,manifests_prefix=cache/${{ github.repository }}/,region=${{ env.RUNS_ON_AWS_REGION }},bucket=${{ env.RUNS_ON_S3_BUCKET_CACHE }}
|
|
||||||
cache-to: type=s3,blobs_prefix=cache/${{ github.repository }}/,manifests_prefix=cache/${{ github.repository }}/,region=${{ env.RUNS_ON_AWS_REGION }},bucket=${{ env.RUNS_ON_S3_BUCKET_CACHE }},mode=max
|
docker manifest annotate ghcr.io/px4/px4-dev:${{ needs.setup.outputs.px4_version }} ghcr.io/px4/px4-dev:${{ needs.setup.outputs.px4_version }}-arm64 --arch arm64
|
||||||
|
docker manifest annotate ghcr.io/px4/px4-dev:${{ needs.setup.outputs.px4_version }} ghcr.io/px4/px4-dev:${{ needs.setup.outputs.px4_version }}-amd64 --arch amd64
|
||||||
|
|
||||||
|
docker manifest push ghcr.io/px4/px4-dev:${{ needs.setup.outputs.px4_version }}
|
||||||
|
|||||||
@@ -87,19 +87,25 @@ def process_target(px4board_file, target_name):
|
|||||||
|
|
||||||
if platform not in excluded_platforms:
|
if platform not in excluded_platforms:
|
||||||
# get the container based on the platform and toolchain
|
# get the container based on the platform and toolchain
|
||||||
|
# TODO enable once newer container is validated
|
||||||
|
# container = 'ghcr.io/px4/px4-dev:v1.16.0-alpha2-419-gd48631e2ce'
|
||||||
if platform == 'posix':
|
if platform == 'posix':
|
||||||
|
# TODO remove once newer container is validated
|
||||||
container = 'px4io/px4-dev-base-focal:2021-09-08'
|
container = 'px4io/px4-dev-base-focal:2021-09-08'
|
||||||
group = 'base'
|
group = 'base'
|
||||||
if toolchain:
|
if toolchain:
|
||||||
if toolchain.startswith('aarch64'):
|
if toolchain.startswith('aarch64'):
|
||||||
|
# TODO remove once newer container is validated
|
||||||
container = 'px4io/px4-dev-aarch64:2022-08-12'
|
container = 'px4io/px4-dev-aarch64:2022-08-12'
|
||||||
group = 'aarch64'
|
group = 'aarch64'
|
||||||
elif toolchain == 'arm-linux-gnueabihf':
|
elif toolchain == 'arm-linux-gnueabihf':
|
||||||
|
# TODO remove once newer container is validated
|
||||||
container = 'px4io/px4-dev-armhf:2023-06-26'
|
container = 'px4io/px4-dev-armhf:2023-06-26'
|
||||||
group = 'armhf'
|
group = 'armhf'
|
||||||
else:
|
else:
|
||||||
if verbose: print(f'unmatched toolchain: {toolchain}')
|
if verbose: print(f'unmatched toolchain: {toolchain}')
|
||||||
elif platform == 'nuttx':
|
elif platform == 'nuttx':
|
||||||
|
# TODO remove once newer container is validated
|
||||||
container = 'px4io/px4-dev-nuttx-focal:2022-08-12'
|
container = 'px4io/px4-dev-nuttx-focal:2022-08-12'
|
||||||
group = 'nuttx'
|
group = 'nuttx'
|
||||||
else:
|
else:
|
||||||
@@ -124,7 +130,10 @@ if(verbose):
|
|||||||
# - Events
|
# - Events
|
||||||
metadata_targets = ['airframe_metadata', 'parameters_metadata', 'extract_events']
|
metadata_targets = ['airframe_metadata', 'parameters_metadata', 'extract_events']
|
||||||
grouped_targets['base'] = {}
|
grouped_targets['base'] = {}
|
||||||
|
# TODO remove once newer container is validated
|
||||||
grouped_targets['base']['container'] = 'px4io/px4-dev-base-focal:2021-09-08'
|
grouped_targets['base']['container'] = 'px4io/px4-dev-base-focal:2021-09-08'
|
||||||
|
# TODO enable once newer container is validated
|
||||||
|
#grouped_targets['base']['container'] = 'ghcr.io/px4/px4-dev:v1.16.0-alpha2-419-gd48631e2ce'
|
||||||
grouped_targets['base']['manufacturers'] = {}
|
grouped_targets['base']['manufacturers'] = {}
|
||||||
grouped_targets['base']['manufacturers']['px4'] = []
|
grouped_targets['base']['manufacturers']['px4'] = []
|
||||||
grouped_targets['base']['manufacturers']['px4'] += metadata_targets
|
grouped_targets['base']['manufacturers']['px4'] += metadata_targets
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ mkdir artifacts
|
|||||||
cp **/**/*.px4 artifacts/
|
cp **/**/*.px4 artifacts/
|
||||||
cp **/**/*.elf artifacts/
|
cp **/**/*.elf artifacts/
|
||||||
for build_dir_path in build/*/ ; do
|
for build_dir_path in build/*/ ; do
|
||||||
|
build_dir_path=${build_dir_path::${#build_dir_path}-1}
|
||||||
build_dir=${build_dir_path#*/}
|
build_dir=${build_dir_path#*/}
|
||||||
build_dir=${build_dir::${#build_dir}-1}
|
|
||||||
mkdir artifacts/$build_dir
|
mkdir artifacts/$build_dir
|
||||||
find artifacts/ -maxdepth 1 -type f -name "*$build_dir*"
|
find artifacts/ -maxdepth 1 -type f -name "*$build_dir*"
|
||||||
# Airframe
|
# Airframe
|
||||||
@@ -26,6 +26,7 @@ for build_dir_path in build/*/ ; do
|
|||||||
echo "----------"
|
echo "----------"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ -d artifacts/px4_sitl_default ]; then
|
||||||
# general metadata
|
# general metadata
|
||||||
mkdir artifacts/_general/
|
mkdir artifacts/_general/
|
||||||
cp artifacts/px4_sitl_default/airframes.xml artifacts/_general/
|
cp artifacts/px4_sitl_default/airframes.xml artifacts/_general/
|
||||||
@@ -44,3 +45,4 @@ cp artifacts/px4_sitl_default/events/all_events.json.xz artifacts/_general/
|
|||||||
cp artifacts/px4_sitl_default/events/all_events.json.xz artifacts/_general/
|
cp artifacts/px4_sitl_default/events/all_events.json.xz artifacts/_general/
|
||||||
# Module Docs
|
# Module Docs
|
||||||
ls -la artifacts/_general/
|
ls -la artifacts/_general/
|
||||||
|
fi
|
||||||
|
|||||||
+2
-2
@@ -33,10 +33,10 @@ fi
|
|||||||
# docker hygiene
|
# docker hygiene
|
||||||
|
|
||||||
#Delete all stopped containers (including data-only containers)
|
#Delete all stopped containers (including data-only containers)
|
||||||
#docker rm $(docker ps -a -q)
|
# docker container prune
|
||||||
|
|
||||||
#Delete all 'untagged/dangling' (<none>) images
|
#Delete all 'untagged/dangling' (<none>) images
|
||||||
#docker rmi $(docker images -q -f dangling=true)
|
# docker image prune
|
||||||
|
|
||||||
echo "PX4_DOCKER_REPO: $PX4_DOCKER_REPO";
|
echo "PX4_DOCKER_REPO: $PX4_DOCKER_REPO";
|
||||||
|
|
||||||
|
|||||||
@@ -8,22 +8,25 @@ ENV LC_ALL=C.UTF-8
|
|||||||
ENV DISPLAY=:99
|
ENV DISPLAY=:99
|
||||||
ENV TERM=xterm
|
ENV TERM=xterm
|
||||||
ENV TZ=UTC
|
ENV TZ=UTC
|
||||||
|
ENV RUNS_IN_DOCKER=true
|
||||||
|
|
||||||
# SITL UDP PORTS
|
# SITL UDP PORTS
|
||||||
EXPOSE 14556/udp
|
EXPOSE 14556/udp
|
||||||
EXPOSE 14557/udp
|
EXPOSE 14557/udp
|
||||||
|
|
||||||
|
# Install Shell Script Entrypoint
|
||||||
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
||||||
|
|
||||||
# Install PX4 Requirements
|
# Install PX4 Requirements
|
||||||
COPY requirements.txt /tmp/requirements.txt
|
COPY requirements.txt /tmp/requirements.txt
|
||||||
COPY ubuntu.sh /tmp/ubuntu.sh
|
COPY ubuntu.sh /tmp/ubuntu.sh
|
||||||
RUN touch /.dockerenv
|
|
||||||
RUN bash /tmp/ubuntu.sh --no-sim-tools
|
RUN bash /tmp/ubuntu.sh --no-sim-tools
|
||||||
|
|
||||||
|
# Make sure git is ok with your local copy
|
||||||
RUN git config --global --add safe.directory '*'
|
RUN git config --global --add safe.directory '*'
|
||||||
|
|
||||||
# create user with id 1001 (jenkins docker workflow default)
|
# Create user with id 1001 (jenkins docker workflow default)
|
||||||
RUN useradd --shell /bin/bash -u 1001 -c "" -m user && usermod -a -G dialout user
|
RUN useradd --shell /bin/bash -u 1001 -c "" -m user && usermod -a -G dialout user
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
||||||
|
|||||||
@@ -1,19 +1,27 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
NO_COLOR='\033[0m' # No Color
|
||||||
|
SCRIPTID="${GREEN}[docker-entrypoint.sh]${NO_COLOR}"
|
||||||
|
|
||||||
|
echo -e "$SCRIPTID Starting"
|
||||||
|
|
||||||
# Start virtual X server in the background
|
# Start virtual X server in the background
|
||||||
# - DISPLAY default is :99, set in dockerfile
|
# - DISPLAY default is :99, set in dockerfile
|
||||||
# - Users can override with `-e DISPLAY=` in `docker run` command to avoid
|
# - Users can override with `-e DISPLAY=` in `docker run` command to avoid
|
||||||
# running Xvfb and attach their screen
|
# running Xvfb and attach their screen
|
||||||
if [[ -x "$(command -v Xvfb)" && "$DISPLAY" == ":99" ]]; then
|
if [[ -x "$(command -v Xvfb)" && "$DISPLAY" == ":99" ]]; then
|
||||||
echo "[docker-entrypoint.sh] Starting Xvfb"
|
echo -e "$SCRIPTID Starting Xvfb"
|
||||||
Xvfb :99 -screen 0 1600x1200x24+32 &
|
Xvfb :99 -screen 0 1600x1200x24+32 &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if the ROS_DISTRO is passed and use it
|
# Check if the ROS_DISTRO is passed and use it
|
||||||
# to source the ROS environment
|
# to source the ROS environment
|
||||||
if [ -n "${ROS_DISTRO}" ]; then
|
if [ -n "${ROS_DISTRO}" ]; then
|
||||||
echo "[docker-entrypoint.sh] ROS: ${ROS_DISTRO}"
|
echo -e "$SCRIPTID ROS: ${ROS_DISTRO}"
|
||||||
source "/opt/ros/$ROS_DISTRO/setup.bash"
|
source "/opt/ros/$ROS_DISTRO/setup.bash"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo -e "$SCRIPTID ($( uname -m ))"
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|||||||
+34
-16
@@ -27,9 +27,12 @@ do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo "[ubuntu.sh] Starting..."
|
||||||
|
echo "[ubuntu.sh] arch: $INSTALL_ARCH"
|
||||||
|
|
||||||
# detect if running in docker
|
# detect if running in docker
|
||||||
if [ -f /.dockerenv ]; then
|
if [ "$RUNS_IN_DOCKER" = "true" ]; then
|
||||||
echo "Running within docker, installing initial dependencies";
|
echo "[ubuntu.sh] Running within docker, installing initial dependencies";
|
||||||
apt-get --quiet -y update && DEBIAN_FRONTEND=noninteractive apt-get --quiet -y install \
|
apt-get --quiet -y update && DEBIAN_FRONTEND=noninteractive apt-get --quiet -y install \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
gnupg \
|
gnupg \
|
||||||
@@ -47,7 +50,7 @@ DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
|||||||
# check requirements.txt exists (script not run in source tree)
|
# check requirements.txt exists (script not run in source tree)
|
||||||
REQUIREMENTS_FILE="requirements.txt"
|
REQUIREMENTS_FILE="requirements.txt"
|
||||||
if [[ ! -f "${DIR}/${REQUIREMENTS_FILE}" ]]; then
|
if [[ ! -f "${DIR}/${REQUIREMENTS_FILE}" ]]; then
|
||||||
echo "FAILED: ${REQUIREMENTS_FILE} needed in same directory as ubuntu.sh (${DIR})."
|
echo "[ubuntu.sh] FAILED: ${REQUIREMENTS_FILE} needed in same directory as ubuntu.sh (${DIR})."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -55,10 +58,8 @@ fi
|
|||||||
# check ubuntu version
|
# check ubuntu version
|
||||||
# otherwise warn and point to docker?
|
# otherwise warn and point to docker?
|
||||||
UBUNTU_RELEASE="`lsb_release -rs`"
|
UBUNTU_RELEASE="`lsb_release -rs`"
|
||||||
echo "Ubuntu ${UBUNTU_RELEASE}"
|
echo "[ubuntu.sh] Ubuntu ${UBUNTU_RELEASE}"
|
||||||
|
echo "[ubuntu.sh] Installing PX4 general dependencies"
|
||||||
echo
|
|
||||||
echo "Installing PX4 general dependencies"
|
|
||||||
|
|
||||||
sudo apt-get update -y --quiet
|
sudo apt-get update -y --quiet
|
||||||
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \
|
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \
|
||||||
@@ -91,7 +92,7 @@ sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends i
|
|||||||
|
|
||||||
# Python3 dependencies
|
# Python3 dependencies
|
||||||
echo
|
echo
|
||||||
echo "Installing PX4 Python3 dependencies"
|
echo "[ubuntu.sh] Installing PX4 Python3 dependencies"
|
||||||
PYTHON_VERSION=$(python3 --version 2>&1 | awk '{print $2}')
|
PYTHON_VERSION=$(python3 --version 2>&1 | awk '{print $2}')
|
||||||
REQUIRED_VERSION="3.11"
|
REQUIRED_VERSION="3.11"
|
||||||
if [[ "$(printf '%s\n' "$REQUIRED_VERSION" "$PYTHON_VERSION" | sort -V | head -n1)" == "$REQUIRED_VERSION" ]]; then
|
if [[ "$(printf '%s\n' "$REQUIRED_VERSION" "$PYTHON_VERSION" | sort -V | head -n1)" == "$REQUIRED_VERSION" ]]; then
|
||||||
@@ -109,18 +110,18 @@ fi
|
|||||||
if [[ $INSTALL_NUTTX == "true" ]]; then
|
if [[ $INSTALL_NUTTX == "true" ]]; then
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Installing NuttX dependencies"
|
echo "[ubuntu.sh] NuttX Installing Dependencies ($INSTALL_ARCH)"
|
||||||
|
sudo apt-get update -y --quiet
|
||||||
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \
|
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \
|
||||||
automake \
|
automake \
|
||||||
binutils-dev \
|
binutils-dev \
|
||||||
bison \
|
bison \
|
||||||
build-essential \
|
build-essential \
|
||||||
curl \
|
curl \
|
||||||
|
clang \
|
||||||
|
clang-tidy \
|
||||||
|
clang-format \
|
||||||
flex \
|
flex \
|
||||||
g++-multilib \
|
|
||||||
gcc-arm-none-eabi \
|
|
||||||
gcc-multilib \
|
|
||||||
gdb-multiarch \
|
gdb-multiarch \
|
||||||
genromfs \
|
genromfs \
|
||||||
gettext \
|
gettext \
|
||||||
@@ -139,6 +140,8 @@ if [[ $INSTALL_NUTTX == "true" ]]; then
|
|||||||
libstdc++-arm-none-eabi-newlib \
|
libstdc++-arm-none-eabi-newlib \
|
||||||
libtool \
|
libtool \
|
||||||
libunwind-dev \
|
libunwind-dev \
|
||||||
|
lldb \
|
||||||
|
lld \
|
||||||
pkg-config \
|
pkg-config \
|
||||||
screen \
|
screen \
|
||||||
texinfo \
|
texinfo \
|
||||||
@@ -147,6 +150,21 @@ if [[ $INSTALL_NUTTX == "true" ]]; then
|
|||||||
vim-common \
|
vim-common \
|
||||||
;
|
;
|
||||||
|
|
||||||
|
if [[ "${INSTALL_ARCH}" == "x86_64" ]]; then
|
||||||
|
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \
|
||||||
|
g++-multilib \
|
||||||
|
gcc-arm-none-eabi \
|
||||||
|
gcc-multilib \
|
||||||
|
;
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${INSTALL_ARCH}" == "aarch64" ]]; then
|
||||||
|
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \
|
||||||
|
g++-aarch64-linux-gnu \
|
||||||
|
g++-arm-linux-gnueabihf \
|
||||||
|
;
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "$USER" ]; then
|
if [ -n "$USER" ]; then
|
||||||
# add user to dialout group (serial port access)
|
# add user to dialout group (serial port access)
|
||||||
sudo usermod -aG dialout $USER
|
sudo usermod -aG dialout $USER
|
||||||
@@ -157,7 +175,7 @@ fi
|
|||||||
if [[ $INSTALL_SIM == "true" ]]; then
|
if [[ $INSTALL_SIM == "true" ]]; then
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Installing PX4 simulation dependencies"
|
echo "[ubuntu.sh] Installing PX4 simulation dependencies"
|
||||||
|
|
||||||
# General simulation dependencies
|
# General simulation dependencies
|
||||||
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \
|
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \
|
||||||
@@ -182,8 +200,8 @@ if [[ $INSTALL_SIM == "true" ]]; then
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# Expects Ubuntu 22.04 > by default
|
# Expects Ubuntu 22.04 > by default
|
||||||
echo "Gazebo (Harmonic) will be installed"
|
echo "[ubuntu.sh] Gazebo (Harmonic) will be installed"
|
||||||
echo "Earlier versions will be removed"
|
echo "[ubuntu.sh] Earlier versions will be removed"
|
||||||
# Add Gazebo binary repository
|
# Add Gazebo binary repository
|
||||||
sudo wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg
|
sudo wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg
|
||||||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null
|
||||||
|
|||||||
@@ -2,6 +2,10 @@
|
|||||||
* Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
|
* Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if defined(__GNUC__) && __GNUC__ >= 12
|
||||||
|
# pragma GCC diagnostic ignored "-Wstringop-overflow"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <uavcan/transport/frame.hpp>
|
#include <uavcan/transport/frame.hpp>
|
||||||
#include <uavcan/transport/can_io.hpp>
|
#include <uavcan/transport/can_io.hpp>
|
||||||
#include <uavcan/transport/crc.hpp>
|
#include <uavcan/transport/crc.hpp>
|
||||||
|
|||||||
Reference in New Issue
Block a user