diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..faed1157 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,57 @@ +# Use the latest 2.1 version of CircleCI pipeline process engine. +# See: https://circleci.com/docs/2.0/configuration-reference +version: 2.1 + +# Orbs are reusable packages of CircleCI configuration that you may share across projects, enabling you to create encapsulated, parameterized commands, jobs, and executors that can be used across multiple projects. +orbs: + android: circleci/android@1.0.3 + +jobs: + # Below is the definition of your job to build and test your app, you can rename and customize it as you want. + build-and-test: + # These next lines define the Android machine image executor: https://circleci.com/docs/2.0/executor-types/ + executor: + name: android/android-machine + + steps: + # Checkout the code as the first step. + - checkout + + - run: + name: "export props" + command: echo 'export EXTERNAL_PROPS_FILE="$EXTERNAL_PROPS_FILE"' >> $BASH_ENV + + - run: + name: "export props" + command: echo 'export GOOGLE_SERVICES="$GOOGLE_SERVICES"' >> $BASH_ENV + + - run: + name: "get file with google services" + command: echo "$GOOGLE_SERVICES" | base64 -di > app/google-services.json + + - run: + name: "get file with external properties" + command: echo "$EXTERNAL_PROPS_FILE" | base64 -di > secret.properties + + # The next step will run the unit tests + - android/run-tests: + test-command: ./gradlew testDebug + + # Then start the emulator and run the Instrumentation tests! + - android/start-emulator-and-run-tests: + test-command: ./gradlew connectedDebugAndroidTest + system-image: system-images;android-30;google_apis;x86 + + # And finally run the release build + - run: + name: Assemble debug build + command: | + ./gradlew assembleDebug +workflows: + # Below is the definition of your workflow. + # Inside the workflow, you provide the jobs you want to run, e.g this workflow runs the build-and-test job above. + # CircleCI will run this workflow on every commit. + # For more details on extending your workflow, see the configuration docs: https://circleci.com/docs/2.0/configuration-reference/#workflows + sample: + jobs: + - build-and-test diff --git a/.github/workflows/per-pull-request.yml b/.github/workflows/per-pull-request.yml new file mode 100644 index 00000000..8c4d9afb --- /dev/null +++ b/.github/workflows/per-pull-request.yml @@ -0,0 +1,106 @@ +name: Pull request workflow + +on: + pull_request: + branches: [ master ] + + workflow_dispatch: + +jobs: + validation: + name: "Gradle wrapper Validation" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: gradle/wrapper-validation-action@v1 + + build: + runs-on: ubuntu-latest + needs: validation + + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + + - name: get file with external properties + run: echo "${{ secrets.EXTERNAL_PROPS_FILE }}" | base64 -d > secret.properties + + - name: get file with google services + run: echo "${{ secrets.GOOGLE_SERVICES }}" | base64 -d > app/google-services.json + + - name: Make gradlew executable + run: chmod +x ./gradlew + + - name: Build the app + run: ./gradlew assembleDebug + + - name: Archive build artifacts + uses: actions/upload-artifact@v2 + with: + name: app-debug.apk + path: app/build/outputs/apk/debug/* + + unit-tests: + runs-on: ubuntu-latest + needs: validation + + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + + - name: get file with google services + run: echo "${{ secrets.GOOGLE_SERVICES }}" | base64 -d > app/google-services.json + + - name: get file with external properties + run: echo "${{ secrets.EXTERNAL_PROPS_FILE }}" | base64 -d > secret.properties + + - name: display props + run: cat secret.properties + + - name: Make gradlew executable + run: chmod +x ./gradlew + + - name: Unit tests + run: ./gradlew testDebug + + instrumented-test: + runs-on: macos-latest + needs: validation + timeout-minutes: 60 + strategy: + matrix: + api_level: [30] + target: [google_apis] + + steps: + - uses: actions/checkout@v2 + name: Checkout + + - name: set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + + - name: Make gradlew executable + run: chmod +x ./gradlew + + - name: get file with google services + run: echo "${{ secrets.GOOGLE_SERVICES }}" | base64 -d > app/google-services.json + + - name: get file with external properties + run: echo "${{ secrets.EXTERNAL_PROPS_FILE }}" | base64 -d > secret.properties + + - name: Instrumentation tests + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: ${{ matrix.api_level }} + target: ${{ matrix.target }} + script: ./gradlew app:connectedDebugAndroidTest diff --git a/buildsystem/bitrise.gradle b/buildsystem/bitrise.gradle index c5356190..c8de5271 100644 --- a/buildsystem/bitrise.gradle +++ b/buildsystem/bitrise.gradle @@ -31,5 +31,5 @@ ext { ] ] - isBitrise = bitrise.cli.isCi || bitrise.cli.isPr + isBitrise = (bitrise.cli.isCi || bitrise.cli.isPr) && bitrise.cli.workflowId != null } \ No newline at end of file