Skip to content

Commit

Permalink
Code review
Browse files Browse the repository at this point in the history
  • Loading branch information
TWiStErRob committed Jul 11, 2023
1 parent 4593946 commit 8d196b5
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

validate:
name: "🦺 Validation"
uses: TWiStErRob/github-workflows/.github/workflows/validate.yml@main
uses: TWiStErRob/github-workflows/.github/workflows/validate.yml@v1

build:
name: "🔨 Build & Verify"
Expand Down
41 changes: 27 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ on:
workflow_call

jobs:

build:
runs-on: ubuntu-latest
# A local build took 20 seconds, CI takes 3 minutes with setup.
# Because it's cloud, give it a bit of a buffer and constrain.
timeout-minutes: 15

steps:
- name: "Set up JDK 17."
uses: actions/setup-java@v3
Expand Down Expand Up @@ -39,24 +41,35 @@ jobs:
- name: "Publish 'Gradle' result and Build Scan URL."
if: (success() || failure()) && steps.gradle != null && steps.gradle.outputs.result-success != null
uses: actions/github-script@v6
env:
PARAM_BUILD_SCAN_URL: ${{ steps.gradle.outputs.build-scan-url }}
PARAM_GRADLE_RESULT_SUCCESS: ${{ steps.gradle.outputs.result-success }}
PARAM_GRADLE_RESULT_TEXT: ${{ steps.gradle.outputs.result-text }}
PARAM_CHECK_NAME_GRADLE: ${{ format(inputs.name-check-gradle, inputs.android-api, inputs.android-image-type, inputs.android-image-arch) }}
with:
debug: ${{ secrets.ACTIONS_STEP_DEBUG || false }}
script: |
const description = ${{ toJSON(fromJSON(steps.gradle.outputs.result-text)) }}
const buildScanUrl = process.env.PARAM_BUILD_SCAN_URL || undefined; // Empty string is falsy.
const success = process.env.PARAM_GRADLE_RESULT_SUCCESS === "true";
const description = process.env.PARAM_GRADLE_RESULT_TEXT;
const statusName = process.env.PARAM_CHECK_NAME_GRADLE;
if (!buildScanUrl) {
core.warning(`No build scan URL found, ${statusName} will have no link.`);
}
await github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.sha,
state: ${{ toJSON(fromJSON(steps.gradle.outputs.result-success)) }} === true ? "success" : "failure",
context: "CI / Build & Verify / build / Gradle",
// Truncate to be sure it fits:
// > HttpError: Validation Failed: {"resource":"Status","code":"custom",
// > "field":"description","message":"description is too long (maximum is 140 characters)"}
// Max length is 140, give some space for potential Unicode.
description: description.length > 130
? `${description.substring(0, 130)}…`
: description,
target_url: ${{ steps.gradle.outputs.build-scan-url && toJSON(fromJSON(steps.gradle.outputs.build-scan-url)) || 'undefined' }}
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.sha,
state: success ? "success" : "failure",
context: "CI / Build & Verify / build / Gradle",
// Truncate to be sure it fits:
// > HttpError: Validation Failed: {"resource":"Status","code":"custom",
// > "field":"description","message":"description is too long (maximum is 140 characters)"}
// Max length is 140, give some space for potential Unicode.
description: description.length > 130
? `${description.substring(0, 130)}…`
: description,
target_url: buildScanUrl,
});
- name: "Upload 'Lint Results HTMLs' artifact."
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/instrumentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ on:
workflow_call

jobs:

instrumentation:
name: "${{ matrix.api }}"

uses: TWiStErRob/github-workflows/.github/workflows/instrumentation.yml@instrumentation
uses: TWiStErRob/github-workflows/.github/workflows/instrumentation.yml@v1
with:
android-api: ${{ matrix.api }}
script: >
Expand Down

0 comments on commit 8d196b5

Please sign in to comment.