Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize GitHub Actions Workflow for Android CI #16

Closed
wants to merge 2 commits into from

Conversation

Basler182
Copy link
Contributor

Optimize GitHub Actions Workflow for Android CI

♻️ Current situation & Problem

Link any open issues or pull requests (PRs) related to this PR. Please ensure that all non-trivial PRs are first tracked and discussed in an existing GitHub issue or discussion.

📚 Documentation

  • add google-services.json in workflow
  • allow manual triggering of workflow

📝 Code of Conduct & Contributing Guidelines

By submitting creating this pull request, you agree to follow our Code of Conduct and Contributing Guidelines:

add google-services.json in workflow 
allow manual triggering of workflow
@Basler182 Basler182 added the enhancement New feature or request label May 25, 2024
@Basler182 Basler182 self-assigned this May 25, 2024
Copy link
Member

@PSchmiedmayer PSchmiedmayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @Basler182; I added some additional context about the secrets in the Slack discussion.

.github/workflows/android.yml Outdated Show resolved Hide resolved
Co-authored-by: Paul Schmiedmayer <PSchmiedmayer@users.noreply.github.com>
@@ -24,6 +26,11 @@ jobs:
distribution: 'temurin'
cache: gradle

- name: Decode and write google service json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, we can reuse steps by defining a yaml anchor before, e.g before jobs:

firebase-setup: &firebase-setup
  - name: Decode and write google service json
    env:
      GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
    run: echo $GOOGLE_SERVICES_JSON | base64 --decode >./app/google-services.json

and reuse it here: - <<: *firebase-setup and in other jobs.

Also, we need to inject the json only for jobs that require a project build (gradlew build). Do dokka, lint and test depend on build? Maybe test yes, but not sure whether it is needed for the others

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a really cool idea; I have not used that before.
Unfortunately, according to this issue actions/runner/#1182 this syntax doesn't seem to be supported in the GitHub Action YAML.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had also assumed that only build and test needed the google json, but the github action only went through when I added the google-services.json at every single step

@PSchmiedmayer
Copy link
Member

@Basler182 Let us know if you need any additional input here and how you can integrate this in some of the improvements on main if needed 👍

@Basler182
Copy link
Contributor Author

@Basler182 Let us know if you need any additional input here and how you can integrate this in some of the improvements on main if needed 👍

the file got deleted meanwhile, i ll create a new PR

@Basler182 Basler182 closed this Jun 8, 2024
@Basler182 Basler182 deleted the update/github-action branch June 13, 2024 20:32
@PSchmiedmayer PSchmiedmayer mentioned this pull request Jun 19, 2024
3 tasks
PSchmiedmayer added a commit that referenced this pull request Jun 26, 2024
# Setup Android Tests CI Setup

## ♻️ Current situation & Problem
- Addresses #16
- Closes #21

## ⚙️ Release Notes 
- Setup Android Tests CI Setup

## ☑️ Remaining Issues
- [x] Report Code Coverage: I have build the rough setup for running the
tests but the code coverage report currently doesn't work as expected
for the Android tests. Codecov seems to merge reports for the same
commit so we can just upload them all in different builds. Would be
amazing if you can take a look at this @eldcn
- [x] Contact Tests Fail: It seems like the contact Android tests fail
locally and on the CI. Good as a test for the setup, would be great if
we can fix them as part of this PR @Basler182

## 📝 Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md).

---------

Co-authored-by: Eldi Cano <eldi.cano@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants