You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2022/02/25 12:43:47 UTC

[incubator-nuttx] 01/02: docker_linux.yml: Use docker actions to build docker.

This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit d437921f82d8b2b42c6f8c1621b533e8a5332625
Author: Abdelatif Guettouche <ab...@espressif.com>
AuthorDate: Thu Feb 24 21:17:25 2022 +0100

    docker_linux.yml: Use docker actions to build docker.
    
    Signed-off-by: Abdelatif Guettouche <ab...@espressif.com>
---
 .github/workflows/build.yml        | 16 +++++++++++++---
 .github/workflows/docker_linux.yml | 37 ++++++++++++++++++++++---------------
 2 files changed, 35 insertions(+), 18 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 73df4ed..2c13a5c 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -104,6 +104,7 @@ jobs:
 
       - name: Tar sources
         run: tar zcf sources.tar.gz sources
+
       - name: Archive Source Bundle
         uses: actions/upload-artifact@v1
         with:
@@ -126,19 +127,23 @@ jobs:
         with:
           name: source-bundle
           path: .
+
       - name: Extract sources
         run: tar zxf sources.tar.gz
+
       - name: Docker Login
-        uses: azure/docker-login@v1
+        uses: docker/login-action@v1
         with:
-          login-server: ghcr.io
-          username: ${GITHUB_ACTOR}
+          registry: ghcr.io
+          username: ${{ github.actor }}
           password: ${{ secrets.GITHUB_TOKEN }}
 
       - name: Docker Pull
         run: docker pull ghcr.io/apache/incubator-nuttx/apache-nuttx-ci-linux
+
       - name: Export NuttX Repo SHA
         run: echo "nuttx_sha=`git -C sources/nuttx rev-parse HEAD`" >> $GITHUB_ENV
+
       - name: Run builds
         uses: ./sources/nuttx/.github/actions/ci-container
         env:
@@ -152,6 +157,7 @@ jobs:
             cd sources/nuttx/tools/ci
             ./cibuild.sh -A -R -c testlist/${{matrix.boards}}.dat
             ccache -s
+
       - uses: actions/upload-artifact@v2
         with:
           name: linux-builds
@@ -170,8 +176,10 @@ jobs:
         with:
           name: source-bundle
           path: .
+
       - name: Extract sources
         run: tar zxf sources.tar.gz
+
       - name: Restore Tools Cache
         id: cache-tools
         uses: actions/cache@v2
@@ -183,6 +191,7 @@ jobs:
 
       - name: Export NuttX Repo SHA
         run: echo "nuttx_sha=`git -C sources/nuttx rev-parse HEAD`" >> $GITHUB_ENV
+
       - name: Run Builds
         run: |
           echo "::add-matcher::sources/nuttx/.github/gcc.json"
@@ -192,6 +201,7 @@ jobs:
           cd sources/nuttx/tools/ci
           ./cibuild.sh -i -A -R -c testlist/${{matrix.boards}}.dat
           ccache -s
+
       - uses: actions/upload-artifact@v2
         with:
           name: macos-builds
diff --git a/.github/workflows/docker_linux.yml b/.github/workflows/docker_linux.yml
index 83a7600..422bb84 100644
--- a/.github/workflows/docker_linux.yml
+++ b/.github/workflows/docker_linux.yml
@@ -39,25 +39,32 @@ jobs:
   push:
     runs-on: ubuntu-latest
     env:
-      DOCKER_BUILDKIT: 1
       IMAGE_TAG: ghcr.io/${{ github.repository }}/apache-nuttx-ci-linux
     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
-        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
-        run: |
-          echo "Building Linux Image using cache from $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/
-        
+        uses: docker/build-push-action@v2
+        with:
+          context: tools/ci/docker/linux
+          load: true
+          tags: ${{ env.IMAGE_TAG }}
+
       - name: Push Linux image
-        if: (github.event_name == 'push') && (github.ref == 'refs/heads/master')
-        run: |
-          docker push $IMAGE_TAG
+        uses: docker/build-push-action@v2
+        with:
+          context: tools/ci/docker/linux
+          platforms: linux/amd64
+          push: ${{ github.ref == 'refs/heads/master' }}
+          tags: ${{ env.IMAGE_TAG }}