Skip to content
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
37 changes: 35 additions & 2 deletions .github/workflows/agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,16 @@ jobs:
echo "run_ci=true" >> "$GITHUB_OUTPUT"
exit 0
fi
if git diff --name-only "origin/$BASE_REF...HEAD" | grep -qE '^(agent/|\.github/workflows/agent\.yaml|\.github/ci-gradle\.properties)'; then
changed_files="$(git diff --no-renames --name-only "origin/$BASE_REF...HEAD")"
# git wraps paths with non-ASCII or special characters in double quotes.
if grep -qE '^"?(agent/|\.github/workflows/agent\.yaml|\.github/ci-gradle\.properties)' <<< "$changed_files"; then
echo "run_ci=true" >> "$GITHUB_OUTPUT"
else
echo "run_ci=false" >> "$GITHUB_OUTPUT"
fi

agent-build:
name: "Agent build & test"
name: "Agent spotless, tests & APKs"
needs: changes
if: needs.changes.outputs.run_ci == 'true'
runs-on: ubuntu-latest
Expand Down Expand Up @@ -116,3 +118,34 @@ jobs:
with:
name: agent-apks
path: agent/app/build/outputs/apk/**/*.apk

# Required status check in the rules-main ruleset, so keep its name in sync. GitHub counts a
# skipped required check as passing, so this job always runs and fails unless the build passed or
# was skipped because the change touches no agent files.
agent-gate:
name: "Agent build & test"
needs: [changes, agent-build]
if: always()
runs-on: ubuntu-latest
Comment thread
borisr-code-ibm marked this conversation as resolved.
Resolved
timeout-minutes: 5
permissions: {}
steps:
- name: Check build result
env:
CHANGES_RESULT: ${{ needs.changes.result }}
RUN_CI: ${{ needs.changes.outputs.run_ci }}
BUILD_RESULT: ${{ needs.agent-build.result }}
run: |
if [ "$CHANGES_RESULT" != "success" ]; then
echo "::error::Check changes finished with '$CHANGES_RESULT', so the agent build was not verified."
exit 1
fi
if [ "$RUN_CI" = "false" ] && [ "$BUILD_RESULT" = "skipped" ]; then
echo "No agent files changed, so the agent build is not needed."
exit 0
fi
if [ "$BUILD_RESULT" != "success" ]; then
echo "::error::Agent spotless, tests & APKs finished with '$BUILD_RESULT'."
exit 1
fi
echo "Agent spotless, tests & APKs passed."
37 changes: 35 additions & 2 deletions .github/workflows/chatapp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,16 @@ jobs:
echo "run_ci=true" >> "$GITHUB_OUTPUT"
exit 0
fi
if git diff --name-only "origin/$BASE_REF...HEAD" | grep -qE '^(ChatApp/|\.github/workflows/chatapp\.yaml|\.github/ci-gradle\.properties)'; then
changed_files="$(git diff --no-renames --name-only "origin/$BASE_REF...HEAD")"
# git wraps paths with non-ASCII or special characters in double quotes.
if grep -qE '^"?(ChatApp/|\.github/workflows/chatapp\.yaml|\.github/ci-gradle\.properties)' <<< "$changed_files"; then
echo "run_ci=true" >> "$GITHUB_OUTPUT"
else
echo "run_ci=false" >> "$GITHUB_OUTPUT"
fi

chatapp-build:
name: "ChatApp build & test"
name: "ChatApp spotless, tests & APKs"
needs: changes
if: needs.changes.outputs.run_ci == 'true'
runs-on: ubuntu-latest
Expand Down Expand Up @@ -121,3 +123,34 @@ jobs:
path: |
ChatApp/app/build/outputs/apk/**/*.apk
ChatApp/wear/build/outputs/apk/**/*.apk

# Required status check in the rules-main ruleset, so keep its name in sync. GitHub counts a
# skipped required check as passing, so this job always runs and fails unless the build passed or
# was skipped because the change touches no ChatApp files.
chatapp-gate:
name: "ChatApp build & test"
needs: [changes, chatapp-build]
if: always()
runs-on: ubuntu-latest
timeout-minutes: 5
permissions: {}
steps:
- name: Check build result
env:
CHANGES_RESULT: ${{ needs.changes.result }}
RUN_CI: ${{ needs.changes.outputs.run_ci }}
BUILD_RESULT: ${{ needs.chatapp-build.result }}
run: |
if [ "$CHANGES_RESULT" != "success" ]; then
echo "::error::Check changes finished with '$CHANGES_RESULT', so the ChatApp build was not verified."
exit 1
fi
if [ "$RUN_CI" = "false" ] && [ "$BUILD_RESULT" = "skipped" ]; then
echo "No ChatApp files changed, so the ChatApp build is not needed."
exit 0
fi
if [ "$BUILD_RESULT" != "success" ]; then
echo "::error::ChatApp spotless, tests & APKs finished with '$BUILD_RESULT'."
exit 1
fi
echo "ChatApp spotless, tests & APKs passed."
Loading