Issue #ED-0000 feat: Added git actions #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Android CI | ||
on: | ||
push: | ||
branches: | ||
- "*" | ||
pull_request: | ||
branches: | ||
- "*" | ||
jobs: | ||
build: | ||
environment: sunbird | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'zulu' | ||
cache: gradle | ||
- name: Setup Gradle | ||
uses: gradle/gradle-build-action@v2 | ||
- name: Install Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 16.x | ||
- name: Install Ionic | ||
run: npm install -g @ionic/cli | ||
- name: Install app dependencies | ||
run: npm install | ||
- name: Convert Windows line endings to Linux from the gradlew file | ||
run: sudo apt update && sudo apt install dos2unix && cd android && dos2unix ./gradlew && cd .. | ||
- name: Make ./gradlew command executable | ||
run: cd android && chmod +x ./gradlew && cd .. | ||
- name: Build Ionic assets | ||
run: ionic build --prod && npx cap sync | ||
- name: Copy generated assets from Ionic to Capacitor Android platform | ||
run: npx cap copy android && npx cap update android | ||
- name: Execute test cases using JEST | ||
working-directory: src/app | ||
run: npm run test:ci | ||
- name: Install Sonar Scanner | ||
run: sudo npm install -g [email protected] | ||
- name: Cache SonarQube Scanner | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.sonar/cache | ||
key: ${{ runner.os }}-sonarqube-${{ hashFiles('**/sonar-project.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-sonarqube- | ||
- name: Run SonarQube Analysis | ||
run: | | ||
sonar-scanner \ | ||
-Dsonar.projectKey=Sunbird-Ed_SunbirdEd-mobile-app \ | ||
-Dsonar.organization=sunbird-ed \ | ||
-Dsonar.host.url=https://sonarcloud.io \ | ||
-Dsonar.login=$SONAR_TOKEN | ||
env: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |