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
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

View File

@ -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 }}