Skip to content

Commit

Permalink
PIMOB-2183: Add github actions and remove duplicated steps from bitri…
Browse files Browse the repository at this point in the history
…se.yml
  • Loading branch information
jheng-hao-lin-cko committed Oct 5, 2023
1 parent acd5902 commit 3c8ff54
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 14 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/send-sonar-qube-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Send SonarQube Report

on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
types: [ opened, synchronize, reopened ]
branches: [ master, "bugfix/*", "feature/*", "release/*" ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build Jacoco Test Report for :checkout
runs-on: ubuntu-latest
steps:
- name: Setup Environment
uses: ./.github/workflows/setup-env.yml

- name: Build Jacoco Test Report for :checkout
run: ./gradlew :checkout:jacocoTestReport

- name: Build Jacoco Test Report for :frames
run: ./gradlew :frames:jacocoTestReport

- name: Send SonarQube Report
run: |
#!/usr/bin/env bash
# fail if any commands fails
set -e
# debug log
set -x
# Run sonarqube script
./scripts/sonar.sh|
19 changes: 19 additions & 0 deletions .github/workflows/setup-env.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Setup Environment

jobs:
setup:
name: Setup Environment
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: corretto
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew
49 changes: 49 additions & 0 deletions .github/workflows/verify-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Verify Pull Request

on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
types: [ opened, synchronize, reopened ]
branches: [ master, "bugfix/*", "feature/*", "release/*" ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
lint:
name: Code Lint
runs-on: ubuntu-latest
steps:
- name: Setup Environment
uses: ./.github/workflows/setup-env.yml

- name: Run Ktlint
run: ./gradlew ktlintCheck

- name: Run Android Lint
run: ./gradlew lint

build:
name: Build the App
runs-on: ubuntu-latest
needs: lint
steps:
- name: Setup Environment
uses: ./.github/workflows/setup-env.yml

- name: Build with Gradle
run: ./gradlew build

test:
name: Unit Tests
runs-on: ubuntu-latest
needs: lint
steps:
- name: Setup Environment
uses: ./.github/workflows/setup-env.yml

- name: Run unit tests
run: ./gradlew test
14 changes: 0 additions & 14 deletions bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,33 +39,19 @@ workflows:
description: First steps to initialise the workflow
verification-full:
steps:
- android-lint@0:
inputs:
- variant: "$VARIANT"
is_always_run: true
- android-unit-test@1:
inputs:
- project_location: "$PROJECT_LOCATION"
- variant: "$VARIANT"
is_always_run: true
- gradle-runner@2:
inputs:
- gradle_task: assembleAndroidTest
is_always_run: true
title: Gradle Runner - Build Android Test
after_run:
- steps-sonar
- steps-finish
description: |2-
## Performs all validation checks
The following checks are performed
- Build
- Lint Checks (if PR is ready for review)
- Unit Tests
- Instrumentation Tests (if PR is ready for review)
- SonarQube Analysis (if PR is ready for review)
before_run:
- steps-start
steps-sonar:
Expand Down

0 comments on commit 3c8ff54

Please sign in to comment.