Skip to content
This repository has been archived by the owner on Oct 16, 2023. It is now read-only.

[bn-3371] base github actions setup #380

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]

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
106 changes: 106 additions & 0 deletions .github/workflows/per-pull-request.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion buildsystem/bitrise.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ ext {
]
]

isBitrise = bitrise.cli.isCi || bitrise.cli.isPr
isBitrise = (bitrise.cli.isCi || bitrise.cli.isPr) && bitrise.cli.workflowId != null
}