mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-30 04:06:33 +08:00
github: build nuttx with docker
This commit is contained in:
@@ -1,11 +1,18 @@
|
|||||||
# Build docker image
|
# build docker images on:
|
||||||
# Always builds by default
|
# * every pull request
|
||||||
# Only pushes to registry if:
|
# * push to master
|
||||||
|
# * stable release published
|
||||||
|
# * tag name is:
|
||||||
|
# - commit sha if pull request
|
||||||
|
# - 'latest' if push to master
|
||||||
|
# - release name if release
|
||||||
|
|
||||||
|
# pushes to registry if:
|
||||||
# * is not a pull request
|
# * is not a pull request
|
||||||
# * is master branch
|
# * is master branch
|
||||||
# * tag as 'latest'
|
|
||||||
# * is the result of release
|
# * is the result of release
|
||||||
# * tag with release name
|
|
||||||
|
# builds all nuttx targets and deploys metadata
|
||||||
|
|
||||||
name: Build docker
|
name: Build docker
|
||||||
|
|
||||||
@@ -17,10 +24,21 @@ on:
|
|||||||
- 'main'
|
- 'main'
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
|
env:
|
||||||
|
TAG_NAME: |
|
||||||
|
${{
|
||||||
|
github.event_name == 'pull_request' && github.sha ||
|
||||||
|
(
|
||||||
|
github.event_name == 'push' && 'latest' ||
|
||||||
|
github.event.release.name
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-docker:
|
build_docker:
|
||||||
name: Build Docker image
|
name: Build Docker image
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
@@ -38,8 +56,15 @@ jobs:
|
|||||||
id: docker_build
|
id: docker_build
|
||||||
with:
|
with:
|
||||||
file: Tools/setup/Dockerfile
|
file: Tools/setup/Dockerfile
|
||||||
push: github.event_name != 'pull_request'
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
tags: px4io/px4-dev:${{ github.event_name == 'push' && github.event.release.name || 'latest' }}
|
tags: "px4io/px4-dev:${{ env.TAG_NAME }}"
|
||||||
|
outputs: type=tar,dest=/tmp/px4image.tar
|
||||||
|
|
||||||
|
- name: Save container to artifacts
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: px4image
|
||||||
|
path: /tmp/px4image.tar
|
||||||
|
|
||||||
- name: Push to Github Registry
|
- name: Push to Github Registry
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
@@ -47,3 +72,42 @@ jobs:
|
|||||||
|
|
||||||
- name: Image Digest
|
- name: Image Digest
|
||||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||||
|
|
||||||
|
enumerate_targets:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build_docker
|
||||||
|
outputs:
|
||||||
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- id: set-matrix
|
||||||
|
name: Get all nuttx targets
|
||||||
|
run: echo "::set-output name=matrix::$(./Tools/generate_board_targets_json.py -a)"
|
||||||
|
|
||||||
|
build_px4:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: enumerate_targets
|
||||||
|
strategy:
|
||||||
|
matrix: ${{ fromJson(needs.enumerate_targets.outputs.matrix) }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Get container from artifacts
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: px4image
|
||||||
|
path: /tmp
|
||||||
|
|
||||||
|
- name: Load Docker image
|
||||||
|
run: |
|
||||||
|
docker load --input /tmpt/px4image.tar
|
||||||
|
docker image ls -a
|
||||||
|
|
||||||
|
- name: Build the world
|
||||||
|
run: |
|
||||||
|
DOCKER_TAG="px4io/px4-dev:${{ env.TAG_NAME }}" ./Tools/docker.run.sh make ${{ matrix.target }}
|
||||||
|
|||||||
Reference in New Issue
Block a user