From b8a12592085d550e8e396075ff58348e89480a45 Mon Sep 17 00:00:00 2001 From: Hyeongseok Oh Date: Fri, 10 Jan 2025 12:16:10 +0900 Subject: [PATCH] [infra/github] Intrdocue docker build workflow This commit introduces a GitHub Actions workflow to build docker image and test, and push it to the docker hub. ONE-DCO-1.0-Signed-off-by: Hyeongseok Oh --- .github/workflows/build-dev-docker.yml | 59 ++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/build-dev-docker.yml diff --git a/.github/workflows/build-dev-docker.yml b/.github/workflows/build-dev-docker.yml new file mode 100644 index 00000000000..efdc31cc1da --- /dev/null +++ b/.github/workflows/build-dev-docker.yml @@ -0,0 +1,59 @@ +name: Build docker image for development and CI/CD +on: + push: + branches: + - master + - release/* + paths: + - '.github/workflow/build-dev-docker.yml' + - 'infra/docker/**' + pull_request: + branches: + - master + - release/* + paths: + - '.github/workflow/build-dev-docker.yml' + - 'infra/docker/**' + +jobs: + # Build on docker CLI for PR test without login + build-pr-test: + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + matrix: + version: [ 'android-sdk', 'focal', 'jammy', 'noble' ] + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Build Docker Image + run: | + ./nnas build-docker-image --codename ${{ matrix.version }} --tag one-test + + - name: Test onert build + if: matrix.version != 'android-sdk' + run: | + DOCKER_IMAGE_NAME=one-test ./nnas docker-run make -f Makefile.template + + # Use github action for build and push to docker hub + build-docker-image: + if: github.event_name == 'push' && github.repository_owner == 'Samsung' + runs-on: ubuntu-latest + matrix: + version: [ 'android-sdk', 'focal', 'jammy', 'noble' ] + steps: + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Install Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build Docker Image + uses: docker/build-push-action@v6 + with: + file: ./infra/docker/${{ matrix.version }}/Dockerfile + push: true + tags: nnfw/one-devtools:${{ matrix.version }}