Support direct file uploads (#764)
Some checks failed
Licensed / Check licenses (push) Successful in 50s
Test / Build (ubuntu-latest) (push) Failing after 1m15s
Check dist/ / check-dist (push) Successful in 1m34s
Test / Upload HTML Report (push) Failing after 1m29s
Test Proxy / test-proxy-upload (push) Failing after 1m43s
Test / Build (macos-latest) (push) Has been cancelled
Test / Build (windows-latest) (push) Has been cancelled
Test / Merge (push) Has been cancelled
Test / Cleanup Artifacts (push) Has been cancelled
Code scanning - action / CodeQL-Build (push) Failing after 35s

* 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:
Daniel Kennedy
2026-02-25 16:04:27 -05:00
committed by GitHub
parent 589182c5a4
commit bbbca2ddaa
10 changed files with 242 additions and 14 deletions

View File

@@ -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()
})
})