Compare commits

...

12 Commits

Author SHA1 Message Date
Paul Merlin 90ccf054e6 Merge branch 'master' into releases/v1 2020-09-13 13:48:42 +02:00
Paul Merlin cb2742a00b Protect RC provisioning from network problems and add logging 2020-09-13 13:30:54 +02:00
Paul Merlin c8c53f54bb Let CI exercises using latest Gradle RC 2020-09-13 13:25:31 +02:00
Paul Merlin 863daedf86 Bump test build wrapper 2020-09-13 13:23:48 +02:00
Paul Merlin 55871cbb47 Simplify build scan url extraction 2020-09-13 13:09:14 +02:00
Paul Merlin e3d60b3873 Protect wrapper cache restore against tar errors 2020-09-13 13:06:00 +02:00
Paul Merlin 2dd6cc1801 Upgrade dependencies 2020-09-13 12:37:40 +02:00
Paul Merlin c6b57b9c8c Merge branch 'master' into releases/v1 2020-06-22 16:45:23 +02:00
Paul Merlin f11e7d60d7 Short-circuit dependencies and configuration caching if cache dir already exists
This is relevant if you run this action several times in a single job.
This prevent doing unnecessary work starting with the second job using the action.
This prevent droping dependencies downloaded by the first job using the action.
This prevent Windows agents to fail unlinking already existing files.
2020-06-22 16:40:58 +02:00
Paul Merlin 7137b09ae2 Upgrade dependencies 2020-06-22 16:36:25 +02:00
Paul Merlin 053f389907 CI prod check workflow stops Gradle daemon at the end
to allow for dependency caching to work on windows
2020-06-15 20:08:27 +02:00
Paul Merlin 4f9b5202aa Faster CI 2020-06-15 20:03:30 +02:00
14 changed files with 2425 additions and 1576 deletions
+9 -20
View File
@@ -1,3 +1,4 @@
# make sure the build works and doesn't produce spurious changes
name: dev
on:
@@ -6,10 +7,7 @@ on:
jobs:
check:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
@@ -17,19 +15,10 @@ jobs:
run: |
npm install
npm run all
- name: Test wrapper
uses: ./
with:
wrapper-directory: __tests__/data/basic
build-root-directory: __tests__/data/basic
dependencies-cache-enabled: true
configuration-cache-enabled: true
arguments: test
- name: Test dist download
uses: ./
with:
gradle-version: 6.6-milestone-1
build-root-directory: __tests__/data/basic
dependencies-cache-enabled: true
configuration-cache-enabled: true
arguments: test --configuration-cache
- name: Check for uncommitted changes
# Ensure no changes, but ignore node_modules dir since dev/fresh ci deps installed.
run: |
git diff --exit-code --stat -- . ':!node_modules' \
|| (echo "##[error] found changed files after build. please 'npm run all'" \
"and check in all changes" \
&& exit 1)
+10 -4
View File
@@ -2,10 +2,8 @@
name: prod
on:
pull_request:
push:
branches:
- master
- 'releases/*'
jobs:
check:
@@ -27,8 +25,16 @@ jobs:
- name: Test dist download
uses: ./
with:
gradle-version: 6.6-milestone-1
gradle-version: rc
build-root-directory: __tests__/data/basic
dependencies-cache-enabled: true
configuration-cache-enabled: true
arguments: test --configuration-cache
- name: Stop Gradle daemon
uses: ./
with:
gradle-version: rc
build-root-directory: __tests__/data/basic
dependencies-cache-enabled: true
configuration-cache-enabled: true
arguments: --stop
+5 -5
View File
@@ -9,19 +9,19 @@ describe('cache', () => {
'__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 () => {
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 () => {
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 () => {
const version = cacheWrapper.extractGradleWrapperSlugFromDistUri(
+3 -3
View File
@@ -10,7 +10,7 @@ describe('crypto-utils', () => {
expect(hash).toBe(
process.platform === 'win32'
? '3364336e94e746ce65a31748a6371b7efd7d499e18ad605c74c91cde0edc0a44'
: '4ebb65b45e6f6796d5ec6ace96e9471cc6573d294c54f99c4920fe5328e75bab'
: '63b9f14f65d014e585099c9c274b9dcbddf5cfd1a8978e5a24efb89ff9304348'
)
})
it('a directory with a glob', async () => {
@@ -21,7 +21,7 @@ describe('crypto-utils', () => {
expect(hash).toBe(
process.platform === 'win32'
? '3364336e94e746ce65a31748a6371b7efd7d499e18ad605c74c91cde0edc0a44'
: '4ebb65b45e6f6796d5ec6ace96e9471cc6573d294c54f99c4920fe5328e75bab'
: '63b9f14f65d014e585099c9c274b9dcbddf5cfd1a8978e5a24efb89ff9304348'
)
})
it('a directory with globs', async () => {
@@ -32,7 +32,7 @@ describe('crypto-utils', () => {
expect(hash).toBe(
process.platform === 'win32'
? 'd9b66fded38f79f601ce745d64ed726a8df8c0b242b02bcd2c1d331f54742ad6'
: 'aa72a837158799fbadd1c4aff94fcc2b5bb9dc6ad8d12f6337d047d4b0c8f79e'
: 'f42cd10636f09799f4e01cc84e7ae906cc1d9140f1446f8dcd054d19cbc44c2b'
)
})
})
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
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
zipStorePath=wrapper/dists
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+2357 -1512
View File
File diff suppressed because it is too large Load Diff
+13 -13
View File
@@ -24,30 +24,30 @@
"author": "Paul Merlin <paul@nosphere.org>",
"license": "MIT",
"dependencies": {
"@actions/cache": "0.2.1",
"@actions/core": "1.2.4",
"@actions/cache": "1.0.2",
"@actions/core": "1.2.5",
"@actions/exec": "1.0.4",
"@actions/glob": "0.1.0",
"@actions/io": "1.0.2",
"@actions/tool-cache": "1.5.5",
"@actions/tool-cache": "1.6.0",
"string-argv": "0.3.1",
"typed-rest-client": "1.7.3",
"unzipper": "0.10.11"
},
"devDependencies": {
"@types/jest": "26.0.0",
"@types/jest": "26.0.13",
"@types/node": "12.12.6",
"@types/unzipper": "0.10.3",
"@typescript-eslint/parser": "3.2.0",
"@typescript-eslint/parser": "4.1.0",
"@zeit/ncc": "0.22.3",
"eslint": "7.2.0",
"eslint-plugin-github": "4.0.1",
"eslint-plugin-jest": "23.13.2",
"jest": "26.0.1",
"jest-circus": "26.0.1",
"eslint": "7.9.0",
"eslint-plugin-github": "4.1.1",
"eslint-plugin-jest": "24.0.1",
"jest": "26.4.2",
"jest-circus": "26.4.2",
"js-yaml": "3.14.0",
"prettier": "2.0.5",
"ts-jest": "26.1.0",
"typescript": "3.8.3"
"prettier": "2.1.1",
"ts-jest": "26.3.0",
"typescript": "4.0.2"
}
}
+1
View File
@@ -19,6 +19,7 @@ export async function restoreCachedConfiguration(
if (isConfigurationCacheDisabled()) return
const cachePath = path.resolve(rootDir, '.gradle/configuration-cache')
if (fs.existsSync(cachePath)) return
core.saveState(CONFIGURATION_CACHE_PATH, cachePath)
const inputCacheExact = github.inputBoolean('configuration-cache-exact')
+1
View File
@@ -18,6 +18,7 @@ export async function restoreCachedDependencies(
if (isDependenciesCacheDisabled()) return
const cachePath = path.resolve(os.homedir(), '.gradle/caches/modules-2')
if (fs.existsSync(cachePath)) return
core.saveState(DEPENDENCIES_CACHE_PATH, cachePath)
const inputCacheExact = github.inputBoolean('dependencies-cache-exact')
+20 -11
View File
@@ -26,7 +26,7 @@ export async function restoreCachedWrapperDist(
if (!wrapperSlug) return
const wrapperCacheKey = `wrapper-${wrapperSlug}`
const wrapperCachePath = path.join(
const wrapperCachePath = path.resolve(
os.homedir(),
`.gradle/wrapper/dists/gradle-${wrapperSlug}`
)
@@ -35,21 +35,30 @@ export async function restoreCachedWrapperDist(
core.saveState(WRAPPER_CACHE_KEY, wrapperCacheKey)
core.saveState(WRAPPER_CACHE_PATH, wrapperCachePath)
const restoredKey = await cache.restoreCache(
[wrapperCachePath],
wrapperCacheKey
)
try {
const restoredKey = await cache.restoreCache(
[wrapperCachePath],
wrapperCacheKey
)
if (!restoredKey) {
if (!restoredKey) {
core.info(
'Wrapper installation cache not found, expect a Gradle distribution download.'
)
return
}
core.saveState(WRAPPER_CACHE_RESULT, restoredKey)
core.info(
'Wrapper installation cache not found, expect a Gradle distribution download.'
`Wrapper installation restored from cache key: ${restoredKey}`
)
return
} catch (error) {
core.info(
`Wrapper installation cache restore failed, expect a Gradle distribution download\n ${error}`
)
return
}
core.saveState(WRAPPER_CACHE_RESULT, restoredKey)
core.info(`Wrapper installation restored from cache key: ${restoredKey}`)
return
}
export async function cacheWrapperDist(): Promise<void> {
+1 -4
View File
@@ -18,12 +18,9 @@ export async function execute(
ignoreReturnCode: true,
listeners: {
stdline: (line: string) => {
if (line.startsWith('Publishing build scan...')) {
if (line.includes('Publishing build scan...')) {
publishing = true
}
if (publishing && line.length === 0) {
publishing = false
}
if (publishing && line.startsWith('http')) {
buildScanUrl = line.trim()
publishing = false
+2 -1
View File
@@ -41,9 +41,10 @@ async function gradleReleaseCandidate(): Promise<string> {
const versionInfo = await gradleVersionDeclaration(
`${gradleVersionsBaseUrl}/release-candidate`
)
if (versionInfo) {
if (versionInfo && versionInfo.version && versionInfo.downloadUrl) {
return provisionGradle(versionInfo.version, versionInfo.downloadUrl)
}
core.info('No current release-candidate found, will fallback to current')
return gradleCurrent()
}