mirror of
https://github.com/actions/upload-artifact.git
synced 2026-04-05 18:49:25 +00:00
Support direct file uploads (#764)
Some checks failed
Code scanning - action / CodeQL-Build (push) Has been cancelled
Licensed / Check licenses (push) Has been cancelled
Check dist/ / check-dist (push) Has been cancelled
Test Proxy / test-proxy-upload (push) Has been cancelled
Test / Build (push) Has been cancelled
Test / Upload HTML Report (push) Has been cancelled
Test / Merge (push) Has been cancelled
Test / Cleanup Artifacts (push) Has been cancelled
Some checks failed
Code scanning - action / CodeQL-Build (push) Has been cancelled
Licensed / Check licenses (push) Has been cancelled
Check dist/ / check-dist (push) Has been cancelled
Test Proxy / test-proxy-upload (push) Has been cancelled
Test / Build (push) Has been cancelled
Test / Upload HTML Report (push) Has been cancelled
Test / Merge (push) Has been cancelled
Test / Cleanup Artifacts (push) Has been cancelled
* 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