From d5d06b819715476b6c3edd4b1dd8c65b92738aa4 Mon Sep 17 00:00:00 2001 From: WonYoung Choi Date: Mon, 30 Aug 2021 19:27:48 +0900 Subject: [PATCH 1/4] Make an image for the environment to build engine source New docker image named "build-engine" contains the following: - Additional ubuntu packages : git curl ca-certificates python xz-utils pkg-config libncurses5 libfreetype6-dev - depot_tools - some .git cached directories to reduce gclient sync time. (dart/**/.git, skia/.git) --- .github/workflows/build-docker.yml | 37 ++++++++++++++++++++++ ci/docker/tizen/Dockerfile | 49 ++++++++++++++++++++++++++++++ ci/docker/tizen/build-docker.sh | 8 +++++ ci/docker/tizen/prepare-sync.sh | 33 ++++++++++++++++++++ 4 files changed, 127 insertions(+) create mode 100644 .github/workflows/build-docker.yml create mode 100644 ci/docker/tizen/Dockerfile create mode 100755 ci/docker/tizen/build-docker.sh create mode 100755 ci/docker/tizen/prepare-sync.sh diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml new file mode 100644 index 0000000000000..cadcfb65b5daa --- /dev/null +++ b/.github/workflows/build-docker.yml @@ -0,0 +1,37 @@ +name: Build Docker + +on: + push: + branches: + - 'flutter-*' + paths: + - 'ci/docker/tizen/**' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Extract branch name + id: branch + run: echo "##[set-output name=name;]$(echo ${GITHUB_REF#refs/heads/})" + + - uses: actions/checkout@v2 + + - uses: docker/setup-buildx-action@v1 + + - uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: ci/docker/tizen + file: ci/docker/tizen/Dockerfile + push: true + build-args: + GIT_BRANCH=${{ steps.branch.outputs.name }} + tags: | + ghcr.io/${{ github.repository_owner }}/build-engine:latest diff --git a/ci/docker/tizen/Dockerfile b/ci/docker/tizen/Dockerfile new file mode 100644 index 0000000000000..68b2624d1785f --- /dev/null +++ b/ci/docker/tizen/Dockerfile @@ -0,0 +1,49 @@ +################# +# Builder stage # +################# + +FROM debian:buster-slim AS builder + +ARG GIT_BRANCH=master + +RUN apt-get update && \ + apt-get install -y git curl ca-certificates python && \ + apt-get clean + +# Install depot tools. +ENV DEPOT_TOOLS_PATH=/usr/share/depot_tools +ENV PATH=$PATH:${DEPOT_TOOLS_PATH} +RUN git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git ${DEPOT_TOOLS_PATH} + +# Sync engine and dependencies. +WORKDIR /engine +RUN git clone --depth 1 -b $GIT_BRANCH https://github.com/flutter-tizen/engine src/flutter + +RUN gclient config --name="src/flutter" --deps-file="DEPS" --unmanaged https://github.com/flutter-tizen/engine.git +RUN gclient setdep --var=download_android_deps=False --deps-file=src/flutter/DEPS +RUN gclient sync -f -D --no-history --shallow + +# Copy selected .git directories. +RUN mkdir -p cache +RUN for x in $(find src/third_party/ -name .git -a \( -wholename "*/dart/*" -o -wholename "*/skia/*" \)); do \ + mkdir -p cache/$x; \ + cp -fr $x/* cache/$x; \ + done + + +############################# +# build-engine docker image # +############################# + +FROM ghcr.io/flutter-tizen/tizen-tools:latest + +RUN apt-get update && \ + apt-get install -y git curl ca-certificates python xz-utils pkg-config \ + libncurses5 libfreetype6-dev && \ + apt-get clean + +COPY --from=builder /usr/share/depot_tools /usr/share/depot_tools +COPY --from=builder /engine/cache /engine/cache +ADD prepare-sync.sh /engine/tools/ + +ENV PATH=$PATH:/usr/share/depot_tools:/engine/tools diff --git a/ci/docker/tizen/build-docker.sh b/ci/docker/tizen/build-docker.sh new file mode 100755 index 0000000000000..70e65b1ab72ee --- /dev/null +++ b/ci/docker/tizen/build-docker.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +IMAGE_NAME=ghcr.io/flutter-tizen/build-engine +IMAGE_TAG=latest +GIT_BRANCH=flutter-2.2.1-tizen + +docker pull $IMAGE_NAME:$IMAGE_TAG +docker build --build-arg GIT_BRANCH=$GIT_BRANCH --tag $IMAGE_NAME:$IMAGE_TAG . diff --git a/ci/docker/tizen/prepare-sync.sh b/ci/docker/tizen/prepare-sync.sh new file mode 100755 index 0000000000000..d5440259c9b6f --- /dev/null +++ b/ci/docker/tizen/prepare-sync.sh @@ -0,0 +1,33 @@ +#!/bin/bash -e + +DEPS=src/flutter/DEPS + +if [ ! -f $DEPS ]; then + echo "Could not find DEPS file." + exit 1 +fi + +cat > .gclient << EOF +solutions = [ + { "name" : 'src/flutter', + "url" : 'https://github.com/flutter-tizen/engine.git', + "deps_file" : 'DEPS', + "managed" : False, + "custom_deps" : { + }, + "custom_vars": {}, + }, +] +EOF + +gclient setdep --var=download_android_deps=False --deps-file=$DEPS + +sed -i -e '/src\/ios_tools/,+2d' $DEPS +sed -i -e '/src\/third_party\/vulkan/,+2d' $DEPS +sed -i -e '/src\/third_party\/angle/,+2d' $DEPS +sed -i -e '/src\/third_party\/abseil-cpp/,+2d' $DEPS +sed -i -e '/src\/fuchsia\/sdk\/linux/,+9d' $DEPS + +if [ -d /engine/cache ]; then + cp -fr /engine/cache/* . +fi From 021a423cc0e9b86e584c8999f46b0fd98e095a53 Mon Sep 17 00:00:00 2001 From: WonYoung Choi Date: Wed, 1 Sep 2021 12:30:11 +0900 Subject: [PATCH 2/4] Remove hard-coded branch name in build-docker.sh --- ci/docker/tizen/Dockerfile | 8 ++++++-- ci/docker/tizen/build-docker.sh | 3 +-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ci/docker/tizen/Dockerfile b/ci/docker/tizen/Dockerfile index 68b2624d1785f..623d62583642a 100644 --- a/ci/docker/tizen/Dockerfile +++ b/ci/docker/tizen/Dockerfile @@ -4,7 +4,7 @@ FROM debian:buster-slim AS builder -ARG GIT_BRANCH=master +ARG GIT_BRANCH RUN apt-get update && \ apt-get install -y git curl ca-certificates python && \ @@ -17,7 +17,11 @@ RUN git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_t # Sync engine and dependencies. WORKDIR /engine -RUN git clone --depth 1 -b $GIT_BRANCH https://github.com/flutter-tizen/engine src/flutter +RUN if [ -n "$GIT_BRANCH" ]; then \ + git clone --depth 1 -b $GIT_BRANCH https://github.com/flutter-tizen/engine src/flutter; \ + else \ + git clone --depth 1 https://github.com/flutter-tizen/engine src/flutter; \ + fi RUN gclient config --name="src/flutter" --deps-file="DEPS" --unmanaged https://github.com/flutter-tizen/engine.git RUN gclient setdep --var=download_android_deps=False --deps-file=src/flutter/DEPS diff --git a/ci/docker/tizen/build-docker.sh b/ci/docker/tizen/build-docker.sh index 70e65b1ab72ee..71bb7a5a418ac 100755 --- a/ci/docker/tizen/build-docker.sh +++ b/ci/docker/tizen/build-docker.sh @@ -2,7 +2,6 @@ IMAGE_NAME=ghcr.io/flutter-tizen/build-engine IMAGE_TAG=latest -GIT_BRANCH=flutter-2.2.1-tizen docker pull $IMAGE_NAME:$IMAGE_TAG -docker build --build-arg GIT_BRANCH=$GIT_BRANCH --tag $IMAGE_NAME:$IMAGE_TAG . +docker build --tag $IMAGE_NAME:$IMAGE_TAG . From 1d91952b41c5ae93bc5324eb544d86f4002d6686 Mon Sep 17 00:00:00 2001 From: WonYoung Choi Date: Wed, 1 Sep 2021 12:53:30 +0900 Subject: [PATCH 3/4] Add DEPS to path filter of the build-docker workflow. --- .github/workflows/build-docker.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index cadcfb65b5daa..ec98964c6cf8f 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -6,6 +6,7 @@ on: - 'flutter-*' paths: - 'ci/docker/tizen/**' + - 'DEPS' jobs: build: From b752f5c693178ff7a81b11a373f3ad4fed1b7a98 Mon Sep 17 00:00:00 2001 From: WonYoung Choi Date: Thu, 2 Sep 2021 07:50:23 +0900 Subject: [PATCH 4/4] Remove redundant lines of .gclient --- ci/docker/tizen/prepare-sync.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/ci/docker/tizen/prepare-sync.sh b/ci/docker/tizen/prepare-sync.sh index d5440259c9b6f..0fffaf99ddb9c 100755 --- a/ci/docker/tizen/prepare-sync.sh +++ b/ci/docker/tizen/prepare-sync.sh @@ -13,9 +13,6 @@ solutions = [ "url" : 'https://github.com/flutter-tizen/engine.git', "deps_file" : 'DEPS', "managed" : False, - "custom_deps" : { - }, - "custom_vars": {}, }, ] EOF