Support direct file uploads (#764)
Some checks are pending
Check dist/ / check-dist (push) Waiting to run
Code scanning - action / CodeQL-Build (push) Waiting to run
Licensed / Check licenses (push) Waiting to run
Test Proxy / test-proxy-upload (push) Waiting to run
Test / Build (push) Waiting to run
Test / Build-1 (push) Waiting to run
Test / Build-2 (push) Waiting to run
Test / Upload HTML Report (push) Waiting to run
Test / Merge (push) Blocked by required conditions
Test / Cleanup Artifacts (push) Blocked by required conditions
Some checks are pending
Check dist/ / check-dist (push) Waiting to run
Code scanning - action / CodeQL-Build (push) Waiting to run
Licensed / Check licenses (push) Waiting to run
Test Proxy / test-proxy-upload (push) Waiting to run
Test / Build (push) Waiting to run
Test / Build-1 (push) Waiting to run
Test / Build-2 (push) Waiting to run
Test / Upload HTML Report (push) Waiting to run
Test / Merge (push) Blocked by required conditions
Test / Cleanup Artifacts (push) Blocked by required conditions
* Cache licenses * Bump minimatch to 10.1.1 * Try fixing licenced issues * More licensed fixes * Support direct file uploads * Add CI tests for direct uploads * Use download-artifact@main temporarily * CI: clean up artifacts on successful runs * Use script v8 * Fix some issues with the cleanup * Add unit tests * Clarify naming
This commit is contained in:
parent
589182c5a4
commit
bbbca2ddaa
10 changed files with 242 additions and 14 deletions
|
|
@ -72,6 +72,7 @@ const mockInputs = (
|
|||
[Inputs.RetentionDays]: 0,
|
||||
[Inputs.CompressionLevel]: 6,
|
||||
[Inputs.Overwrite]: false,
|
||||
[Inputs.Archive]: true,
|
||||
...overrides
|
||||
}
|
||||
|
||||
|
|
@ -273,4 +274,57 @@ describe('upload', () => {
|
|||
`Skipping deletion of '${fixtures.artifactName}', it does not exist`
|
||||
)
|
||||
})
|
||||
|
||||
test('passes skipArchive when archive is false', async () => {
|
||||
mockInputs({
|
||||
[Inputs.Archive]: false
|
||||
})
|
||||
|
||||
mockFindFilesToUpload.mockResolvedValue({
|
||||
filesToUpload: [fixtures.filesToUpload[0]],
|
||||
rootDirectory: fixtures.rootDirectory
|
||||
})
|
||||
|
||||
await run()
|
||||
|
||||
expect(artifact.default.uploadArtifact).toHaveBeenCalledWith(
|
||||
fixtures.artifactName,
|
||||
[fixtures.filesToUpload[0]],
|
||||
fixtures.rootDirectory,
|
||||
{compressionLevel: 6, skipArchive: true}
|
||||
)
|
||||
})
|
||||
|
||||
test('does not pass skipArchive when archive is true', async () => {
|
||||
mockInputs({
|
||||
[Inputs.Archive]: true
|
||||
})
|
||||
|
||||
mockFindFilesToUpload.mockResolvedValue({
|
||||
filesToUpload: [fixtures.filesToUpload[0]],
|
||||
rootDirectory: fixtures.rootDirectory
|
||||
})
|
||||
|
||||
await run()
|
||||
|
||||
expect(artifact.default.uploadArtifact).toHaveBeenCalledWith(
|
||||
fixtures.artifactName,
|
||||
[fixtures.filesToUpload[0]],
|
||||
fixtures.rootDirectory,
|
||||
{compressionLevel: 6}
|
||||
)
|
||||
})
|
||||
|
||||
test('fails when archive is false and multiple files are provided', async () => {
|
||||
mockInputs({
|
||||
[Inputs.Archive]: false
|
||||
})
|
||||
|
||||
await run()
|
||||
|
||||
expect(core.setFailed).toHaveBeenCalledWith(
|
||||
`When 'archive' is set to false, only a single file can be uploaded. Found ${fixtures.filesToUpload.length} files to upload.`
|
||||
)
|
||||
expect(artifact.default.uploadArtifact).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue