Skip to content

Commit

Permalink
Remove incorrect task filtering (#43)
Browse files Browse the repository at this point in the history
* Upgrade latest stack to Xcode 13.4

* Remove incorrect task filtering

* Remove dead code

* Remove expected APK env var

* Revert export changes, add better E2E test

* Handle multiple variants in input

* Add separate E2E test for multiple variants

* Description improvements

* Make yamllint happy

* Use unique APK names in test
  • Loading branch information
ofalvai authored Jul 14, 2022
1 parent f0eab08 commit 7e46991
Show file tree
Hide file tree
Showing 5 changed files with 180 additions and 332 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Builds your Android project with Gradle.
<summary>Description</summary>


The Step builds your Android project on Bitrise with Gradle commands: it installs all dependences that are listed in the project's `build.gradle` file, and builds and exports either an APK or an AAB.
The Step builds your Android project on Bitrise with Gradle commands: it installs all dependencies that are listed in the project's `build.gradle` file, and builds and exports either an APK or an AAB.
Once the file is exported, it is available for other Steps in your Workflow.

You can select the module and the variant you want to use for the build.
Expand Down Expand Up @@ -95,7 +95,7 @@ Build a release AAB:
| --- | --- | --- | --- |
| `project_location` | The root directory of your Android project. For example, where your root build gradle file exist (also gradlew, settings.gradle, and so on) | required | `$BITRISE_SOURCE_DIR` |
| `module` | Set the module that you want to build. To see your available modules, please open your project in Android Studio and go in [Project Structure] and see the list on the left. | | |
| `variant` | Set the variant(s) that you want to build. To see your available variants, please open your project in Android Studio and go in [Project Structure] -> variants section. You can set multiple variants separated by `\n` character. For instance: `- variant: myvariant1\nmyvariant2`. | | |
| `variant` | Set the variant(s) that you want to build. To see your available variants, open your project in Android Studio and go in [Project Structure] -> variants section. You can set multiple variants separated by a new line (`\n`), such as `myvariant1\nmyvariant2`. | | |
| `build_type` | Set the build type that you want to build. | required | `apk` |
| `app_path_pattern` | Will find the APK or AAB files - depending on the **Build type** input - with the given pattern.<br/> Separate patterns with a newline. **Note**<br/> The Step will export only the selected artifact type even if the filter would accept other artifact types as well. | required | `*/build/outputs/apk/*.apk */build/outputs/bundle/*.aab` |
| `cache_level` | `all` - The Step will cache build cache and the dependencies `only_deps` - The Step will cache dependencies only `none` - The Step will not cache anything | required | `only_deps` |
Expand Down
63 changes: 42 additions & 21 deletions e2e/bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,51 @@ default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
workflows:

test_nested_module:
title: Test simple Android project with nested module
title: Test simple Android project with nested application module
envs:
- TEST_APP_URL: https://github.com/bitrise-io/android-multiple-test-results-sample.git
- BRANCH: maintenance
- EXPECTED_APK: mylibrary-debug-androidTest.apk
- EXPECTED_APK: nested_app-release-unsigned.apk
- EXPECTED_MAPPING: app-mapping.txt
before_run:
- _setup
after_run:
- _check_apk
- _check_mapping
steps:
- install-missing-android-tools:
inputs:
- gradlew_path: ./gradlew
- path::./:
title: Test nested module
inputs:
- module: app:mylibrary
- module: app:nested_app
- variant: release

test_multiple_variants:
title: Test building multiple variants
envs:
- TEST_APP_URL: https://github.com/bitrise-io/android-multiple-test-results-sample.git
- BRANCH: maintenance
- EXPECTED_APK: another_app-full-release-unsigned.apk
- EXPECTED_APK_PATH_LIST: $BITRISE_DEPLOY_DIR/another_app-demo-release-unsigned.apk|$BITRISE_DEPLOY_DIR/another_app-full-release-unsigned.apk
- EXPECTED_MAPPING: another_app-mapping.txt
before_run:
- _setup
after_run:
- _check_apk
- _check_mapping
steps:
- install-missing-android-tools:
inputs:
- gradlew_path: ./gradlew
- path::./:
title: Execute step
inputs:
- module: another_app
- variant: |-
fullRelease
demoRelease
test_simple_apk:
title: Test simple Android project and APK building
Expand All @@ -46,7 +74,7 @@ workflows:
- arguments: --warn

test_monorepo_apk:
title: Test project in monorepo and APK building
title: Test multiple separate projects in a monorepo and APK building
envs:
- TEST_APP_URL: https://github.com/bitrise-io/android-testing.git
- BRANCH: maintenance
Expand Down Expand Up @@ -93,7 +121,7 @@ workflows:
- build_type: aab

test_monorepo_aab:
title: Test project in monorepo and AAB building
title: Test multiple separate projects in a monorepo and AAB building
envs:
- TEST_APP_URL: https://github.com/bitrise-io/android-testing.git
- BRANCH: maintenance
Expand Down Expand Up @@ -133,22 +161,6 @@ workflows:
- repository_url: $TEST_APP_URL
- clone_into_dir: .
- branch: $BRANCH
- script:
run_if: $.IsCI
inputs:
- content: |-
#!/usr/bin/env bash
set -ex
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
sudo update-alternatives --set javac /usr/lib/jvm/java-11-openjdk-amd64/bin/javac
sudo update-alternatives --set java /usr/lib/jvm/java-11-openjdk-amd64/bin/java
export JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"
envman add --key JAVA_HOME --value "/usr/lib/jvm/java-11-openjdk-amd64"
elif [[ "$OSTYPE" == "darwin"* ]]; then
jenv global 11 || jenv global 11.0
export JAVA_HOME="$(jenv prefix)"
envman add --key JAVA_HOME --value "$(jenv prefix)"
fi

_check_apk:
steps:
Expand All @@ -170,6 +182,15 @@ workflows:
exit 1
fi
if [ -n "$EXPECTED_APK_PATH_LIST" ] ; then
if [ "$EXPECTED_APK_PATH_LIST" != "$BITRISE_APK_PATH_LIST" ] ; then
echo "Expected APK path list does not match actual step output"
echo "Expected: $EXPECTED_APK_PATH_LIST"
echo "Actual: $BITRISE_APK_PATH_LIST"
exit 1
fi
fi
_check_aab:
steps:
- script:
Expand Down
8 changes: 4 additions & 4 deletions step.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ inputs:
- variant: ""
opts:
title: Variant
summary: |
Set the variant(s) that you want to build. To see your available variants, please open your project in Android Studio and go in [Project Structure] -> variants section.
summary: Set the build variant you want to create, such as `debug` or `myflavorRelease`. To see your available variants, open your project in Android Studio and go in [Project Structure] -> variants section.
description: |
Set the variant(s) that you want to build. To see your available variants, please open your project in Android Studio and go in [Project Structure] -> variants section.
You can set multiple variants separated by `\n` character. For instance: `- variant: myvariant1\nmyvariant2`.
Set the variant(s) that you want to build. To see your available variants, open your project in Android Studio and go in [Project Structure] -> variants section.
You can set multiple variants separated by a new line (`\n`), such as `myvariant1\nmyvariant2`.
is_required: false
- build_type: apk
opts:
Expand Down
Loading

0 comments on commit 7e46991

Please sign in to comment.