Skip to content

Commit 77fe937

Browse files
committed
feat!: drop cache service v1 support
1 parent 97511d4 commit 77fe937

File tree

7 files changed

+26
-201
lines changed

7 files changed

+26
-201
lines changed

lib/proxy.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ export async function initializeProxy() {
2828

2929
await server
3030
.forAnyRequest()
31-
.withUrlMatching(
32-
/(twirp\/github\.actions\.results\.api\.v1\.CacheService)|(_apis\/artifactcache)/,
33-
)
31+
.withUrlMatching(/twirp\/github\.actions\.results\.api\.v1\.CacheService/)
3432
.thenForwardTo(`http://localhost:${ENV.NITRO_PORT}`)
3533

3634
await server.forAnyWebSocket().thenPassThrough()

routes/[random]/_apis/artifactcache/cache.get.ts

Lines changed: 0 additions & 32 deletions
This file was deleted.

routes/[random]/_apis/artifactcache/caches/[cacheId].patch.ts

Lines changed: 0 additions & 47 deletions
This file was deleted.

routes/[random]/_apis/artifactcache/caches/[cacheId].post.ts

Lines changed: 0 additions & 35 deletions
This file was deleted.

routes/[random]/_apis/artifactcache/caches/index.get.ts

Lines changed: 0 additions & 29 deletions
This file was deleted.

routes/[random]/_apis/artifactcache/caches/index.post.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

tests/e2e.test.ts

Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11,36 +11,30 @@ const testFilePath = path.join(TEST_TEMP_DIR, 'test.bin')
1111

1212
const MB = 1024 * 1024
1313

14-
const versions = ['v2', 'v1'] as const
15-
16-
for (const version of versions) {
17-
describe(`save and restore cache with @actions/cache package with api ${version}`, () => {
18-
beforeAll(() => {
19-
if (version !== 'v2') return
14+
describe(`save and restore cache with @actions/cache package`, () => {
15+
beforeAll(() => {
16+
process.env.ACTIONS_CACHE_SERVICE_V2 = 'true'
17+
process.env.ACTIONS_RUNTIME_TOKEN = 'mock-runtime-token'
18+
})
19+
afterAll(() => {
20+
delete process.env.ACTIONS_CACHE_SERVICE_V2
21+
delete process.env.ACTIONS_RUNTIME_TOKEN
22+
})
2023

21-
process.env.ACTIONS_CACHE_SERVICE_V2 = 'true'
22-
process.env.ACTIONS_RUNTIME_TOKEN = 'mock-runtime-token'
23-
})
24-
afterAll(() => {
25-
delete process.env.ACTIONS_CACHE_SERVICE_V2
26-
delete process.env.ACTIONS_RUNTIME_TOKEN
24+
for (const size of [5 * MB, 50 * MB, 500 * MB, 1024 * MB])
25+
test(`${size} Bytes`, { timeout: 90_000 }, async () => {
26+
// save
27+
const expectedContents = crypto.randomBytes(size)
28+
await fs.writeFile(testFilePath, expectedContents)
29+
await saveCache([testFilePath], 'cache-key')
30+
await fs.rm(testFilePath)
31+
32+
// restore
33+
const cacheHitKey = await restoreCache([testFilePath], 'cache-key')
34+
expect(cacheHitKey).toBe('cache-key')
35+
36+
// check contents
37+
const restoredContents = await fs.readFile(testFilePath)
38+
expect(restoredContents.compare(expectedContents)).toBe(0)
2739
})
28-
29-
for (const size of [5 * MB, 50 * MB, 500 * MB, 1024 * MB])
30-
test(`${size} Bytes`, { timeout: 90_000 }, async () => {
31-
// save
32-
const expectedContents = crypto.randomBytes(size)
33-
await fs.writeFile(testFilePath, expectedContents)
34-
await saveCache([testFilePath], 'cache-key')
35-
await fs.rm(testFilePath)
36-
37-
// restore
38-
const cacheHitKey = await restoreCache([testFilePath], 'cache-key')
39-
expect(cacheHitKey).toBe('cache-key')
40-
41-
// check contents
42-
const restoredContents = await fs.readFile(testFilePath)
43-
expect(restoredContents.compare(expectedContents)).toBe(0)
44-
})
45-
})
46-
}
40+
})

0 commit comments

Comments
 (0)