Skip to content

Commit

Permalink
[ci] Add CI workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
swift-kim committed Nov 2, 2022
1 parent f6c9c2d commit 4b1d816
Show file tree
Hide file tree
Showing 5 changed files with 302 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/analyze.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Analyze

on:
push:
pull_request:

jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
path: src

- name: Install depot_tools
run: |
git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
echo "$PWD/depot_tools" >> $GITHUB_PATH
- name: Run gclient sync
run: |
pip3 install requests
gclient config --name=src --unmanaged https://github.com/${{ github.repository }}
gclient sync -v --no-history --shallow --nohooks
- name: Verify C/C++ formatting
working-directory: src
run: |
FILES=$(git ls-files -- '*.h' '*.cc' '*.cpp' | grep -v /third_party/)
third_party/clang/bin/clang-format --style=file --dry-run --Werror $FILES
- name: Verify GN formatting
working-directory: src
run: |
FILES=$(git ls-files -- '*.gn' '*.gni')
third_party/gn/gn format --dry-run $FILES
32 changes: 32 additions & 0 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build Docker

on:
push:
branches:
- master
paths:
- .github/workflows/build-docker.yml
workflow_dispatch:

jobs:
testbed:
runs-on: ubuntu-latest
steps:
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
env:
REPO_URL: http://download.tizen.org/releases/milestone/tizen/unified
BUILD_ID: tizen-unified_20220517.1
IMAGE: tizen-headed-armv7l
run: |
wget -q ${REPO_URL}/${BUILD_ID}/images/standard/${IMAGE}/${BUILD_ID}_${IMAGE}.tar.gz
tar -zxf ${BUILD_ID}_${IMAGE}.tar.gz
mkdir rootfs
sudo mount rootfs.img rootfs
sudo tar -cC rootfs . | docker import - ghcr.io/${{ github.repository_owner }}/${IMAGE}
sudo umount rootfs
docker push ghcr.io/${{ github.repository_owner }}/${IMAGE}:latest
160 changes: 160 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
name: Build

on:
push:
pull_request:

jobs:
build:
runs-on: ubuntu-22.04

strategy:
matrix:
api-version: [5.5, 6.5]
arch: [arm, arm64, x86]
include:
- arch: arm
triple: arm-linux-gnueabi
- arch: arm64
triple: aarch64-linux-gnu
- arch: x86
triple: i686-linux-gnu

steps:
- uses: actions/checkout@v3
with:
path: src

- uses: actions/cache@v3
with:
path: src/sysroot*
key: sysroot-${{ matrix.api-version }}

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y rpm2cpio cpio binutils-${{ matrix.triple }}
pip3 install requests
- name: Install depot_tools
run: |
git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
echo "$PWD/depot_tools" >> $GITHUB_PATH
- name: Run gclient sync
run: |
gclient config --name=src --unmanaged https://github.com/${{ github.repository }}
gclient sync -v --no-history --shallow
- name: Generate Tizen 6.5 sysroot
if: ${{ matrix.api-version == 6.5 }}
run: src/tools/generate_sysroot.py --api-version 6.5 --out src/sysroot-6.5

- name: Build for Tizen 5.5
if: ${{ matrix.api-version == 5.5 }}
run: |
src/tools/gn \
--target-cpu ${{ matrix.arch }} \
--target-toolchain /usr/lib/llvm-14 \
--target-dir build
ninja -C src/out/build
- name: Build for Tizen 6.5
if: ${{ matrix.api-version == 6.5 }}
run: |
src/tools/gn \
--target-cpu ${{ matrix.arch }} \
--target-toolchain /usr/lib/llvm-14 \
--target-sysroot src/sysroot-6.5/${{ matrix.arch }} \
--api-version 6.5 --system-cxx \
--target-dir build
ninja -C src/out/build
- uses: actions/upload-artifact@v3
with:
name: tizen-${{ matrix.api-version }}-${{ matrix.arch }}
path: src/out/build/libflutter_tizen*.so
if-no-files-found: error

- uses: actions/upload-artifact@v3
with:
name: tizen-${{ matrix.api-version }}-${{ matrix.arch }}_unittests
path: src/out/build/flutter_tizen_unittests
if-no-files-found: error

- uses: actions/upload-artifact@v3
if: ${{ github.event_name == 'push' }}
with:
name: tizen-${{ matrix.api-version }}-${{ matrix.arch }}_symbols
path: src/out/build/so.unstripped/libflutter_tizen*.so
if-no-files-found: error

- uses: actions/upload-artifact@v3
if: ${{ matrix.arch == 'arm' && matrix.api-version == 5.5 }}
with:
name: tizen-common
path: |
src/out/build/cpp_client_wrapper
src/out/build/icu
src/out/build/public
if-no-files-found: error

test:
needs: build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: docker/setup-qemu-action@v2
with:
platforms: arm

- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/download-artifact@v3
with:
name: tizen-5.5-arm_unittests

- name: Download engine
run: |
python3 tools/download_engine.py
cp engine/arm/libflutter_engine.so .
rm -rf engine
- name: Run tests
run: |
chmod +x flutter_tizen_unittests
docker run --rm -t -v $PWD:/root ghcr.io/flutter-tizen/tizen-headed-armv7l /root/flutter_tizen_unittests
release:
needs: test
if: ${{ github.event_name == 'push' && github.ref_name == 'master' }}
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/download-artifact@v3

- name: Create archives
run: |
rm -r *_unittests
for name in tizen-*; do
7z a $name.zip ./$name/*
done
- name: Set variable
run: echo "SHORT_SHA=$(git rev-parse --short $GITHUB_SHA)" >> $GITHUB_ENV

- uses: softprops/action-gh-release@v1
with:
name: tizen-embedder-${{ env.SHORT_SHA }}
tag_name: ${{ env.SHORT_SHA }}
target_commitish: ${{ github.sha }}
files: tizen-*.zip
body: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
65 changes: 65 additions & 0 deletions .github/workflows/check-symbols.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Check symbols

on:
workflow_run:
workflows:
- Build
types:
- completed

jobs:
check:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/checkout@v3
with:
repository: flutter-tizen/tizen_allowlist
token: ${{ secrets.TIZENAPI_TOKEN }}
path: tizen_allowlist

- name: Download artifacts
uses: TizenAPI/tizenfx-build-actions/download-workflow-artifacts@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
name: tizen-5.5-arm
path: artifacts

- name: Check symbols
run: |
python3 tools/check_symbols.py \
--allowlist=tizen_allowlist/4.0.0_native_whitelist_wearable_v12.txt \
artifacts/libflutter_tizen_wearable.so
- name: Commit success status
if: ${{ success() }}
uses: actions/github-script@v6
with:
script: |
github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.payload.workflow_run.head_sha,
context: 'Check symbols',
state: 'success',
description: 'All symbols are valid',
});
- name: Commit failure status
if: ${{ failure() }}
uses: actions/github-script@v6
with:
script: |
github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.payload.workflow_run.head_sha,
context: 'Check symbols',
state: 'failure',
description: 'Failed in checking symbols',
target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}',
});
9 changes: 9 additions & 0 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ deps = {
'src/third_party/libcxxabi': 'https://llvm.googlesource.com/llvm-project/libcxxabi@65a68da0f1b102574db316d326a53735b03a4574',
'src/third_party/googletest': 'https://github.com/google/googletest@054a986a8513149e8374fc669a5fe40117ca6b41',
'src/third_party/dart': 'https://dart.googlesource.com/sdk.git@63c2197b976931c6472d9dc9574f98ff2ae9408c',
'src/third_party/clang': {
'packages': [
{
'package': 'fuchsia/third_party/clang/linux-amd64',
'version': 'ugk-KfeqO9fhSfhBFRG4Z-56Kr2AQVSEbku9AEUdotYC'
}
],
'dep_type': 'cipd',
},
'src/third_party/gn': {
'packages': [
{
Expand Down

0 comments on commit 4b1d816

Please sign in to comment.