Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thatfiredev/modular-android-action
GitHub Actions to selectively build PRs on multi-module Android Projects
https://github.com/thatfiredev/modular-android-action
Last synced: 9 days ago
JSON representation
GitHub Actions to selectively build PRs on multi-module Android Projects
- Host: GitHub
- URL: https://github.com/thatfiredev/modular-android-action
- Owner: thatfiredev
- License: mit
- Created: 2020-09-17T14:14:29.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-09-17T19:29:33.000Z (over 4 years ago)
- Last Synced: 2024-10-19T02:14:12.270Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 180 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Github Actions for Modular Android Projects
As most Android Developers know, an [Android Project](https://developer.android.com/studio/projects) may have many
different modules.
If you change one single module and submit a Pull Request, most CI workflows will try to build/test all the
existing modules, which might take a lot of time, when in reality you only need to build the module you changed.
This GitHub Action aims to solve that problem. When you submit a Pull Request, it will only build the module you changed,
or no module at all if you left them untouched (in case of documentation or configuration changes).
## UsageAdd it to your workflow YAML like this:
```yaml
- name: Build with Modular Action
uses: rosariopfernandes/[email protected]
with:
for-each-module: 'assembleDebug'
for-all-modules: 'check'
```As you can see, it takes 2 arguments:
1. `for-each-module` - gradle task to run for each module.
1. `for-all-modules` - gradle task to run for all modules.In the example above, the final call to gradle would look like this:
```shell
./gradlew check changedModule1:assembleDebug changedModule2:assembleDebug
```## Example Workflow
```yaml
# .github/workflows/pull_requests.ymlname: Modular Android Build (PR)
on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build Pull Request
uses: rosariopfernandes/[email protected]
with:
for-each-module: 'test'
for-all-modules: 'check clean'
```## Limitation
Please note that this code only works if all modules are independent. So if you have `moduleA` dependending on `moduleB`
and you make changes to `moduleB`, then `moduleA` might break and not be tested.## License
This project is licensed under the MIT License. See the [LICENSE file](LICENSE) for more details.