Skip to content

Improve RecordGif defaults and recording workflow #9

Improve RecordGif defaults and recording workflow

Improve RecordGif defaults and recording workflow #9

Workflow file for this run

name: Test
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Detect code changes
id: changes
run: |
BASE_SHA="${{ github.event.pull_request.base.sha }}"
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
SHOULD_RUN="$(bash scripts/ci-has-code-changes.sh "$BASE_SHA" "$HEAD_SHA")"
echo "should_run=$SHOULD_RUN" >> "$GITHUB_OUTPUT"
- name: Set up JDK 17
if: steps.changes.outputs.should_run == 'true'
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'
cache: gradle
- name: Cache Gradle packages
if: steps.changes.outputs.should_run == 'true'
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Test
id: gradle_tests
if: steps.changes.outputs.should_run == 'true'
run: |
set -euo pipefail
./gradlew appTest --info
cd lib
./gradlew recorderTest --info
- name: Test summary
if: always()
env:
CI_GRADLE_TEST_OUTCOME: ${{ steps.gradle_tests.outcome }}
CI_SHOULD_RUN: ${{ steps.changes.outputs.should_run }}
run: bash scripts/ci-test-summary.sh
- name: Ensure summary files exist
if: always()
run: |
if [ ! -f ci-test-summary.md ] || [ ! -f ci-test-summary.json ]; then
CI_TEST_SUMMARY_FORCE_ZERO=true \
CI_TEST_SUMMARY_SKIP_STEP_SUMMARY=true \
CI_GRADLE_TEST_OUTCOME="${{ steps.gradle_tests.outcome }}" \
CI_SHOULD_RUN="${{ steps.changes.outputs.should_run }}" \
bash scripts/ci-test-summary.sh
fi
- name: Upload test summary artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: ci-test-summary
if-no-files-found: error
path: |
ci-test-summary.md
ci-test-summary.json
- name: Skip tests for docs-only changes
if: steps.changes.outputs.should_run != 'true'
run: echo "No code/build changes detected. Skipping tests."