From fe24578ee300ef30629c7bba61dc62b439f16134 Mon Sep 17 00:00:00 2001 From: Pham Quoc Trong Date: Thu, 25 Jan 2024 16:24:10 +0700 Subject: [PATCH] Build CI: Trigger when have a PR merged to staging branch --- .github/workflows/main.yaml | 31 +++++++++++++++++++++++++++++++ README.md | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/main.yaml diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000..2b92367 --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,31 @@ +name: Run test +on: + pull_request: + branches: + - staging +jobs: + if_merged: + if: github.event.pull_request.merged == true + name: Test on iOS simulator + runs-on: macOS-latest + steps: + - name: Checkout + uses: actions/checkout@v4.1.1 + - name: Java setup + uses: actions/setup-java@v4.0.0 + with: + java-version: '17' + distribution: 'zulu' + - name: Flutter setup + uses: subosito/flutter-action@v2.12.0 + with: + channel: 'stable' + - name: Create iOS simulator + uses: futureware-tech/simulator-action@v3 + with: + model: 'iPhone 14' + - run: flutter doctor -v + - run: flutter pub get + - run: flutter pub run build_runner build --delete-conflicting-outputs + - run: flutter test --flavor=dev + - run: flutter test integration_test --flavor=dev diff --git a/README.md b/README.md index fc224e0..1441800 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ ## The Flutter project integrate CI-CD -Todo ... \ No newline at end of file +![Flutter CI-CD demo](https://github.com/ntaworking/flutter_ci_cd/actions/workflows/main.yml/badge.svg) \ No newline at end of file