Skip to content

Commit

Permalink
Switch to tonistiigi/binfmt
Browse files Browse the repository at this point in the history
Add platforms input to choose what platforms to install

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
  • Loading branch information
CrazyMax committed Aug 11, 2020
1 parent 7e439a0 commit b943609
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 35 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/setup-qemu-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ jobs:
strategy:
fail-fast: false
matrix:
qemu-version:
- latest
- 4.2.0-7
image:
- tonistiigi/binfmt:latest
- tonistiigi/binfmt:buildkit
platforms:
- all
- arm64,riscv64,arm
steps:
-
name: Runner info
Expand All @@ -33,4 +36,5 @@ jobs:
name: Set up QEMU
uses: ./setup-qemu/
with:
qemu-version: ${{ matrix.qemu-version }}
image: ${ matrix.image }
platforms: ${ matrix.platforms }
10 changes: 6 additions & 4 deletions setup-qemu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ jobs:
name: Set up QEMU
uses: docker/actions/setup-qemu@v2
with:
qemu-version: latest
image: tonistiigi/binfmt:latest
platforms: all
```
## Customizing
Expand All @@ -41,9 +42,10 @@ jobs:
Following inputs can be used as `step.with` keys

| Name | Type | Default | Description |
|------------------|---------|-----------|------------------------------------|
| `qemu-version` | String | `latest` | [qemu-user-static](https://github.com/multiarch/qemu-user-static) version (Docker tag). Example: `4.2.0-7` |
| Name | Type | Default | Description |
|------------------|---------|-----------------------------|------------------------------------|
| `image` | String | `tonistiigi/binfmt:latest` | QEMU static binaries Docker image. Example: [`tonistiigi/binfmt:latest`](https://hub.docker.com/r/tonistiigi/binfmt/tags) |
| `platforms` | String | `all` | Platforms to install. Example: `arm64,riscv64,arm` |

## Limitation

Expand Down
10 changes: 7 additions & 3 deletions setup-qemu/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ branding:
icon: 'truck'

inputs:
qemu-version:
description: 'QEMU static binaries Docker image version. Example: 4.2.0-7'
default: 'latest'
image:
description: 'QEMU static binaries Docker image. Example: tonistiigi/binfmt:latest'
default: 'tonistiigi/binfmt:latest'
required: false
platforms:
description: 'Platforms to install. Example: arm64,riscv64,arm'
default: 'all'
required: false

runs:
Expand Down
15 changes: 3 additions & 12 deletions setup-qemu/dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 3 additions & 12 deletions setup-qemu/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,11 @@ async function run(): Promise<void> {
return;
}

const qemuVer: string = core.getInput('qemu-version') || 'latest';
const image: string = core.getInput('image') || 'tonistiigi/binfmt:latest';
const platforms: string = core.getInput('platforms') || 'all';

core.info(`💎 Installing QEMU static binaries...`);
await exec.exec('docker', [
'run',
'--rm',
'--privileged',
`multiarch/qemu-user-static:${qemuVer}`,
'--reset',
'-p',
'yes',
'--credential',
'yes'
]);
await exec.exec('docker', ['run', '--rm', '--privileged', image, '--install', platforms]);
} catch (error) {
core.setFailed(error.message);
}
Expand Down

0 comments on commit b943609

Please sign in to comment.