Compare commits

..

No commits in common. "master" and "v3.1.0" have entirely different histories.

20 changed files with 2923 additions and 2855 deletions

View file

@ -14,7 +14,7 @@ to the public under the [project's open source license](LICENSE).
5. Format code and build javascript artifacts: `docker buildx bake pre-checkin`
6. Validate all code has correctly formatted and built: `docker buildx bake validate`
7. Push to your fork and [submit a pull request](https://github.com/docker/setup-qemu-action/compare)
8. Pat yourself on the back and wait for your pull request to be reviewed and merged.
8. Pat your self on the back and wait for your pull request to be reviewed and merged.
Here are a few things you can do that will increase the likelihood of your pull request being accepted:

View file

@ -5,7 +5,6 @@ concurrency:
cancel-in-progress: true
on:
workflow_dispatch:
schedule:
- cron: '0 10 * * *'
push:
@ -22,7 +21,7 @@ jobs:
steps:
-
name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v4
-
name: Set up QEMU
id: qemu
@ -45,7 +44,7 @@ jobs:
steps:
-
name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v4
-
name: Set up QEMU
id: qemu
@ -62,7 +61,7 @@ jobs:
steps:
-
name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v4
-
name: Stop docker
run: |
@ -80,45 +79,3 @@ jobs:
echo "::error::Should have failed"
exit 1
fi
cache-image:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
cache:
- true
- false
steps:
-
name: Checkout
uses: actions/checkout@v5
-
name: Set up QEMU
id: qemu
uses: ./
with:
image: tonistiigi/binfmt:master
cache-image: ${{ matrix.cache }}
-
name: Available platforms
run: echo ${{ steps.qemu.outputs.platforms }}
version:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
image:
- tonistiigi/binfmt:master
- tonistiigi/binfmt:latest
- tonistiigi/binfmt:qemu-v7.0.0
steps:
-
name: Checkout
uses: actions/checkout@v5
-
name: Set up QEMU
uses: ./
with:
image: ${{ matrix.image }}

View file

@ -1,17 +0,0 @@
name: pr-assign-author
permissions:
contents: read
on:
pull_request_target:
types:
- opened
- reopened
jobs:
run:
uses: crazy-max/.github/.github/workflows/pr-assign-author.yml@1b673f36fad86812f538c1df9794904038a23cbf
permissions:
contents: read
pull-requests: write

View file

@ -1,21 +0,0 @@
name: publish
on:
release:
types:
- published
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
packages: write
steps:
-
name: Checkout
uses: actions/checkout@v5
-
name: Publish
uses: actions/publish-immutable-action@v0.0.4

View file

@ -17,16 +17,15 @@ jobs:
steps:
-
name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v4
-
name: Test
uses: docker/bake-action@v6
uses: docker/bake-action@v5
with:
source: .
targets: test
-
name: Upload coverage
uses: codecov/codecov-action@v5
uses: codecov/codecov-action@v4
with:
files: ./coverage/clover.xml
file: ./coverage/clover.xml
token: ${{ secrets.CODECOV_TOKEN }}

View file

@ -15,17 +15,16 @@ jobs:
prepare:
runs-on: ubuntu-latest
outputs:
targets: ${{ steps.generate.outputs.targets }}
targets: ${{ steps.targets.outputs.matrix }}
steps:
-
name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v4
-
name: List targets
id: generate
uses: docker/bake-action/subaction/list-targets@v6
with:
target: validate
name: Targets matrix
id: targets
run: |
echo "matrix=$(docker buildx bake validate --print | jq -cr '.group.validate.targets')" >> $GITHUB_OUTPUT
validate:
runs-on: ubuntu-latest
@ -36,8 +35,11 @@ jobs:
matrix:
target: ${{ fromJson(needs.prepare.outputs.targets) }}
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Validate
uses: docker/bake-action@v6
uses: docker/bake-action@v5
with:
targets: ${{ matrix.target }}

File diff suppressed because one or more lines are too long

View file

@ -1,9 +1,3 @@
# https://yarnpkg.com/configuration/yarnrc
compressionLevel: mixed
enableGlobalCache: false
enableHardenedMode: true
logFilters:
- code: YN0013
level: discard
@ -11,9 +5,9 @@ logFilters:
level: discard
- code: YN0076
level: discard
- code: YN0086
level: discard
nodeLinker: node-modules
npmAuthToken: "${NODE_AUTH_TOKEN:-fallback}"
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"

View file

@ -35,30 +35,16 @@ jobs:
uses: docker/setup-qemu-action@v3
```
> [!NOTE]
> If you are using [`docker/setup-buildx-action`](https://github.com/docker/setup-buildx-action),
> this action should come before it:
>
> ```yaml
> -
> name: Set up QEMU
> uses: docker/setup-qemu-action@v3
> -
> name: Set up Docker Buildx
> uses: docker/setup-buildx-action@v3
> ```
## Customizing
### inputs
The following inputs can be used as `step.with` keys:
| Name | Type | Default | Description |
|---------------|--------|-------------------------------------------------------------------------------|----------------------------------------------------|
| `image` | String | [`tonistiigi/binfmt:latest`](https://hub.docker.com/r/tonistiigi/binfmt/tags) | QEMU static binaries Docker image |
| `platforms` | String | `all` | Platforms to install (e.g., `arm64,riscv64,arm`) |
| `cache-image` | Bool | `true` | Cache binfmt image to GitHub Actions cache backend |
| Name | Type | Default | Description |
|-------------|--------|-------------------------------------------------------------------------------|--------------------------------------------------|
| `image` | String | [`tonistiigi/binfmt:latest`](https://hub.docker.com/r/tonistiigi/binfmt/tags) | QEMU static binaries Docker image |
| `platforms` | String | `all` | Platforms to install (e.g., `arm64,riscv64,arm`) |
### outputs

View file

@ -16,13 +16,10 @@ describe('getInputs', () => {
test.each([
[
0,
new Map<string, string>([
['cache-image', 'true'],
]),
new Map<string, string>([]),
{
image: 'docker.io/tonistiigi/binfmt:latest',
platforms: 'all',
cacheImage: true,
} as context.Inputs
],
[
@ -30,24 +27,20 @@ describe('getInputs', () => {
new Map<string, string>([
['image', 'docker/binfmt:latest'],
['platforms', 'arm64,riscv64,arm'],
['cache-image', 'false'],
]),
{
image: 'docker/binfmt:latest',
platforms: 'arm64,riscv64,arm',
cacheImage: false,
} as context.Inputs
],
[
2,
new Map<string, string>([
['platforms', 'arm64, riscv64, arm '],
['cache-image', 'true'],
]),
{
image: 'docker.io/tonistiigi/binfmt:latest',
platforms: 'arm64,riscv64,arm',
cacheImage: true,
} as context.Inputs
]
])(

View file

@ -15,10 +15,6 @@ inputs:
description: 'Platforms to install (e.g. arm64,riscv64,arm)'
default: 'all'
required: false
cache-image:
description: 'Cache binfmt image to GitHub Actions cache backend'
default: 'true'
required: false
outputs:
platforms:
@ -27,4 +23,3 @@ outputs:
runs:
using: 'node20'
main: 'dist/index.js'
post: 'dist/index.js'

42
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

31
dist/licenses.txt generated vendored
View file

@ -2358,6 +2358,9 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
dot-object
MIT
encoding
MIT
Copyright (c) 2012-2014 Andris Reinman
@ -2559,6 +2562,31 @@ PERFORMANCE OF THIS SOFTWARE.
is-plain-object
MIT
The MIT License (MIT)
Copyright (c) 2014-2017, Jon Schlinkert.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
is-stream
MIT
MIT License
@ -3608,6 +3636,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
twirp-ts
MIT
undici
MIT
MIT License

2
dist/sourcemap-register.js generated vendored

File diff suppressed because one or more lines are too long

View file

@ -1,9 +1,3 @@
target "_common" {
args = {
BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1
}
}
group "default" {
targets = ["build"]
}
@ -17,49 +11,42 @@ group "validate" {
}
target "build" {
inherits = ["_common"]
dockerfile = "dev.Dockerfile"
target = "build-update"
output = ["."]
}
target "build-validate" {
inherits = ["_common"]
dockerfile = "dev.Dockerfile"
target = "build-validate"
output = ["type=cacheonly"]
}
target "format" {
inherits = ["_common"]
dockerfile = "dev.Dockerfile"
target = "format-update"
output = ["."]
}
target "lint" {
inherits = ["_common"]
dockerfile = "dev.Dockerfile"
target = "lint"
output = ["type=cacheonly"]
}
target "vendor" {
inherits = ["_common"]
dockerfile = "dev.Dockerfile"
target = "vendor-update"
output = ["."]
}
target "vendor-validate" {
inherits = ["_common"]
dockerfile = "dev.Dockerfile"
target = "vendor-validate"
output = ["type=cacheonly"]
}
target "test" {
inherits = ["_common"]
dockerfile = "dev.Dockerfile"
target = "test-coverage"
output = ["./coverage"]

View file

@ -23,24 +23,24 @@
],
"author": "Docker Inc.",
"license": "Apache-2.0",
"packageManager": "yarn@4.9.2",
"packageManager": "yarn@3.6.3",
"dependencies": {
"@actions/core": "^1.11.1",
"@docker/actions-toolkit": "^0.67.0"
"@actions/core": "^1.10.1",
"@docker/actions-toolkit": "^0.31.0"
},
"devDependencies": {
"@types/node": "^20.19.9",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@vercel/ncc": "^0.38.3",
"eslint": "^8.57.1",
"eslint-config-prettier": "^9.1.2",
"eslint-plugin-jest": "^28.14.0",
"eslint-plugin-prettier": "^5.5.4",
"@types/node": "^20.12.12",
"@typescript-eslint/eslint-plugin": "^7.9.0",
"@typescript-eslint/parser": "^7.9.0",
"@vercel/ncc": "^0.38.1",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jest": "^28.5.0",
"eslint-plugin-prettier": "^5.1.3",
"jest": "^29.7.0",
"prettier": "^3.6.2",
"ts-jest": "^29.4.1",
"prettier": "^3.2.5",
"ts-jest": "^29.1.2",
"ts-node": "^10.9.2",
"typescript": "^5.9.2"
"typescript": "^5.4.5"
}
}

View file

@ -4,13 +4,11 @@ import {Util} from '@docker/actions-toolkit/lib/util';
export interface Inputs {
image: string;
platforms: string;
cacheImage: boolean;
}
export function getInputs(): Inputs {
return {
image: core.getInput('image') || 'docker.io/tonistiigi/binfmt:latest',
platforms: Util.getInputList('platforms').join(',') || 'all',
cacheImage: core.getBooleanInput('cache-image')
platforms: Util.getInputList('platforms').join(',') || 'all'
};
}

View file

@ -1,8 +1,8 @@
import * as context from './context';
import * as core from '@actions/core';
import * as actionsToolkit from '@docker/actions-toolkit';
import {Docker} from '@docker/actions-toolkit/lib/docker/docker';
import {Exec} from '@docker/actions-toolkit/lib/exec';
interface Platforms {
supported: string[];
@ -20,11 +20,7 @@ actionsToolkit.run(
});
await core.group(`Pulling binfmt Docker image`, async () => {
await Docker.pull(input.image, input.cacheImage);
});
await core.group(`Image info`, async () => {
await Docker.getExecOutput(['image', 'inspect', input.image], {
await Exec.getExecOutput('docker', ['pull', input.image], {
ignoreReturnCode: true
}).then(res => {
if (res.stderr.length > 0 && res.exitCode != 0) {
@ -33,8 +29,8 @@ actionsToolkit.run(
});
});
await core.group(`Binfmt version`, async () => {
await Docker.getExecOutput(['run', '--rm', '--privileged', input.image, '--version'], {
await core.group(`Image info`, async () => {
await Exec.getExecOutput('docker', ['image', 'inspect', input.image], {
ignoreReturnCode: true
}).then(res => {
if (res.stderr.length > 0 && res.exitCode != 0) {
@ -44,7 +40,7 @@ actionsToolkit.run(
});
await core.group(`Installing QEMU static binaries`, async () => {
await Docker.getExecOutput(['run', '--rm', '--privileged', input.image, '--install', input.platforms], {
await Exec.getExecOutput('docker', ['run', '--rm', '--privileged', input.image, '--install', input.platforms], {
ignoreReturnCode: true
}).then(res => {
if (res.stderr.length > 0 && res.exitCode != 0) {
@ -54,7 +50,7 @@ actionsToolkit.run(
});
await core.group(`Extracting available platforms`, async () => {
await Docker.getExecOutput(['run', '--rm', '--privileged', input.image], {
await Exec.getExecOutput('docker', ['run', '--rm', '--privileged', input.image], {
ignoreReturnCode: true,
silent: true
}).then(res => {

4935
yarn.lock

File diff suppressed because it is too large Load diff