Merge pull request #23 from mcobunga/OW-020 #48
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: openweather_build | |
env: | |
main_project_module: app | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
OpenWeather: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Set repository name as env variable | |
run: echo "repository_name=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV | |
- name: Setup JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
cache: 'gradle' | |
- name: Change wrapper permissions | |
run: chmod +x ./gradlew | |
- name: Get BASE_URL | |
env: | |
BASE_URL: $ | |
run: echo BASE_URL=\"$BASE_URL\" > ./local.properties | |
- name: Get MAPS_API_KEY | |
env: | |
MAPS_API_KEY: $ | |
run: echo MAPS_API_KEY=\"$MAPS_API_KEY\" > ./local.properties | |
- name: Get OPEN_WEATHER_API_KEY | |
env: | |
OPEN_WEATHER_API_KEY: $ | |
run: echo OPEN_WEATHER_API_KEY=\"$OPEN_WEATHER_API_KEY\" > ./local.properties | |
- name: Make gradlew executable | |
run: chmod +x ./gradlew | |
- name: Run unit tests | |
run: ./gradlew test --stacktrace | |
- name: Upload Test Reports Folder | |
uses: actions/upload-artifact@v2 | |
if: ${{ always() }} # Upload reports regardless of status | |
with: | |
name: index.html | |
path: app/build/reports/tests/testDebugUnitTest/index.html # path to where the xml test results are stored | |
- name: Android Test Report | |
uses: asadmansr/android-test-report-action@v1.2.0 | |
if: ${{ always() }} | |
- name: Build gradle project | |
run: ./gradlew build | |
- name: Build apk debug project | |
run: ./gradlew assembleDebug | |
- name: Build apk release project | |
run: ./gradlew assemble | |
- name: Build app bundle release | |
run: ./gradlew ${{ env.main_project_module }}:bundleRelease | |
- name: Upload APK Debug | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "openweather_debug_apk" | |
path: ${{ env.main_project_module }}/build/outputs/apk/debug/ | |
- name: Upload APK Release | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "openweather_release_apk" | |
path: ${{ env.main_project_module }}/build/outputs/apk/release/ | |
- name: Upload AAB Release | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "openweather_release_aab" | |
path: ${{ env.main_project_module }}/build/outputs/bundle/release/ |