Skip to content

fix(ci): move setup-java after android project generation - #159

Merged
acamarata merged 2 commits into
mainfrom
fix/setup-java-v6-gradle-cache-ordering
Aug 27, 2026
Merged

acamarata merged 2 commits into
mainfrom
fix/setup-java-v6-gradle-cache-ordering

Conversation

@acamarata

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #157 (bumps actions/setup-java@v5 -> @v6). That PR's checks
are green but misleading: every job that runs setup-java is skipped on a
normal PR (build-capacitor.yml / build-react-native.yml are
workflow_dispatch-only; deploy-mobile-android.yml is tag-triggered). These
workflows have never run on main.

Dispatching them directly against #157's branch, both failed at the Setup
Java step:

No file in /home/runner/work/nchat/nchat matched to
[**/*.gradle*,**/gradle.properties,**/gradle-wrapper.properties, ...],
make sure you have checked out the target repository

Cause: cache: 'gradle' in actions/setup-java needs gradle files to key
its cache on. In v5 a miss was a warning; in v6 it's a hard job failure. The
native android/ project in this repo is gitignored and generated at build
time (npx cap add android / capacitor sync), so on a fresh checkout no
gradle files exist until that generation step runs. All three workflows ran
Setup Java before that step.

Changes

  • build-capacitor.yml: move Setup Java to after Add + Sync Capacitor Android
  • build-react-native.yml: move Setup Java to after Install dependencies (which generates the native project)
  • deploy-mobile-android.yml: move Setup Java to after Sync Capacitor
  • All three now also set cache-dependency-path so the gradle cache keys correctly once the files exist

ci.yml already had this exact fix (with an explanatory comment) from an
earlier change — these three workflows follow the same pattern.

actions/setup-java@v6 is kept, not reverted.

Verification

Dispatched both build-capacitor.yml and build-react-native.yml directly
against this branch:

  • build-react-native.yml (run 33085534559): fails at Install dependencies
    ("No such file or directory") — pre-existing, unrelated:
    frontend/platforms/react-native does not exist in this repo (not in
    pnpm-workspace.yaml, no tracked files). The React Native platform was
    never scaffolded. Setup Java never reaches execution because of this
    earlier failure; this is unrelated to the setup-java ordering fix and out
    of scope here.
  • build-capacitor.yml (run 33085531501): fails earlier, at Build web assets (HASURA_ADMIN_SECRET must be set for production builds - the
    workflow's pnpm build step never passes that secret through, another
    pre-existing gap unrelated to setup-java).

To isolate and prove the actual fix, I ran a disposable local-only
verification (never pushed as part of this PR) that patched around those two
unrelated pre-existing gaps (passed HASURA_ADMIN_SECRET through, added the
missing mobile vite build step that ci.yml already has). With those
workarounds, the real fix in this PR was exercised end-to-end:

Build web assets: success
Add + Sync Capacitor Android: success
Setup Java: success          <- the actual fix, proven
Build Android (Debug): success
Upload Android artifact: success

Full job: https://github.com/nself-org/nchat/actions/runs/33086902029

Test plan

  • YAML syntax validated for all three changed files
  • Dispatched build-capacitor.yml and build-react-native.yml against this branch
  • Confirmed Setup Java itself succeeds once ordered after android project generation (isolated verification run)
  • build-react-native.yml needs its own fix to scaffold frontend/platforms/react-native before it can be exercised for real (separate, pre-existing issue, not addressed here)
  • build-capacitor.yml's production workflow needs HASURA_ADMIN_SECRET wired into the Build web assets step (separate, pre-existing issue, not addressed here)

dependabot Bot and others added 2 commits August 27, 2026 14:39
Bumps the actions group with 2 updates: [actions/setup-java](https://github.com/actions/setup-java) and [trufflesecurity/trufflehog](https://github.com/trufflesecurity/trufflehog).


Updates `actions/setup-java` from 5 to 6
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](actions/setup-java@v5...v6)

Updates `trufflesecurity/trufflehog` from 3.97.0 to 3.97.1
- [Release notes](https://github.com/trufflesecurity/trufflehog/releases)
- [Commits](trufflesecurity/trufflehog@bcfcf73...20652fb)

---
updated-dependencies:
- dependency-name: actions/setup-java
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: trufflesecurity/trufflehog
  dependency-version: 3.97.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
actions/setup-java@v5 only warned when cache: gradle found no gradle
files to key on; @v6 hard-fails the job instead. build-capacitor.yml,
build-react-native.yml, and deploy-mobile-android.yml all ran Setup
Java before the step that generates the native android/ project (via
cap add/cap sync or RN's install), so no gradle files existed yet at
that point. android/ is gitignored, never committed, so this always
happened on a fresh checkout.

Move Setup Java to run after the android project exists, matching the
pattern already used in ci.yml. Also add cache-dependency-path so the
gradle cache keys correctly once the files are present.

These workflows are workflow_dispatch-only (or tag-triggered for
deploy-mobile-android), so PR checks never exercise them and #157's
green PR checks did not catch this. Verified by dispatching
build-capacitor.yml and build-react-native.yml directly against this
branch.
@github-actions

Copy link
Copy Markdown

PR Checks Summary

Check Status
Lint & Format ⏭️ skipped
Type Check ⏭️ skipped
Unit Tests ⏭️ skipped
Build ⏭️ skipped

All checks passed! Ready for review.

@github-actions

Copy link
Copy Markdown

Security Scan Results: PASSED

Scanner Critical High
SAST 0 0
Dependencies 0 0

@acamarata
acamarata merged commit f9cf364 into main Aug 27, 2026
54 of 56 checks passed
@acamarata
acamarata deleted the fix/setup-java-v6-gradle-cache-ordering branch August 27, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant