Skip to content

Commit

Permalink
[ci] Add gen_snapshot artifacts (flutter-tizen#227)
Browse files Browse the repository at this point in the history
* [ci] Add gen_snapshot artifacts

* Remove printing environment values

* Apply shallow gclient sync

* Apply cache to macos-build job
  • Loading branch information
WonyoungChoi authored Dec 26, 2021
1 parent 87fab19 commit c8a9118
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 6 deletions.
124 changes: 120 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,13 @@ jobs:
if: matrix.os == 'host'
with:
name: host-${{ matrix.arch }}-${{ matrix.mode }}
path: |
src/out/${{ env.OUTPUT_NAME }}/*_unittests
path: src/out/${{ env.OUTPUT_NAME }}/*_unittests

- uses: actions/upload-artifact@v2
if: matrix.os == 'linux'
with:
name: tizen-${{ matrix.arch }}-${{ matrix.mode }}
path: |
src/out/${{ env.OUTPUT_NAME }}/libflutter_*.so
path: src/out/${{ env.OUTPUT_NAME }}/libflutter_*.so

- uses: actions/upload-artifact@v2
if: matrix.arch == 'arm' && matrix.mode == 'release'
Expand All @@ -101,6 +99,124 @@ jobs:
src/out/linux_release_arm/cpp_client_wrapper
!src/out/linux_release_arm/cpp_client_wrapper/engine_method_result.cc
- uses: actions/upload-artifact@v2
if: (matrix.arch == 'arm' || matrix.arch == 'arm64') && (matrix.mode == 'release' || matrix.mode == 'profile')
with:
name: tizen-${{ matrix.arch }}-${{ matrix.mode }}_linux-x64
path: src/out/${{ env.OUTPUT_NAME }}/clang_x64/gen_snapshot

windows-build:
runs-on: windows-2019

strategy:
matrix:
arch: [arm, arm64]
mode: [release, profile]

steps:
- name: checkout engine
run: |
mkdir C:\workspace\engine\src\flutter
cd C:\workspace\engine\src\flutter
git config --global core.autocrlf true
git init --quiet
git remote add origin https://github.com/${{ github.repository }}
git fetch --depth 1 origin ${{ github.sha }}
git checkout FETCH_HEAD
- name: setup environments
run: |
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -Force
echo "DEPOT_TOOLS_WIN_TOOLCHAIN=0" >> $Env:GITHUB_ENV
echo "GYP_MSVS_OVERRIDE_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise" >> $Env:GITHUB_ENV
echo "WINDOWSSDKDIR=C:\Program Files (x86)\Windows Kits\10" >> $Env:GITHUB_ENV
- name: install depot_tools
run: |
Invoke-WebRequest -Uri https://storage.googleapis.com/chrome-infra/depot_tools.zip -OutFile depot_tools.zip
7z x -y -o"C:\workspace\depot_tools" .\depot_tools.zip
echo "C:\workspace\depot_tools" >> $Env:GITHUB_PATH
- name: gclient sync
working-directory: C:\workspace\engine
run: |
gclient config --name=src\flutter --unmanaged https://github.com/flutter-tizen/engine
$env:PYTHONPATH="C:\workspace\depot_tools"
python3 src\flutter\ci\tizen\gclient-shallow-sync.py src\flutter\DEPS
gclient sync -v --no-history --shallow
- name: build
working-directory: C:\workspace\engine\src
run: |
python3 .\flutter\tools\gn `
--linux --linux-cpu=${{ matrix.arch }} `
--runtime-mode=${{ matrix.mode }} `
--no-goma
ninja -C .\out\linux_${{ matrix.mode }}_${{ matrix.arch }} gen_snapshot
- uses: actions/upload-artifact@v2
with:
name: tizen-${{ matrix.arch }}-${{ matrix.mode }}_windows-x64
path: C:\workspace\engine\src\out\linux_${{ matrix.mode }}_${{ matrix.arch }}\gen_snapshot.exe

macos-build:
runs-on: macos-11

strategy:
matrix:
arch: [arm, arm64]
mode: [release, profile]

env:
OUTPUT_NAME: linux_${{ matrix.mode }}_${{ matrix.arch }}

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

- uses: actions/cache@v2
with:
path: src/out/${{ env.OUTPUT_NAME }}
key: out-macos-build-${{ env.OUTPUT_NAME }}-${{ github.sha }}
restore-keys: |
out-macos-build-${{ env.OUTPUT_NAME }}-
- name: install depot_tools
run: |
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
echo "$PWD/depot_tools" >> $GITHUB_PATH
- name: install required packages
run: |
brew install md5sha1sum
- name: gclient sync
run: |
gclient config --name=src/flutter --unmanaged https://github.com/flutter-tizen/engine
gclient setdep --var=download_android_deps=False --deps-file=src/flutter/DEPS
PYTHONPATH="$PWD/depot_tools" python3 ./src/flutter/ci/tizen/gclient-shallow-sync.py src/flutter/DEPS
gclient sync -v --no-history --shallow
- name: build
run: |
src/flutter/ci/tizen/cache-checksum.sh restore src/out/$OUTPUT_NAME
# Change host_toolchain to mac/clang_x64.
sed -i "" "s|//build/toolchain/linux:clang_$host_cpu|//build/toolchain/mac:clang_$host_cpu|g" src/build/config/BUILDCONFIG.gn
# Pass dummy toolchain values to avoid using linux target toolchain settings.
python3 ./src/flutter/tools/gn \
--linux --linux-cpu=${{ matrix.arch }} \
--runtime-mode=${{ matrix.mode }} \
--no-goma \
--target-toolchain _ --target-sysroot _ --target-triple _
ninja -C ./src/out/$OUTPUT_NAME clang_x64/gen_snapshot
src/flutter/ci/tizen/cache-checksum.sh save src/out/$OUTPUT_NAME
- uses: actions/upload-artifact@v2
with:
name: tizen-${{ matrix.arch }}-${{ matrix.mode }}_darwin-x64
path: src/out/linux_${{ matrix.mode }}_${{ matrix.arch }}/clang_x64/gen_snapshot

test:
needs: build
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion ci/tizen/cache-checksum.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ if [[ "$COMMAND" == "restore" ]]; then

# Set mtime of files in $TARGET_DIRS to OLD time.
for d in $(find $TARGET_DIRS -type d); do
touch -c -m -d @1600000000 $d/* &
touch -t 202001010000 $d/* &
done

# Set mtime of changed files to NEW time.
Expand Down
6 changes: 5 additions & 1 deletion tools/gn
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def to_gn_args(args):
# attributes in release modes till the toolchain is updated.
gn_args['skia_enable_api_available_macro'] = args.runtime_mode != "release"

if sys.platform == 'darwin' and args.target_os not in ['android', 'fuchsia']:
if sys.platform == 'darwin' and args.target_os not in ['android', 'fuchsia', 'linux']:
# OpenGL is deprecated on macOS > 10.11.
# This is not necessarily needed but enabling this until we have a way to
# build a macOS metal only shell and a gl only shell.
Expand Down Expand Up @@ -390,6 +390,10 @@ def to_gn_args(args):
if args.target_os in ['android'] and gn_args['target_cpu'] in ['x64' , 'arm64']:
gn_args['dart_use_compressed_pointers'] = True

# Don't use the default linux sysroot when buliding for Linux on MacOS
if sys.platform == 'darwin' and args.target_os == 'linux':
gn_args['use_default_linux_sysroot'] = False

return gn_args

def parse_args(args):
Expand Down

0 comments on commit c8a9118

Please sign in to comment.