mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-11-26 11:02:10 +00:00
Merge branch 'master' into releases/v1
This commit is contained in:
commit
90ccf054e6
11 changed files with 2400 additions and 1498 deletions
4
.github/workflows/prod.yml
vendored
4
.github/workflows/prod.yml
vendored
|
@ -25,7 +25,7 @@ jobs:
|
||||||
- name: Test dist download
|
- name: Test dist download
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
gradle-version: 6.6-milestone-1
|
gradle-version: rc
|
||||||
build-root-directory: __tests__/data/basic
|
build-root-directory: __tests__/data/basic
|
||||||
dependencies-cache-enabled: true
|
dependencies-cache-enabled: true
|
||||||
configuration-cache-enabled: true
|
configuration-cache-enabled: true
|
||||||
|
@ -33,7 +33,7 @@ jobs:
|
||||||
- name: Stop Gradle daemon
|
- name: Stop Gradle daemon
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
gradle-version: 6.6-milestone-1
|
gradle-version: rc
|
||||||
build-root-directory: __tests__/data/basic
|
build-root-directory: __tests__/data/basic
|
||||||
dependencies-cache-enabled: true
|
dependencies-cache-enabled: true
|
||||||
configuration-cache-enabled: true
|
configuration-cache-enabled: true
|
||||||
|
|
|
@ -9,19 +9,19 @@ describe('cache', () => {
|
||||||
'__tests__/data/basic/gradle/wrapper/gradle-wrapper.properties'
|
'__tests__/data/basic/gradle/wrapper/gradle-wrapper.properties'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
expect(version).toBe('6.5-bin')
|
expect(version).toBe('6.6.1-bin')
|
||||||
})
|
})
|
||||||
it('for -bin dist', async () => {
|
it('for -bin dist', async () => {
|
||||||
const version = cacheWrapper.extractGradleWrapperSlugFromDistUri(
|
const version = cacheWrapper.extractGradleWrapperSlugFromDistUri(
|
||||||
'distributionUrl=https\\://services.gradle.org/distributions/gradle-6.5-bin.zip'
|
'distributionUrl=https\\://services.gradle.org/distributions/gradle-6.6.1-bin.zip'
|
||||||
)
|
)
|
||||||
expect(version).toBe('6.5-bin')
|
expect(version).toBe('6.6.1-bin')
|
||||||
})
|
})
|
||||||
it('for -all dist', async () => {
|
it('for -all dist', async () => {
|
||||||
const version = cacheWrapper.extractGradleWrapperSlugFromDistUri(
|
const version = cacheWrapper.extractGradleWrapperSlugFromDistUri(
|
||||||
'distributionUrl=https\\://services.gradle.org/distributions/gradle-6.5-all.zip'
|
'distributionUrl=https\\://services.gradle.org/distributions/gradle-6.6.1-all.zip'
|
||||||
)
|
)
|
||||||
expect(version).toBe('6.5-all')
|
expect(version).toBe('6.6.1-all')
|
||||||
})
|
})
|
||||||
it('for milestone', async () => {
|
it('for milestone', async () => {
|
||||||
const version = cacheWrapper.extractGradleWrapperSlugFromDistUri(
|
const version = cacheWrapper.extractGradleWrapperSlugFromDistUri(
|
||||||
|
|
|
@ -10,7 +10,7 @@ describe('crypto-utils', () => {
|
||||||
expect(hash).toBe(
|
expect(hash).toBe(
|
||||||
process.platform === 'win32'
|
process.platform === 'win32'
|
||||||
? '3364336e94e746ce65a31748a6371b7efd7d499e18ad605c74c91cde0edc0a44'
|
? '3364336e94e746ce65a31748a6371b7efd7d499e18ad605c74c91cde0edc0a44'
|
||||||
: '4ebb65b45e6f6796d5ec6ace96e9471cc6573d294c54f99c4920fe5328e75bab'
|
: '63b9f14f65d014e585099c9c274b9dcbddf5cfd1a8978e5a24efb89ff9304348'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
it('a directory with a glob', async () => {
|
it('a directory with a glob', async () => {
|
||||||
|
@ -21,7 +21,7 @@ describe('crypto-utils', () => {
|
||||||
expect(hash).toBe(
|
expect(hash).toBe(
|
||||||
process.platform === 'win32'
|
process.platform === 'win32'
|
||||||
? '3364336e94e746ce65a31748a6371b7efd7d499e18ad605c74c91cde0edc0a44'
|
? '3364336e94e746ce65a31748a6371b7efd7d499e18ad605c74c91cde0edc0a44'
|
||||||
: '4ebb65b45e6f6796d5ec6ace96e9471cc6573d294c54f99c4920fe5328e75bab'
|
: '63b9f14f65d014e585099c9c274b9dcbddf5cfd1a8978e5a24efb89ff9304348'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
it('a directory with globs', async () => {
|
it('a directory with globs', async () => {
|
||||||
|
@ -32,7 +32,7 @@ describe('crypto-utils', () => {
|
||||||
expect(hash).toBe(
|
expect(hash).toBe(
|
||||||
process.platform === 'win32'
|
process.platform === 'win32'
|
||||||
? 'd9b66fded38f79f601ce745d64ed726a8df8c0b242b02bcd2c1d331f54742ad6'
|
? 'd9b66fded38f79f601ce745d64ed726a8df8c0b242b02bcd2c1d331f54742ad6'
|
||||||
: 'aa72a837158799fbadd1c4aff94fcc2b5bb9dc6ad8d12f6337d047d4b0c8f79e'
|
: 'f42cd10636f09799f4e01cc84e7ae906cc1d9140f1446f8dcd054d19cbc44c2b'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
2
dist/main/index.js
vendored
2
dist/main/index.js
vendored
File diff suppressed because one or more lines are too long
2
dist/post/index.js
vendored
2
dist/post/index.js
vendored
File diff suppressed because one or more lines are too long
3783
package-lock.json
generated
3783
package-lock.json
generated
File diff suppressed because it is too large
Load diff
26
package.json
26
package.json
|
@ -24,30 +24,30 @@
|
||||||
"author": "Paul Merlin <paul@nosphere.org>",
|
"author": "Paul Merlin <paul@nosphere.org>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "0.2.1",
|
"@actions/cache": "1.0.2",
|
||||||
"@actions/core": "1.2.4",
|
"@actions/core": "1.2.5",
|
||||||
"@actions/exec": "1.0.4",
|
"@actions/exec": "1.0.4",
|
||||||
"@actions/glob": "0.1.0",
|
"@actions/glob": "0.1.0",
|
||||||
"@actions/io": "1.0.2",
|
"@actions/io": "1.0.2",
|
||||||
"@actions/tool-cache": "1.5.5",
|
"@actions/tool-cache": "1.6.0",
|
||||||
"string-argv": "0.3.1",
|
"string-argv": "0.3.1",
|
||||||
"typed-rest-client": "1.7.3",
|
"typed-rest-client": "1.7.3",
|
||||||
"unzipper": "0.10.11"
|
"unzipper": "0.10.11"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "26.0.0",
|
"@types/jest": "26.0.13",
|
||||||
"@types/node": "12.12.6",
|
"@types/node": "12.12.6",
|
||||||
"@types/unzipper": "0.10.3",
|
"@types/unzipper": "0.10.3",
|
||||||
"@typescript-eslint/parser": "3.3.0",
|
"@typescript-eslint/parser": "4.1.0",
|
||||||
"@zeit/ncc": "0.22.3",
|
"@zeit/ncc": "0.22.3",
|
||||||
"eslint": "7.3.0",
|
"eslint": "7.9.0",
|
||||||
"eslint-plugin-github": "4.0.1",
|
"eslint-plugin-github": "4.1.1",
|
||||||
"eslint-plugin-jest": "23.16.0",
|
"eslint-plugin-jest": "24.0.1",
|
||||||
"jest": "26.0.1",
|
"jest": "26.4.2",
|
||||||
"jest-circus": "26.0.1",
|
"jest-circus": "26.4.2",
|
||||||
"js-yaml": "3.14.0",
|
"js-yaml": "3.14.0",
|
||||||
"prettier": "2.0.5",
|
"prettier": "2.1.1",
|
||||||
"ts-jest": "26.1.1",
|
"ts-jest": "26.3.0",
|
||||||
"typescript": "3.9.5"
|
"typescript": "4.0.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ export async function restoreCachedWrapperDist(
|
||||||
if (!wrapperSlug) return
|
if (!wrapperSlug) return
|
||||||
|
|
||||||
const wrapperCacheKey = `wrapper-${wrapperSlug}`
|
const wrapperCacheKey = `wrapper-${wrapperSlug}`
|
||||||
const wrapperCachePath = path.join(
|
const wrapperCachePath = path.resolve(
|
||||||
os.homedir(),
|
os.homedir(),
|
||||||
`.gradle/wrapper/dists/gradle-${wrapperSlug}`
|
`.gradle/wrapper/dists/gradle-${wrapperSlug}`
|
||||||
)
|
)
|
||||||
|
@ -35,6 +35,7 @@ export async function restoreCachedWrapperDist(
|
||||||
core.saveState(WRAPPER_CACHE_KEY, wrapperCacheKey)
|
core.saveState(WRAPPER_CACHE_KEY, wrapperCacheKey)
|
||||||
core.saveState(WRAPPER_CACHE_PATH, wrapperCachePath)
|
core.saveState(WRAPPER_CACHE_PATH, wrapperCachePath)
|
||||||
|
|
||||||
|
try {
|
||||||
const restoredKey = await cache.restoreCache(
|
const restoredKey = await cache.restoreCache(
|
||||||
[wrapperCachePath],
|
[wrapperCachePath],
|
||||||
wrapperCacheKey
|
wrapperCacheKey
|
||||||
|
@ -48,8 +49,16 @@ export async function restoreCachedWrapperDist(
|
||||||
}
|
}
|
||||||
|
|
||||||
core.saveState(WRAPPER_CACHE_RESULT, restoredKey)
|
core.saveState(WRAPPER_CACHE_RESULT, restoredKey)
|
||||||
core.info(`Wrapper installation restored from cache key: ${restoredKey}`)
|
core.info(
|
||||||
|
`Wrapper installation restored from cache key: ${restoredKey}`
|
||||||
|
)
|
||||||
return
|
return
|
||||||
|
} catch (error) {
|
||||||
|
core.info(
|
||||||
|
`Wrapper installation cache restore failed, expect a Gradle distribution download\n ${error}`
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function cacheWrapperDist(): Promise<void> {
|
export async function cacheWrapperDist(): Promise<void> {
|
||||||
|
|
|
@ -18,12 +18,9 @@ export async function execute(
|
||||||
ignoreReturnCode: true,
|
ignoreReturnCode: true,
|
||||||
listeners: {
|
listeners: {
|
||||||
stdline: (line: string) => {
|
stdline: (line: string) => {
|
||||||
if (line.startsWith('Publishing build scan...')) {
|
if (line.includes('Publishing build scan...')) {
|
||||||
publishing = true
|
publishing = true
|
||||||
}
|
}
|
||||||
if (publishing && line.length === 0) {
|
|
||||||
publishing = false
|
|
||||||
}
|
|
||||||
if (publishing && line.startsWith('http')) {
|
if (publishing && line.startsWith('http')) {
|
||||||
buildScanUrl = line.trim()
|
buildScanUrl = line.trim()
|
||||||
publishing = false
|
publishing = false
|
||||||
|
|
|
@ -41,9 +41,10 @@ async function gradleReleaseCandidate(): Promise<string> {
|
||||||
const versionInfo = await gradleVersionDeclaration(
|
const versionInfo = await gradleVersionDeclaration(
|
||||||
`${gradleVersionsBaseUrl}/release-candidate`
|
`${gradleVersionsBaseUrl}/release-candidate`
|
||||||
)
|
)
|
||||||
if (versionInfo) {
|
if (versionInfo && versionInfo.version && versionInfo.downloadUrl) {
|
||||||
return provisionGradle(versionInfo.version, versionInfo.downloadUrl)
|
return provisionGradle(versionInfo.version, versionInfo.downloadUrl)
|
||||||
}
|
}
|
||||||
|
core.info('No current release-candidate found, will fallback to current')
|
||||||
return gradleCurrent()
|
return gradleCurrent()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue