mirror of
https://gitea.com/docker/setup-buildx-action.git
synced 2024-11-25 10:59:35 +01:00
41ae3d0e5f
* add container based dev flow Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com> * Fix yarn test for container based dev flow Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com> * Update contributing guidelines and test workflow Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com> Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import fs = require('fs');
|
|
import * as docker from '../src/docker';
|
|
import * as buildx from '../src/buildx';
|
|
import * as path from 'path';
|
|
import * as os from 'os';
|
|
|
|
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'setup-buildx-'));
|
|
|
|
describe('buildx', () => {
|
|
async function isDaemonRunning() {
|
|
return await docker.isDaemonRunning();
|
|
}
|
|
|
|
it('is available', async () => {
|
|
expect(await buildx.isAvailable()).toBe(true);
|
|
}, 100000);
|
|
|
|
it('count builders', async () => {
|
|
const countBuilders = await buildx.countBuilders();
|
|
console.log(`countBuilders: ${countBuilders}`);
|
|
expect(countBuilders).toBeGreaterThan(0);
|
|
}, 100000);
|
|
|
|
(isDaemonRunning() ? it : it.skip)(
|
|
'platforms',
|
|
async () => {
|
|
const platforms = buildx.platforms();
|
|
console.log(`platforms: ${platforms}`);
|
|
expect(platforms).not.toBeUndefined();
|
|
expect(platforms).not.toEqual('');
|
|
},
|
|
100000
|
|
);
|
|
|
|
it('acquires v0.2.2 version of buildx', async () => {
|
|
const buildxBin = await buildx.install('v0.2.2', tmpDir);
|
|
console.log(buildxBin);
|
|
expect(fs.existsSync(buildxBin)).toBe(true);
|
|
}, 100000);
|
|
|
|
it('acquires latest version of buildx', async () => {
|
|
const buildxBin = await buildx.install('latest', tmpDir);
|
|
console.log(buildxBin);
|
|
expect(fs.existsSync(buildxBin)).toBe(true);
|
|
}, 100000);
|
|
});
|