From 7e35e1a16a582d7402a5ddea4eb6c5c3146b936a Mon Sep 17 00:00:00 2001 From: ygit Date: Tue, 31 Oct 2023 14:28:08 +0530 Subject: [PATCH] Added Github Actions for Dart, Kotlin & Swift languages (#1616) (#1618) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * updated yml * 🤖 Automated Format and Fix * Revert "🤖 Automated Format and Fix" This reverts commit 95407b602509b17873e8e8e1f9d9677187049f4d. * updated yml * added paths * updated yml --- .github/workflows/build.yml | 27 ++++++++++++++++++++++--- .github/workflows/ktlint.yml | 35 +++++++++++++++++++++++++++++++++ .github/workflows/swiftlint.yml | 27 +++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/ktlint.yml create mode 100644 .github/workflows/swiftlint.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1cf259090..1d1128384 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,6 +19,8 @@ on: branches: - main - develop + paths: + - "**/*.dart" paths-ignore: - "**.md" - doc/** @@ -27,23 +29,42 @@ on: - "**.txt" jobs: - build_appbundle: + check_build: if: github.event.pull_request.draft == false runs-on: ubuntu-latest timeout-minutes: 30 steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - uses: actions/setup-java@v3 with: distribution: zulu java-version: 12.x - - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2 with: channel: stable cache: true + - name: Get Flutter dependencies in Core SDK + run: flutter pub get + working-directory: packages/hmssdk_flutter + - name: Dart Format + run: dart format . + - name: Dart Fix + run: cd packages/hmssdk_flutter; dart fix --apply + - name: Flutter Analyze in HMSSDK + uses: invertase/github-action-dart-analyzer@v1 + with: + working-directory: packages/hmssdk_flutter + - name: Flutter Analyze in Room Kit + uses: invertase/github-action-dart-analyzer@v1 + with: + working-directory: packages/hms_room_kit + - name: Commit and Push changes + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: 🤖 Automated Format and Fix + commit_user_name: 🤖 100ms Flutter Bot - name: Build Android App Bundle env: FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }} diff --git a/.github/workflows/ktlint.yml b/.github/workflows/ktlint.yml new file mode 100644 index 000000000..a1eeec5e2 --- /dev/null +++ b/.github/workflows/ktlint.yml @@ -0,0 +1,35 @@ +name: KtLint + +on: + workflow_dispatch: + pull_request: + paths: + - "**/*.kt" + +concurrency: + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: read-all + +jobs: + KtLint: + runs-on: ubuntu-latest + + permissions: + checks: write + + steps: + - name: Install ktlint + run: | + curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.44.0/ktlint && chmod a+x ktlint && sudo mv ktlint /usr/local/bin/ + + - name: Run ktlint + run: | + ktlint --reporter=checkstyle,output=build/ktlint-report.xml + continue-on-error: true + + - uses: yutailang0119/action-ktlint@v3 + with: + report-path: build/*.xml + continue-on-error: false diff --git a/.github/workflows/swiftlint.yml b/.github/workflows/swiftlint.yml new file mode 100644 index 000000000..b88c58a40 --- /dev/null +++ b/.github/workflows/swiftlint.yml @@ -0,0 +1,27 @@ +name: SwiftLint + +on: + workflow_dispatch: + pull_request: + paths: + - "**/*.swift" + +concurrency: + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: read-all + +jobs: + SwiftLint: + runs-on: ubuntu-latest + + permissions: + checks: write + + steps: + - uses: actions/checkout@v4 + - name: GitHub Action for SwiftLint + uses: norio-nomura/action-swiftlint@3.2.1 + env: + DIFF_BASE: ${{ github.base_ref }}