Visitar URL original
buildx: install release binaries from a fork · docker/actions-toolkit@d299bba · GitHub
Skip to content

Commit d299bba

Browse files
committed
buildx: install release binaries from a fork
adds a new API method that uses the github releases API to find the appropriate version to download. Signed-off-by: Nick Santos <nick.santos@docker.com>
1 parent ca519e1 commit d299bba

4 files changed

Lines changed: 1285 additions & 1 deletion

File tree

‎__tests__/buildx/install.test.ts‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@ import * as fs from 'fs';
1919
import * as path from 'path';
2020
import * as rimraf from 'rimraf';
2121
import osm = require('os');
22+
import * as github from '@actions/github';
2223

2324
import {Install} from '../../src/buildx/install';
2425

26+
const release_0_11_0 = require('./release-v0.11.0.json');
27+
2528
// prettier-ignore
2629
const tmpDir = path.join(process.env.TEMP || '/tmp', 'buildx-jest');
2730

@@ -105,6 +108,22 @@ describe('build', () => {
105108
}, 100000);
106109
});
107110

111+
describe('installReleaseFromFork', () => {
112+
it('installs v0.11.0 by querying github releases', async () => {
113+
jest.spyOn(github, 'getOctokit').mockImplementation(() => {
114+
const request = () => Promise.resolve({data: release_0_11_0});
115+
116+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
117+
return {request} as any;
118+
});
119+
const install = new Install();
120+
const toolPath = await install.installReleaseFromFork('https://github.com/docker/buildx.git#v0.11.0');
121+
expect(fs.existsSync(toolPath)).toBe(true);
122+
const buildxBin = await install.installStandalone(toolPath, tmpDir);
123+
expect(fs.existsSync(buildxBin)).toBe(true);
124+
}, 100000);
125+
});
126+
108127
describe('getRelease', () => {
109128
it('returns latest buildx GitHub release', async () => {
110129
const release = await Install.getRelease('latest');

0 commit comments

Comments
 (0)