Commit 95e20daa authored by Paul Merlin's avatar Paul Merlin
Browse files

Automatic caching of dependencies

in a best effort manner by default
allowing to specify files to hash for computing the cache key
parent fcc1683d
Loading
Loading
Loading
Loading
+2 −2
Changes for .github/workflows/dev.yml: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -22,10 +22,10 @@ jobs:
      with:
        wrapper-directory: __tests__/data/basic
        build-root-directory: __tests__/data/basic
        arguments: help
        arguments: test
    - name: Test dist download
      uses: ./
      with:
        gradle-version: 6.5
        build-root-directory: __tests__/data/basic
        arguments: help
        arguments: test
+2 −2
Changes for .github/workflows/prod.yml: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -21,10 +21,10 @@ jobs:
      with:
        wrapper-directory: __tests__/data/basic
        build-root-directory: __tests__/data/basic
        arguments: help
        arguments: test
    - name: Test dist download
      uses: ./
      with:
        gradle-version: 6.5
        build-root-directory: __tests__/data/basic
        arguments: help
        arguments: test
+33
Changes for __tests__/crypto-utils.test.ts: 33 added lines, 0 removed lines.
Original line number Diff line number Diff line
import * as cryptoUtils from '../src/crypto-utils'
import * as path from 'path'

describe('crypto-utils', () => {
    describe('can hash', () => {
        it('a directory', async () => {
            const hash = await cryptoUtils.hashFiles(
                path.resolve('__tests__/data/basic/gradle')
            )
            expect(hash).toBe(
                '4ebb65b45e6f6796d5ec6ace96e9471cc6573d294c54f99c4920fe5328e75bab'
            )
        })
        it('a directory with a glob', async () => {
            const hash = await cryptoUtils.hashFiles(
                path.resolve('__tests__/data/basic/'),
                ['gradle/**']
            )
            expect(hash).toBe(
                '4ebb65b45e6f6796d5ec6ace96e9471cc6573d294c54f99c4920fe5328e75bab'
            )
        })
        it('a directory with globs', async () => {
            const hash = await cryptoUtils.hashFiles(
                path.resolve('__tests__/data/basic/'),
                ['**/*.gradle', 'gradle/**']
            )
            expect(hash).toBe(
                '2db1d5291774949ab89e18e9d82ee24748ca0f6cc78de69ea9104357c50ad4a5'
            )
        })
    })
})
+11 −6
Changes for __tests__/data/basic/build.gradle: 11 added lines, 6 removed lines.
Original line number Diff line number Diff line
/*
 * This file was generated by the Gradle 'init' task.
 *
 * This is a general purpose Gradle build.
 * Learn how to create Gradle builds at https://guides.gradle.org/creating-new-gradle-builds
 */
plugins {
    id 'java'
}

repositories {
    mavenCentral()
}

dependencies {
    testImplementation('junit:junit:4.12')
}
+10
Changes for __tests__/data/basic/src/test/java/basic/BasicTest.java: 10 added lines, 0 removed lines.
Original line number Diff line number Diff line
package basic;

import org.junit.Test;

public class BasicTest {
    @Test
    public void test() {
        assert true;
    }
}
Loading