From 2d2bfd1f60c42a4fd433726ed5818b1ac94c0709 Mon Sep 17 00:00:00 2001 From: Craig Labenz Date: Wed, 8 Nov 2023 12:33:49 -0800 Subject: [PATCH 1/7] adds CI/CD for mediapipe_core --- .github/main.yaml | 36 ++++++++++++++++++++++++++++++ tool/ci_script_shared.sh | 28 +++++++++++++++++++++++ tool/mediapipe_ci_script_stable.sh | 16 +++++++++++++ 3 files changed, 80 insertions(+) create mode 100644 .github/main.yaml create mode 100644 tool/ci_script_shared.sh create mode 100755 tool/mediapipe_ci_script_stable.sh diff --git a/.github/main.yaml b/.github/main.yaml new file mode 100644 index 00000000..40aaf6b4 --- /dev/null +++ b/.github/main.yaml @@ -0,0 +1,36 @@ +name: Main Branch CI + +# Declare default permissions as read only. +permissions: read-all + +on: + push: + branches: [main] + pull_request: + branches: [main] + workflow_dispatch: + schedule: + - cron: "0 0 * * *" # Every day at midnight + +defaults: + run: + shell: bash + +jobs: + flutter-tests: + name: Test mediapipe_core against ${{ matrix.flutter_version }} + runs_on: ${{ matrix.os }} + # Skip running job on forks + if: github.repository == 'google/flutter-mediapipe' + strategy: + fail-fast: false + matrix: + flutter_version: [stable, beta, master] + # TODO(craiglabenz): Add `ubuntu-latest` and `windows-latest` when those artifacts exist + os: [macos-latest] + steps: + - uses: actions/checkout@v4 + - uses: subosito/flutter-action@v2 + with: + channel: ${{ matrix.flutter_version }} + - run: ./tool/mediapipe_ci_script_${{ matrix.flutter_version }}.sh diff --git a/tool/ci_script_shared.sh b/tool/ci_script_shared.sh new file mode 100644 index 00000000..b7a15a78 --- /dev/null +++ b/tool/ci_script_shared.sh @@ -0,0 +1,28 @@ +function ci_package () { + local channel="$1" + + shift + local arr=("$@") + for PACKAGE_NAME in "${arr[@]}" + do + echo "== Testing '${PACKAGE_NAME}' on Flutter's $channel channel ==" + pushd "packages/${PACKAGE_NAME}" + + # Grab packages. + flutter pub get + + # Run the analyzer to find any static analysis issues. + dart analyze --fatal-infos + + # Run the formatter on all the dart files to make sure everything's linted. + dart format --output none --set-exit-if-changed . + + # Run the actual tests. + if [ -d "test" ] + then + flutter test + fi + + popd + done +} \ No newline at end of file diff --git a/tool/mediapipe_ci_script_stable.sh b/tool/mediapipe_ci_script_stable.sh new file mode 100755 index 00000000..cc4b36b9 --- /dev/null +++ b/tool/mediapipe_ci_script_stable.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -e + +DIR="${BASH_SOURCE%/*}" +source "$DIR/ci_script_shared.sh" + +# flutter doctor -v + +declare -ar PACKAGE_NAMES=( + "mediapipe-core" +) + +ci_package "stable" "${PACKAGE_NAMES[@]}" + +echo "-- Success --" \ No newline at end of file From dcd8e05a3fd66c3bed0e4256382fb407ac36ce30 Mon Sep 17 00:00:00 2001 From: Craig Labenz Date: Wed, 8 Nov 2023 12:41:45 -0800 Subject: [PATCH 2/7] add newlines --- tool/ci_script_shared.sh | 2 +- tool/mediapipe_ci_script_stable.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tool/ci_script_shared.sh b/tool/ci_script_shared.sh index b7a15a78..183f71a5 100644 --- a/tool/ci_script_shared.sh +++ b/tool/ci_script_shared.sh @@ -25,4 +25,4 @@ function ci_package () { popd done -} \ No newline at end of file +} diff --git a/tool/mediapipe_ci_script_stable.sh b/tool/mediapipe_ci_script_stable.sh index cc4b36b9..c5f1adb1 100755 --- a/tool/mediapipe_ci_script_stable.sh +++ b/tool/mediapipe_ci_script_stable.sh @@ -13,4 +13,4 @@ declare -ar PACKAGE_NAMES=( ci_package "stable" "${PACKAGE_NAMES[@]}" -echo "-- Success --" \ No newline at end of file +echo "-- Success --" From 28f0c1e4e5700900fe2445a31d690d91b4e77df2 Mon Sep 17 00:00:00 2001 From: Craig Labenz Date: Wed, 8 Nov 2023 12:45:28 -0800 Subject: [PATCH 3/7] moves file into workflows dir --- .github/{ => workflows}/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/{ => workflows}/main.yaml (96%) diff --git a/.github/main.yaml b/.github/workflows/main.yaml similarity index 96% rename from .github/main.yaml rename to .github/workflows/main.yaml index 40aaf6b4..f18251bc 100644 --- a/.github/main.yaml +++ b/.github/workflows/main.yaml @@ -19,7 +19,7 @@ defaults: jobs: flutter-tests: name: Test mediapipe_core against ${{ matrix.flutter_version }} - runs_on: ${{ matrix.os }} + runs-on: ${{ matrix.os }} # Skip running job on forks if: github.repository == 'google/flutter-mediapipe' strategy: From 12a53b56878c195ff0d25c81a292d1f7b82af430 Mon Sep 17 00:00:00 2001 From: Craig Labenz Date: Wed, 8 Nov 2023 12:47:21 -0800 Subject: [PATCH 4/7] uncomment flutter doctor --- tool/mediapipe_ci_script_stable.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tool/mediapipe_ci_script_stable.sh b/tool/mediapipe_ci_script_stable.sh index c5f1adb1..153dda2a 100755 --- a/tool/mediapipe_ci_script_stable.sh +++ b/tool/mediapipe_ci_script_stable.sh @@ -5,7 +5,7 @@ set -e DIR="${BASH_SOURCE%/*}" source "$DIR/ci_script_shared.sh" -# flutter doctor -v +flutter doctor -v declare -ar PACKAGE_NAMES=( "mediapipe-core" From ac70f6ab672401f314206ccf70fc9e3d547e3862 Mon Sep 17 00:00:00 2001 From: Craig Labenz Date: Wed, 8 Nov 2023 12:49:34 -0800 Subject: [PATCH 5/7] testing PR config to run this now --- .github/workflows/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index f18251bc..52908f82 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -7,7 +7,7 @@ on: push: branches: [main] pull_request: - branches: [main] + branches: [main, ffi-wrapper-core-pkg] workflow_dispatch: schedule: - cron: "0 0 * * *" # Every day at midnight From 210584b8c1ae631fecfb7cbd2cff6378b6823599 Mon Sep 17 00:00:00 2001 From: Craig Labenz Date: Wed, 8 Nov 2023 12:51:47 -0800 Subject: [PATCH 6/7] added master and beta CI scripts --- tool/mediapipe_ci_script_beta.sh | 16 ++++++++++++++++ tool/mediapipe_ci_script_master.sh | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 tool/mediapipe_ci_script_beta.sh create mode 100644 tool/mediapipe_ci_script_master.sh diff --git a/tool/mediapipe_ci_script_beta.sh b/tool/mediapipe_ci_script_beta.sh new file mode 100644 index 00000000..5f914f48 --- /dev/null +++ b/tool/mediapipe_ci_script_beta.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -e + +DIR="${BASH_SOURCE%/*}" +source "$DIR/ci_script_shared.sh" + +flutter doctor -v + +declare -ar PACKAGE_NAMES=( + "mediapipe-core" +) + +ci_package "beta" "${PACKAGE_NAMES[@]}" + +echo "-- Success --" diff --git a/tool/mediapipe_ci_script_master.sh b/tool/mediapipe_ci_script_master.sh new file mode 100644 index 00000000..48c5d65b --- /dev/null +++ b/tool/mediapipe_ci_script_master.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -e + +DIR="${BASH_SOURCE%/*}" +source "$DIR/ci_script_shared.sh" + +flutter doctor -v + +declare -ar PACKAGE_NAMES=( + "mediapipe-core" +) + +ci_package "master" "${PACKAGE_NAMES[@]}" + +echo "-- Success --" From 1897c10785ad9aead3ba62ffaf72a16325222c98 Mon Sep 17 00:00:00 2001 From: Craig Labenz Date: Wed, 8 Nov 2023 12:54:40 -0800 Subject: [PATCH 7/7] add executable permissions to CI scripts --- tool/mediapipe_ci_script_beta.sh | 0 tool/mediapipe_ci_script_master.sh | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 tool/mediapipe_ci_script_beta.sh mode change 100644 => 100755 tool/mediapipe_ci_script_master.sh diff --git a/tool/mediapipe_ci_script_beta.sh b/tool/mediapipe_ci_script_beta.sh old mode 100644 new mode 100755 diff --git a/tool/mediapipe_ci_script_master.sh b/tool/mediapipe_ci_script_master.sh old mode 100644 new mode 100755