Skip to content

Commit

Permalink
Check if buildx available on runner
Browse files Browse the repository at this point in the history
Use default buildx on runner

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
  • Loading branch information
CrazyMax committed Aug 12, 2020
1 parent 15c6a86 commit 5bb3f54
Show file tree
Hide file tree
Showing 9 changed files with 299 additions and 171 deletions.
14 changes: 7 additions & 7 deletions setup-buildx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ jobs:
Following inputs can be used as `step.with` keys

| Name | Type | Default | Description |
|------------------|---------|---------------------|------------------------------------|
| `buildx-version` | String | `latest` | [Buildx](https://github.com/docker/buildx) version. e.g. `v0.3.0` |
| `driver` | String | `docker-container` | Sets the [builder driver](https://github.com/docker/buildx#--driver-driver) to be used. |
| `driver-opt` | String | | Passes additional [driver-specific options](https://github.com/docker/buildx#--driver-opt-options). e.g. `image=moby/buildkit:master` |
| `install` | Bool | `false` | Sets up `docker build` command as an alias to `docker buildx` |
| `use` | Bool | `true` | Switch to this builder instance |
| Name | Type | Default | Description |
|------------------|---------|-----------------------------------|------------------------------------|
| `buildx-version` | String | _the one installed on the runner_ | [Buildx](https://github.com/docker/buildx) version. e.g. `v0.3.0`, `latest` |
| `driver` | String | `docker-container` | Sets the [builder driver](https://github.com/docker/buildx#--driver-driver) to be used. |
| `driver-opt` | String | | Passes additional [driver-specific options](https://github.com/docker/buildx#--driver-opt-options). e.g. `image=moby/buildkit:master` |
| `install` | Bool | `false` | Sets up `docker build` command as an alias to `docker buildx` |
| `use` | Bool | `true` | Switch to this builder instance |

### outputs

Expand Down
24 changes: 24 additions & 0 deletions setup-buildx/__tests__/buildx.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import fs = require('fs');
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', () => {
it('is available', async () => {
expect(await buildx.isAvailable()).toBe(true);
}, 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);
});
20 changes: 0 additions & 20 deletions setup-buildx/__tests__/installer.test.ts

This file was deleted.

1 change: 0 additions & 1 deletion setup-buildx/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ branding:
inputs:
buildx-version:
description: 'Buildx version. e.g. v0.3.0'
default: 'latest'
required: false
driver:
description: 'Sets the builder driver to be used'
Expand Down
Loading

0 comments on commit 5bb3f54

Please sign in to comment.