Skip to content

Conversation

@WonyoungChoi
Copy link

@WonyoungChoi WonyoungChoi commented Sep 6, 2021

Use gclient-prepare-sync script newly added instead of the .git cached directory for reducing gclient sync time.

In previous PR (#176 ), the build docker image had some cached .git directories for gclient sync time shortening, which was not a great help because of increasing download time of the docker image. 😢

Therefore, I offer a new method.

  • Make a simple docker image based on tizen-tools image.
  • Add gclient-prepare-sync script to shorten gclient-sync time. The gclient sync downloads overly many objects to perform builds, even if the --no-history option is used. This script downloads only single commit required for the build to shorten the overall gclient sync time.
  • And some scripts are added to make the build worklfow simply.

Test result: https://github.com/WonyoungChoi/engine/actions/runs/1197699330
Test worklfow: https://github.com/WonyoungChoi/engine/blob/citest/.github/workflows/build.yml

the sample build workflow:

    env:
      CACHE_PATH: src/out/linux_${{ matrix.mode }}_${{ matrix.arch }}
      CACHE_PREFIX: out-build-linux_${{ matrix.mode }}_${{ matrix.arch }}

    steps:
    - uses: actions/checkout@v2
      with:
        path: src/flutter

    - uses: actions/cache@v2
      with:
        path: ${{ env.CACHE_PATH }}
        key: ${{ env.CACHE_PREFIX }}-${{ github.sha }}
        restore-keys: |
          ${{ env.CACHE_PREFIX }}-

    - name: gclient sync
      run: |
        gclient-prepare-sync.sh --reduce-deps --shallow-sync
        gclient sync -v --no-history --shallow

    - name: prepare incremental build
      run: |
        cache-checksum.sh restore $CACHE_PATH

    - name: build
      run: |
        build-engine.sh ${{ matrix.mode }} ${{ matrix.arch }} ${{ matrix.triple }}

    - name: save checksum
      run: |
        cache-checksum.sh save $CACHE_PATH

Copy link
Member

@swift-kim swift-kim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In previous PR (#176 ), the build docker image had some cached .git directories for gclient sync time shortening, which was not a great help because of increasing download time of the docker image. 😢

Why does caching the directories increase the image downloading time? As far as I understand they are fake git directories and supposed to be small in size.

Comment on lines 6 to 9
# After `gclient sync`, the mtime of all synchronized files will be changed
# to newer than the cached out files. Therefore, this script changes the mtime
# of all files to OLD time and changes only the mtime of the changed files
# to NEW time.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this matter?

Actually the overall workflow is not very intuitive for me. For what do you restore mtimes and save checksums of files? Are both gclient-reduce-deps and gclient-fast-sync required and should they be separate files? (As far as I understand the both exist for the same reason: reducing the gclient sync time.) Why do you run gclient sync -v --no-history --shallow after gclient-fast-sync? (Isn't gclient-fast-sync supposed to replace gclient sync, assuming from its name?) Why is gclient-fast-sync.py alone a python script while other tools are written in shell script?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. The reason for restoring mtimes is for the incremental build. After gclient sync, the mtime of all synchronized files will be changed to newer than the cached out files. So ninja build will try to clean build always. to solve this problem, this script changes the mtime of all files to OLD time except new changed files.
  2. Yes, those scripts can be one. But I was difficult to set the name of that script....
  3. Please see the test workflow file: https://github.com/WonyoungChoi/engine/blob/citest/.github/workflows/build.yml.
    - name: gclient sync
      run: |
        gclient-reduce-deps
        gclient-fast-sync
        gclient sync -v --no-history --shallow
  1. gclient-fast-sync.py script uses some python classes of the depot-tools to parse DEPS file.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about gclient-prepare-sync for the merged one. looks like..

    - name: gclient sync
      run: |
        gclient-prepare-sync --reduce-deps --shallow-sync
        gclient sync -v --no-history --shallow

@WonyoungChoi
Copy link
Author

In previous PR (#176 ), the build docker image had some cached .git directories for gclient sync time shortening, which was not a great help because of increasing download time of the docker image. 😢

Why does caching the directories increase the image downloading time? As far as I understand they are fake git directories and supposed to be small in size.

In previous PR (#176 ), the cached .git directories are about dart, dart's third parties and skia. that was about 2GB size.

Use scripts newly added to improve the sync performance.
@WonyoungChoi WonyoungChoi merged commit 088466b into flutter-tizen:flutter-2.2.1-tizen Sep 7, 2021
swift-kim pushed a commit that referenced this pull request Sep 27, 2021
* [docker] Remove cached git repositories from docker image

Use scripts newly added to improve the sync performance.

* Fix format
swift-kim pushed a commit that referenced this pull request Nov 14, 2021
* [docker] Remove cached git repositories from docker image

Use scripts newly added to improve the sync performance.

* Fix format
swift-kim pushed a commit that referenced this pull request Dec 9, 2021
* [docker] Remove cached git repositories from docker image

Use scripts newly added to improve the sync performance.

* Fix format
swift-kim pushed a commit that referenced this pull request Dec 17, 2021
* [docker] Remove cached git repositories from docker image

Use scripts newly added to improve the sync performance.

* Fix format
swift-kim pushed a commit that referenced this pull request Feb 7, 2022
* [docker] Remove cached git repositories from docker image

Use scripts newly added to improve the sync performance.

* Fix format
swift-kim pushed a commit that referenced this pull request Feb 11, 2022
* [docker] Remove cached git repositories from docker image

Use scripts newly added to improve the sync performance.

* Fix format
swift-kim pushed a commit that referenced this pull request May 12, 2022
* [docker] Remove cached git repositories from docker image

Use scripts newly added to improve the sync performance.

* Fix format
swift-kim pushed a commit that referenced this pull request Aug 5, 2022
Use scripts newly added to improve the sync performance.
swift-kim pushed a commit that referenced this pull request Sep 1, 2022
Use scripts newly added to improve the sync performance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants