docker_linux.yml: Use docker actions to build docker.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
This commit is contained in:
Abdelatif Guettouche 2022-02-24 21:17:25 +01:00 committed by Alan Carvalho de Assis
parent fbc1da98b7
commit d437921f82
2 changed files with 34 additions and 17 deletions

View File

@ -104,6 +104,7 @@ jobs:
- name: Tar sources - name: Tar sources
run: tar zcf sources.tar.gz sources run: tar zcf sources.tar.gz sources
- name: Archive Source Bundle - name: Archive Source Bundle
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v1
with: with:
@ -126,19 +127,23 @@ jobs:
with: with:
name: source-bundle name: source-bundle
path: . path: .
- name: Extract sources - name: Extract sources
run: tar zxf sources.tar.gz run: tar zxf sources.tar.gz
- name: Docker Login - name: Docker Login
uses: azure/docker-login@v1 uses: docker/login-action@v1
with: with:
login-server: ghcr.io registry: ghcr.io
username: ${GITHUB_ACTOR} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker Pull - name: Docker Pull
run: docker pull ghcr.io/apache/incubator-nuttx/apache-nuttx-ci-linux run: docker pull ghcr.io/apache/incubator-nuttx/apache-nuttx-ci-linux
- name: Export NuttX Repo SHA - name: Export NuttX Repo SHA
run: echo "nuttx_sha=`git -C sources/nuttx rev-parse HEAD`" >> $GITHUB_ENV run: echo "nuttx_sha=`git -C sources/nuttx rev-parse HEAD`" >> $GITHUB_ENV
- name: Run builds - name: Run builds
uses: ./sources/nuttx/.github/actions/ci-container uses: ./sources/nuttx/.github/actions/ci-container
env: env:
@ -152,6 +157,7 @@ jobs:
cd sources/nuttx/tools/ci cd sources/nuttx/tools/ci
./cibuild.sh -A -R -c testlist/${{matrix.boards}}.dat ./cibuild.sh -A -R -c testlist/${{matrix.boards}}.dat
ccache -s ccache -s
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
with: with:
name: linux-builds name: linux-builds
@ -170,8 +176,10 @@ jobs:
with: with:
name: source-bundle name: source-bundle
path: . path: .
- name: Extract sources - name: Extract sources
run: tar zxf sources.tar.gz run: tar zxf sources.tar.gz
- name: Restore Tools Cache - name: Restore Tools Cache
id: cache-tools id: cache-tools
uses: actions/cache@v2 uses: actions/cache@v2
@ -183,6 +191,7 @@ jobs:
- name: Export NuttX Repo SHA - name: Export NuttX Repo SHA
run: echo "nuttx_sha=`git -C sources/nuttx rev-parse HEAD`" >> $GITHUB_ENV run: echo "nuttx_sha=`git -C sources/nuttx rev-parse HEAD`" >> $GITHUB_ENV
- name: Run Builds - name: Run Builds
run: | run: |
echo "::add-matcher::sources/nuttx/.github/gcc.json" echo "::add-matcher::sources/nuttx/.github/gcc.json"
@ -192,6 +201,7 @@ jobs:
cd sources/nuttx/tools/ci cd sources/nuttx/tools/ci
./cibuild.sh -i -A -R -c testlist/${{matrix.boards}}.dat ./cibuild.sh -i -A -R -c testlist/${{matrix.boards}}.dat
ccache -s ccache -s
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
with: with:
name: macos-builds name: macos-builds

View File

@ -39,25 +39,32 @@ jobs:
push: push:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
DOCKER_BUILDKIT: 1
IMAGE_TAG: ghcr.io/${{ github.repository }}/apache-nuttx-ci-linux IMAGE_TAG: ghcr.io/${{ github.repository }}/apache-nuttx-ci-linux
steps: steps:
- uses: actions/checkout@v2 - name: Checkout repository
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log into registry - name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Linux image - name: Build Linux image
run: | uses: docker/build-push-action@v2
echo "Building Linux Image using cache from $IMAGE_TAG" with:
context: tools/ci/docker/linux
load: true
tags: ${{ env.IMAGE_TAG }}
docker build \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--cache-from $IMAGE_TAG \
--tag $IMAGE_TAG \
-f ./tools/ci/docker/linux/Dockerfile ./tools/ci/docker/
- name: Push Linux image - name: Push Linux image
if: (github.event_name == 'push') && (github.ref == 'refs/heads/master') uses: docker/build-push-action@v2
run: | with:
docker push $IMAGE_TAG context: tools/ci/docker/linux
platforms: linux/amd64
push: ${{ github.ref == 'refs/heads/master' }}
tags: ${{ env.IMAGE_TAG }}