2 # Copyright (c) 2020, The OpenThread Authors.
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are met:
7 # 1. Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer.
9 # 2. Redistributions in binary form must reproduce the above copyright
10 # notice, this list of conditions and the following disclaimer in the
11 # documentation and/or other materials provided with the distribution.
12 # 3. Neither the name of the copyright holder nor the
13 # names of its contributors may be used to endorse or promote products
14 # derived from this software without specific prior written permission.
16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 # POSSIBILITY OF SUCH DAMAGE.
31 on: [push, pull_request]
38 - uses: rokroskar/workflow-run-cleanup-action@master
40 GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
41 if: "github.ref != 'refs/heads/master'"
44 runs-on: ubuntu-latest
47 rcp_bus: ["UART", "SPI"]
49 OT_POSIX_CONFIG_RCP_BUS: ${{matrix.rcp_bus}}
53 - uses: actions/checkout@v2
58 BUILD_TARGET: "docker-check"
59 run: tests/scripts/bootstrap.sh
61 run: tests/scripts/check-docker
69 base_image: "ubuntu:bionic"
71 platforms: "linux/amd64,linux/arm/v7,linux/arm64"
74 base_image: "ubuntu:focal"
76 platforms: "linux/amd64,linux/arm64"
78 - image_tag: "reference-device"
79 base_image: "ubuntu:bionic"
80 build_args: "--build-arg REFERENCE_DEVICE=1 --build-arg BACKBONE_ROUTER=1 --build-arg OTBR_OPTIONS='-DOT_DUA=ON -DOT_MLR=ON' --build-arg NAT64=0"
81 platforms: "linux/amd64,linux/arm/v7,linux/arm64"
84 base_image: "ubuntu:bionic"
85 build_args: "--build-arg REFERENCE_DEVICE=1 --build-arg BACKBONE_ROUTER=1 --build-arg OTBR_OPTIONS='-DOT_DUA=ON -DOT_MLR=ON' --build-arg OT_BACKBONE_CI=1"
86 platforms: "linux/amd64,linux/arm/v7,linux/arm64"
89 - uses: actions/checkout@v2
93 uses: docker/setup-qemu-action@v1
96 - name: Set up Docker Buildx
98 uses: docker/setup-buildx-action@v1
102 DOCKER_IMAGE=openthread/otbr
103 DOCKER_PLATFORMS=${{ matrix.platforms }}
104 VERSION=${{ matrix.image_tag }}
106 TAGS="--tag ${DOCKER_IMAGE}:${VERSION}"
108 echo ::set-output name=docker_image::${DOCKER_IMAGE}
109 echo ::set-output name=version::${VERSION}
110 echo ::set-output name=buildx_args::"--platform ${DOCKER_PLATFORMS} \
111 --build-arg BASE_IMAGE=${{ matrix.base_image }} \
112 --build-arg VERSION=${VERSION} \
113 --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
114 --build-arg VCS_REF=${GITHUB_SHA::8} \
115 ${{ matrix.build_args }} \
116 ${TAGS} --file etc/docker/Dockerfile ."
118 - name: Docker Buildx (build)
120 docker buildx build --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args }}
123 if: success() && github.repository == 'openthread/ot-br-posix' && github.event_name != 'pull_request' && matrix.push
125 DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
126 DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
128 echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
130 - name: Docker Buildx (push)
131 if: success() && github.repository == 'openthread/ot-br-posix' && github.event_name != 'pull_request' && matrix.push
133 docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }}
135 - name: Docker Check Manifest
136 if: always() && github.repository == 'openthread/ot-br-posix' && github.event_name != 'pull_request' && matrix.push
138 docker run --rm mplatform/mquery ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}
141 if: always() && github.repository == 'openthread/ot-br-posix' && github.event_name != 'pull_request' && matrix.push
143 rm -f ${HOME}/.docker/config.json