Unverified Commit 44e1837a authored by Daz DeBoer's avatar Daz DeBoer Committed by GitHub
Browse files

Merge pull request #304 from gradle/dd/test-init-scripts

Improve init scripts and add test coverage

The build-scan-capture init script will now capture results from builds that do not publish a build-scan, with and without the configuration-cache.

Fixes #292
parents 14c898b5 b400dc55
Loading
Loading
Loading
Loading
+23
Changes for .github/workflows/ci-init-script-check.yml: 23 added lines, 0 removed lines.
Original line number Diff line number Diff line
name: CI-init-script-check

on:
  push:

jobs:
  test-init-scripts:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout sources
      uses: actions/checkout@v3
    - name: Setup Java
      uses: actions/setup-java@v3
      with:
        distribution: temurin
        java-version: 8
    - name: Setup Gradle
      uses: ./
      with:
        cache-read-only: false # For testing, allow writing cache entries on non-default branches
    - name: Run integration tests
      working-directory: test/test-init-scripts
      run: ./gradlew check
+4 −1
Changes for .github/workflows/demo-job-summary.yml: 4 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -23,10 +23,13 @@ jobs:
    - name: Build kotlin-dsl project
      working-directory: .github/workflow-samples/kotlin-dsl
      run: ./gradlew assemble
    - name: Build kotlin-dsl project without build scan
      working-directory: .github/workflow-samples/kotlin-dsl
      run: ./gradlew check --no-scan
    - name: Build groovy-dsl project
      working-directory: .github/workflow-samples/groovy-dsl
      run: ./gradlew assemble
    - name: Build kotlin-dsl project again
    - name: Build kotlin-dsl project with multiple gradle invocations
      working-directory: .github/workflow-samples/kotlin-dsl
      run: | 
         ./gradlew tasks --no-daemon
+8 −1
Changes for .github/workflows/integ-test-execution.yml: 8 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -56,19 +56,26 @@ jobs:
  gradle-versions:
    strategy:
      matrix:
        gradle: [7.3, 6.9, 5.6.4, 4.10.3]
        gradle: [7.3, 6.9, 5.6.4, 4.10.3, 3.5.1]
        os: ${{fromJSON(inputs.runner-os)}}
        include:
          - gradle: 5.6.4
            build-root-suffix: -gradle-5
          - gradle: 4.10.3
            build-root-suffix: -gradle-4
          - gradle: 3.5.1
            build-root-suffix: -gradle-4
    runs-on: ${{ matrix.os }}
    steps:
    - name: Checkout sources
      uses: actions/checkout@v3
    - name: Download distribution if required
      uses: ./.github/actions/download-dist
    - name: Setup Java
      uses: actions/setup-java@v3
      with:
        distribution: temurin
        java-version: 8
    - name: Run Gradle build
      uses: ./
      id: gradle
+8 −1
Changes for .github/workflows/integ-test-provision-gradle-versions.yml: 8 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -59,19 +59,26 @@ jobs:
  gradle-versions:
    strategy:
      matrix:
        gradle: [7.3, 6.9, 5.6.4, 4.10.3]
        gradle: [7.3, 6.9, 5.6.4, 4.10.3, 3.5.1]
        os: ${{fromJSON(inputs.runner-os)}}
        include:
          - gradle: 5.6.4
            build-root-suffix: -gradle-5
          - gradle: 4.10.3
            build-root-suffix: -gradle-4
          - gradle: 3.5.1
            build-root-suffix: -gradle-4
    runs-on: ${{ matrix.os }}
    steps:
    - name: Checkout sources
      uses: actions/checkout@v3
    - name: Download distribution if required
      uses: ./.github/actions/download-dist
    - name: Setup Java
      uses: actions/setup-java@v3
      with:
        distribution: temurin
        java-version: 8
    - name: Setup Gradle
      uses: ./
      with:
+8 −9
Changes for dist/main/index.js: 8 added lines, 9 removed lines.
Original line number Diff line number Diff line
@@ -64967,6 +64967,7 @@ class GradleStateCache {
        fs_1.default.appendFileSync(propertiesFile, 'org.gradle.daemon=false');
        const initScriptFilenames = [
            'build-result-capture.init.gradle',
            'build-result-capture-service.plugin.groovy',
            'project-root-capture.init.gradle',
            'project-root-capture.plugin.groovy'
        ];
@@ -65291,7 +65292,7 @@ class ConfigurationCacheEntryExtractor extends AbstractEntryExtractor {
        });
    }
    getProjectRoots() {
        const projectList = path_1.default.resolve(this.gradleUserHome, cache_base_1.PROJECT_ROOTS_FILE);
        const projectList = path_1.default.resolve(process.env['RUNNER_TEMP'], cache_base_1.PROJECT_ROOTS_FILE);
        if (!fs_1.default.existsSync(projectList)) {
            core.info(`Missing project list file ${projectList}`);
            return [];
@@ -65559,7 +65560,7 @@ function isCacheDisabled() {
}
exports.isCacheDisabled = isCacheDisabled;
function isCacheReadOnly() {
    return core.getBooleanInput(CACHE_READONLY_PARAMETER);
    return !isCacheWriteOnly() && core.getBooleanInput(CACHE_READONLY_PARAMETER);
}
exports.isCacheReadOnly = isCacheReadOnly;
function isCacheWriteOnly() {
@@ -66031,14 +66032,12 @@ function writeSummaryTable(results) {
    core.summary.addRaw('\n');
}
function renderOutcome(result) {
    const badgeUrl = result.buildFailed
        ? 'https://img.shields.io/badge/Build%20Scan%E2%84%A2-FAILED-red?logo=Gradle'
        : 'https://img.shields.io/badge/Build%20Scan%E2%84%A2-SUCCESS-brightgreen?logo=Gradle';
    const labelPart = result.buildScanUri ? 'Build%20Scan%E2%84%A2' : 'Build';
    const outcomePart = result.buildFailed ? 'FAILED-red' : 'SUCCESS-brightgreen';
    const badgeUrl = `https://img.shields.io/badge/${labelPart}-${outcomePart}?logo=Gradle`;
    const badgeHtml = `<img src="${badgeUrl}" alt="Gradle Build">`;
    if (result.buildScanUri) {
        return `<a href="${result.buildScanUri}" rel="nofollow">${badgeHtml}</a>`;
    }
    return badgeHtml;
    const targetUrl = result.buildScanUri ? result.buildScanUri : '#';
    return `<a href="${targetUrl}" rel="nofollow">${badgeHtml}</a>`;
}
Loading