Newer
Older
mbed-os / .github / workflows / docker_management.test-PR.yml
name: Build docker image

# This workflow is triggered when Dockerfile related or github action itself changes are made in a PR
# The workflow is quite simple - builds and test the image. Release of newer version is done only when PR is merged.
# Design doc: https://github.com/ARMmbed/mbed-os/blob/master/docs/design-documents/docker_management

on:
  pull_request:
    branches: [ master ]
    paths:
      - docker_images/mbed-os-env/**
      - .github/workflows/docker_management.*
      - requirements.txt

jobs:

  build-container:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        platform: [linux/amd64, linux/arm64]

    steps:

      - 
        name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1

      - 
        name: Set up QEMU
        uses: docker/setup-qemu-action@v1

      # for PR tests, development branch of blinky is used
      - 
        name: Checkout
        uses: actions/checkout@v2
        with:
          repository: ARMmbed/mbed-os-example-blinky
          path: mbed-os-example-blinky
          ref: development

      -
        name: Remove mbed-os from example-application
        shell: bash
        run: |
          cd mbed-os-example-blinky
          rm -rf mbed-os

      -
        name: Checkout
        uses: actions/checkout@v2
        with:
          path: mbed-os-example-blinky/mbed-os
        
      -
        name: Build container
        uses: docker/build-push-action@v2
        id: docker_build_dev
        with:
          context: ./mbed-os-example-blinky/mbed-os
          platforms: ${{ matrix.platform }}
          file: ./mbed-os-example-blinky/mbed-os/docker_images/mbed-os-env/Dockerfile
          load: true
          tags: mbed-os-env:a_pr_test
          
      - 
        name: test the container
        id: test
        uses: addnab/docker-run-action@v2
        with:
          options: -v ${{ github.workspace }}:/work -w=/work
          image: mbed-os-env:a_pr_test
          shell: bash
          run: |
            uname -m
            cd mbed-os-example-blinky
            # build using CLI1
            mbed compile -m K64F -t GCC_ARM

            # build using CLI2
            mbed-tools compile -m K64F -t GCC_ARM