Compare commits

..

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

36 changed files with 7637 additions and 3363 deletions

3
.eslintignore Normal file
View file

@ -0,0 +1,3 @@
/dist/**
/coverage/**
/node_modules/**

24
.eslintrc.json Normal file
View file

@ -0,0 +1,24 @@
{
"env": {
"node": true,
"es6": true,
"jest": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"jest",
"prettier"
]
}

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` 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` 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) 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: Here are a few things you can do that will increase the likelihood of your pull request being accepted:

View file

@ -4,12 +4,6 @@ updates:
directory: "/" directory: "/"
schedule: schedule:
interval: "daily" interval: "daily"
cooldown:
default-days: 2
groups:
crazy-max-dot-github:
patterns:
- "crazy-max/.github/*"
labels: labels:
- "dependencies" - "dependencies"
- "bot" - "bot"
@ -17,8 +11,6 @@ updates:
directory: "/" directory: "/"
schedule: schedule:
interval: "daily" interval: "daily"
cooldown:
default-days: 2
versioning-strategy: "increase" versioning-strategy: "increase"
allow: allow:
- dependency-type: "production" - dependency-type: "production"

View file

@ -1,14 +1,10 @@
name: ci name: ci
permissions:
contents: read
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.ref }} group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
on: on:
workflow_dispatch:
schedule: schedule:
- cron: '0 10 * * *' - cron: '0 10 * * *'
push: push:
@ -25,7 +21,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 uses: actions/checkout@v4
- -
name: Set up QEMU name: Set up QEMU
id: qemu id: qemu
@ -48,7 +44,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 uses: actions/checkout@v4
- -
name: Set up QEMU name: Set up QEMU
id: qemu id: qemu
@ -65,7 +61,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 uses: actions/checkout@v4
- -
name: Stop docker name: Stop docker
run: | run: |
@ -95,7 +91,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 uses: actions/checkout@v4
- -
name: Set up QEMU name: Set up QEMU
id: qemu id: qemu
@ -106,22 +102,3 @@ jobs:
- -
name: Available platforms name: Available platforms
run: echo ${{ steps.qemu.outputs.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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
-
name: Set up QEMU
uses: ./
with:
image: ${{ matrix.image }}

View file

@ -1,46 +0,0 @@
name: codeql
permissions:
contents: read
on:
push:
branches:
- 'master'
- 'releases/v*'
pull_request:
env:
NODE_VERSION: "24"
jobs:
analyze:
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
-
name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
-
name: Enable corepack
run: |
corepack enable
yarn --version
-
name: Set up Node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: ${{ env.NODE_VERSION }}
-
name: Initialize CodeQL
uses: github/codeql-action/init@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
with:
languages: javascript-typescript
build-mode: none
-
name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
with:
category: "/language:javascript-typescript"

View file

@ -1,17 +0,0 @@
name: pr-assign-author
permissions:
contents: read
on:
pull_request_target: # zizmor: ignore[dangerous-triggers] safe to use without checkout
types:
- opened
- reopened
jobs:
run:
uses: crazy-max/.github/.github/workflows/pr-assign-author.yml@bb328ea508cd6a89d0865555ddbeb148e5724aed # v1.3.0
permissions:
contents: read
pull-requests: write

View file

@ -1,12 +1,5 @@
name: publish name: publish
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on: on:
release: release:
types: types:
@ -22,7 +15,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 uses: actions/checkout@v4
- -
name: Publish name: Publish
uses: actions/publish-immutable-action@4bc8754ffc40f27910afb20287dbbbb675a4e978 # v0.0.4 uses: actions/publish-immutable-action@v0.0.4

View file

@ -1,8 +1,5 @@
name: test name: test
permissions:
contents: read
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.ref }} group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
@ -20,16 +17,15 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 uses: actions/checkout@v4
- -
name: Test name: Test
uses: docker/bake-action@82490499d2e5613fcead7e128237ef0b0ea210f7 # v7.0.0 uses: docker/bake-action@v5
with: with:
source: .
targets: test targets: test
- -
name: Upload coverage name: Upload coverage
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0 uses: codecov/codecov-action@v5
with: with:
files: ./coverage/clover.xml files: ./coverage/clover.xml
token: ${{ secrets.CODECOV_TOKEN }} token: ${{ secrets.CODECOV_TOKEN }}

View file

@ -1,56 +0,0 @@
name: update-dist
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
types:
- opened
- synchronize
jobs:
update-dist:
if: github.actor == 'dependabot[bot]' && github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == github.event.pull_request.head.repo.full_name
runs-on: ubuntu-latest
steps:
-
name: GitHub auth token from GitHub App
id: docker-read-app
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
with:
app-id: ${{ secrets.GHACTIONS_REPO_WRITE_APP_ID }}
private-key: ${{ secrets.GHACTIONS_REPO_WRITE_APP_PRIVATE_KEY }}
owner: docker
-
name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
token: ${{ steps.docker-read-app.outputs.token }}
-
name: Build
uses: docker/bake-action@82490499d2e5613fcead7e128237ef0b0ea210f7 # v7.0.0
with:
source: .
targets: build
-
name: Commit and push dist
run: |
if [ -n "$(git status --porcelain -- dist)" ]; then
(
set -x
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add dist
git commit -m "chore: update generated content"
git push
)
else
echo "No changes in dist"
fi

View file

@ -1,8 +1,5 @@
name: validate name: validate
permissions:
contents: read
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.ref }} group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
@ -18,17 +15,16 @@ jobs:
prepare: prepare:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
matrix: ${{ steps.generate.outputs.matrix }} targets: ${{ steps.targets.outputs.matrix }}
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 uses: actions/checkout@v4
- -
name: Generate matrix name: Targets matrix
id: generate id: targets
uses: docker/bake-action/subaction/matrix@82490499d2e5613fcead7e128237ef0b0ea210f7 # v7.0.0 run: |
with: echo "matrix=$(docker buildx bake validate --print | jq -cr '.group.validate.targets')" >> $GITHUB_OUTPUT
target: validate
validate: validate:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -37,10 +33,13 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
include: ${{ fromJson(needs.prepare.outputs.matrix) }} target: ${{ fromJson(needs.prepare.outputs.targets) }}
steps: steps:
-
name: Checkout
uses: actions/checkout@v4
- -
name: Validate name: Validate
uses: docker/bake-action@82490499d2e5613fcead7e128237ef0b0ea210f7 # v7.0.0 uses: docker/bake-action@v5
with: with:
targets: ${{ matrix.target }} targets: ${{ matrix.target }}

View file

@ -1,29 +0,0 @@
name: zizmor
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
push:
branches:
- 'master'
- 'releases/v*'
tags:
- 'v*'
pull_request:
jobs:
zizmor:
uses: crazy-max/.github/.github/workflows/zizmor.yml@bb328ea508cd6a89d0865555ddbeb148e5724aed # v1.3.0
permissions:
contents: read
security-events: write
with:
min-severity: medium
min-confidence: medium
persona: pedantic

3
.github/zizmor.yml vendored
View file

@ -1,3 +0,0 @@
rules:
secrets-outside-env: # FIXME: remove this rule when zizmor 1.24.0 is released, fixing the right persona attached to this rule: https://github.com/zizmorcore/zizmor/pull/1783
disable: true

View file

@ -6,5 +6,6 @@
"singleQuote": true, "singleQuote": true,
"trailingComma": "none", "trailingComma": "none",
"bracketSpacing": false, "bracketSpacing": false,
"arrowParens": "avoid" "arrowParens": "avoid",
"parser": "typescript"
} }

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: logFilters:
- code: YN0013 - code: YN0013
level: discard level: discard
@ -11,9 +5,9 @@ logFilters:
level: discard level: discard
- code: YN0076 - code: YN0076
level: discard level: discard
- code: YN0086
level: discard
nodeLinker: node-modules nodeLinker: node-modules
npmAuthToken: "${NODE_AUTH_TOKEN:-fallback}" plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"

View file

@ -32,22 +32,9 @@ jobs:
steps: steps:
- -
name: Set up QEMU name: Set up QEMU
uses: docker/setup-qemu-action@v4 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@v4
> -
> name: Set up Docker Buildx
> uses: docker/setup-buildx-action@v4
> ```
## Customizing ## Customizing
### inputs ### inputs

View file

@ -1,6 +1,6 @@
import {beforeEach, describe, expect, test} from 'vitest'; import {beforeEach, describe, expect, test} from '@jest/globals';
import * as context from '../src/context.js'; import * as context from '../src/context';
describe('getInputs', () => { describe('getInputs', () => {
beforeEach(() => { beforeEach(() => {
@ -13,7 +13,7 @@ describe('getInputs', () => {
}); });
// prettier-ignore // prettier-ignore
const cases: [number, Map<string, string>, context.Inputs][] = [ test.each([
[ [
0, 0,
new Map<string, string>([ new Map<string, string>([
@ -23,7 +23,7 @@ describe('getInputs', () => {
image: 'docker.io/tonistiigi/binfmt:latest', image: 'docker.io/tonistiigi/binfmt:latest',
platforms: 'all', platforms: 'all',
cacheImage: true, cacheImage: true,
} } as context.Inputs
], ],
[ [
1, 1,
@ -36,7 +36,7 @@ describe('getInputs', () => {
image: 'docker/binfmt:latest', image: 'docker/binfmt:latest',
platforms: 'arm64,riscv64,arm', platforms: 'arm64,riscv64,arm',
cacheImage: false, cacheImage: false,
} } as context.Inputs
], ],
[ [
2, 2,
@ -48,11 +48,10 @@ describe('getInputs', () => {
image: 'docker.io/tonistiigi/binfmt:latest', image: 'docker.io/tonistiigi/binfmt:latest',
platforms: 'arm64,riscv64,arm', platforms: 'arm64,riscv64,arm',
cacheImage: true, cacheImage: true,
} } as context.Inputs
] ]
]; ])(
test.each(cases)( '[%d] given %p as inputs, returns %p',
'[%d] given %o as inputs, returns %o',
async (num: number, inputs: Map<string, string>, expected: context.Inputs) => { async (num: number, inputs: Map<string, string>, expected: context.Inputs) => {
inputs.forEach((value: string, name: string) => { inputs.forEach((value: string, name: string) => {
setInput(name, value); setInput(name, value);

View file

@ -1,12 +0,0 @@
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-setup-qemu-action-'));
process.env = Object.assign({}, process.env, {
TEMP: tmpDir,
GITHUB_REPOSITORY: 'docker/setup-qemu-action',
RUNNER_TEMP: path.join(tmpDir, 'runner-temp'),
RUNNER_TOOL_CACHE: path.join(tmpDir, 'runner-tool-cache')
});

View file

@ -25,6 +25,6 @@ outputs:
description: 'Available platforms (comma separated)' description: 'Available platforms (comma separated)'
runs: runs:
using: 'node24' using: 'node20'
main: 'dist/index.js' main: 'dist/index.js'
post: 'dist/index.js' post: 'dist/index.js'

View file

@ -1,13 +1,12 @@
# syntax=docker/dockerfile:1 # syntax=docker/dockerfile:1
ARG NODE_VERSION=24 ARG NODE_VERSION=20
FROM node:${NODE_VERSION}-alpine AS base FROM node:${NODE_VERSION}-alpine AS base
RUN apk add --no-cache cpio findutils git rsync RUN apk add --no-cache cpio findutils git
WORKDIR /src WORKDIR /src
RUN --mount=type=bind,target=.,rw \ RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/.yarn/cache <<EOT --mount=type=cache,target=/src/.yarn/cache <<EOT
set -e
corepack enable corepack enable
yarn --version yarn --version
yarn config set --home enableTelemetry 0 yarn config set --home enableTelemetry 0
@ -35,27 +34,18 @@ RUN --mount=type=bind,target=.,rw <<EOT
EOT EOT
FROM deps AS build FROM deps AS build
RUN --mount=target=/context \ RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/.yarn/cache \ --mount=type=cache,target=/src/.yarn/cache \
--mount=type=cache,target=/src/node_modules <<EOT --mount=type=cache,target=/src/node_modules \
set -e yarn run build && mkdir /out && cp -Rf dist /out/
rsync -a /context/. .
rm -rf dist
yarn run build
mkdir /out
cp -r dist /out
EOT
FROM scratch AS build-update FROM scratch AS build-update
COPY --from=build /out / COPY --from=build /out /
FROM build AS build-validate FROM build AS build-validate
RUN --mount=target=/context \ RUN --mount=type=bind,target=.,rw <<EOT
--mount=target=.,type=tmpfs <<EOT
set -e set -e
rsync -a /context/. .
git add -A git add -A
rm -rf dist
cp -rf /out/* . cp -rf /out/* .
if [ -n "$(git status --porcelain -- dist)" ]; then if [ -n "$(git status --porcelain -- dist)" ]; then
echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"' echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'
@ -68,7 +58,8 @@ FROM deps AS format
RUN --mount=type=bind,target=.,rw \ RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/.yarn/cache \ --mount=type=cache,target=/src/.yarn/cache \
--mount=type=cache,target=/src/node_modules \ --mount=type=cache,target=/src/node_modules \
yarn run format && mkdir /out && find . -name '*.ts' -not -path './node_modules/*' -not -path './.yarn/*' | cpio -pdm /out yarn run format \
&& mkdir /out && find . -name '*.ts' -not -path './node_modules/*' -not -path './.yarn/*' | cpio -pdm /out
FROM scratch AS format-update FROM scratch AS format-update
COPY --from=format /out / COPY --from=format /out /
@ -83,7 +74,7 @@ FROM deps AS test
RUN --mount=type=bind,target=.,rw \ RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/.yarn/cache \ --mount=type=cache,target=/src/.yarn/cache \
--mount=type=cache,target=/src/node_modules \ --mount=type=cache,target=/src/node_modules \
yarn run test --coverage --coverage.reportsDirectory=/tmp/coverage yarn run test --coverage --coverageDirectory=/tmp/coverage
FROM scratch AS test-coverage FROM scratch AS test-coverage
COPY --from=test /tmp/coverage / COPY --from=test /tmp/coverage /

105
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

2456
dist/licenses.txt generated vendored

File diff suppressed because it is too large Load diff

3
dist/package.json generated vendored
View file

@ -1,3 +0,0 @@
{
"type": "module"
}

1
dist/sourcemap-register.cjs generated vendored

File diff suppressed because one or more lines are too long

1
dist/sourcemap-register.js generated vendored Normal file

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" { group "default" {
targets = ["build"] targets = ["build"]
} }
@ -17,49 +11,42 @@ group "validate" {
} }
target "build" { target "build" {
inherits = ["_common"]
dockerfile = "dev.Dockerfile" dockerfile = "dev.Dockerfile"
target = "build-update" target = "build-update"
output = ["."] output = ["."]
} }
target "build-validate" { target "build-validate" {
inherits = ["_common"]
dockerfile = "dev.Dockerfile" dockerfile = "dev.Dockerfile"
target = "build-validate" target = "build-validate"
output = ["type=cacheonly"] output = ["type=cacheonly"]
} }
target "format" { target "format" {
inherits = ["_common"]
dockerfile = "dev.Dockerfile" dockerfile = "dev.Dockerfile"
target = "format-update" target = "format-update"
output = ["."] output = ["."]
} }
target "lint" { target "lint" {
inherits = ["_common"]
dockerfile = "dev.Dockerfile" dockerfile = "dev.Dockerfile"
target = "lint" target = "lint"
output = ["type=cacheonly"] output = ["type=cacheonly"]
} }
target "vendor" { target "vendor" {
inherits = ["_common"]
dockerfile = "dev.Dockerfile" dockerfile = "dev.Dockerfile"
target = "vendor-update" target = "vendor-update"
output = ["."] output = ["."]
} }
target "vendor-validate" { target "vendor-validate" {
inherits = ["_common"]
dockerfile = "dev.Dockerfile" dockerfile = "dev.Dockerfile"
target = "vendor-validate" target = "vendor-validate"
output = ["type=cacheonly"] output = ["type=cacheonly"]
} }
target "test" { target "test" {
inherits = ["_common"]
dockerfile = "dev.Dockerfile" dockerfile = "dev.Dockerfile"
target = "test-coverage" target = "test-coverage"
output = ["./coverage"] output = ["./coverage"]

View file

@ -1,52 +0,0 @@
import {defineConfig} from 'eslint/config';
import js from '@eslint/js';
import tseslint from '@typescript-eslint/eslint-plugin';
import vitest from '@vitest/eslint-plugin';
import globals from 'globals';
import eslintConfigPrettier from 'eslint-config-prettier/flat';
import eslintPluginPrettier from 'eslint-plugin-prettier';
export default defineConfig([
{
ignores: ['.yarn/**/*', 'coverage/**/*', 'dist/**/*']
},
js.configs.recommended,
...tseslint.configs['flat/recommended'],
eslintConfigPrettier,
{
languageOptions: {
globals: {
...globals.node
}
}
},
{
files: ['__tests__/**'],
...vitest.configs.recommended,
languageOptions: {
globals: {
...globals.node,
...vitest.environments.env.globals
}
},
rules: {
...vitest.configs.recommended.rules,
'vitest/no-conditional-expect': 'error',
'vitest/no-disabled-tests': 0
}
},
{
plugins: {
prettier: eslintPluginPrettier
},
rules: {
'prettier/prettier': 'error',
'@typescript-eslint/no-require-imports': [
'error',
{
allowAsImport: true
}
]
}
}
]);

29
jest.config.ts Normal file
View file

@ -0,0 +1,29 @@
import fs from 'fs';
import os from 'os';
import path from 'path';
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-setup-qemu-action-'));
process.env = Object.assign({}, process.env, {
TEMP: tmpDir,
GITHUB_REPOSITORY: 'docker/setup-qemu-action',
RUNNER_TEMP: path.join(tmpDir, 'runner-temp'),
RUNNER_TOOL_CACHE: path.join(tmpDir, 'runner-tool-cache')
}) as {
[key: string]: string;
};
module.exports = {
clearMocks: true,
moduleFileExtensions: ['js', 'ts'],
testMatch: ['**/*.test.ts'],
transform: {
'^.+\\.ts$': 'ts-jest'
},
moduleNameMapper: {
'^csv-parse/sync': '<rootDir>/node_modules/csv-parse/dist/cjs/sync.cjs'
},
collectCoverageFrom: ['src/**/{!(main.ts),}.ts'],
coveragePathIgnorePatterns: ['lib/', 'node_modules/', '__mocks__/', '__tests__/'],
verbose: true
};

View file

@ -1,13 +1,16 @@
{ {
"name": "docker-setup-qemu", "name": "docker-setup-qemu",
"description": "Install QEMU static binaries", "description": "Install QEMU static binaries",
"type": "module",
"main": "src/main.ts", "main": "src/main.ts",
"scripts": { "scripts": {
"build": "ncc build src/main.ts --source-map --minify --license licenses.txt", "build": "ncc build src/main.ts --source-map --minify --license licenses.txt",
"lint": "eslint --max-warnings=0 .", "lint": "yarn run prettier && yarn run eslint",
"format": "eslint --fix .", "format": "yarn run prettier:fix && yarn run eslint:fix",
"test": "vitest run" "eslint": "eslint --max-warnings=0 .",
"eslint:fix": "eslint --fix .",
"prettier": "prettier --check \"./**/*.ts\"",
"prettier:fix": "prettier --write \"./**/*.ts\"",
"test": "jest"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -20,25 +23,24 @@
], ],
"author": "Docker Inc.", "author": "Docker Inc.",
"license": "Apache-2.0", "license": "Apache-2.0",
"packageManager": "yarn@4.9.2", "packageManager": "yarn@3.6.3",
"dependencies": { "dependencies": {
"@actions/core": "^3.0.0", "@actions/core": "^1.11.1",
"@docker/actions-toolkit": "^0.79.0" "@docker/actions-toolkit": "^0.49.0"
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.39.3", "@types/node": "^20.12.12",
"@types/node": "^24.11.0", "@typescript-eslint/eslint-plugin": "^7.9.0",
"@typescript-eslint/eslint-plugin": "^8.56.1", "@typescript-eslint/parser": "^7.9.0",
"@typescript-eslint/parser": "^8.56.1", "@vercel/ncc": "^0.38.1",
"@vercel/ncc": "^0.38.4", "eslint": "^8.57.0",
"@vitest/coverage-v8": "^4.0.18", "eslint-config-prettier": "^9.1.0",
"@vitest/eslint-plugin": "^1.6.9", "eslint-plugin-jest": "^28.5.0",
"eslint": "^9.39.3", "eslint-plugin-prettier": "^5.1.3",
"eslint-config-prettier": "^10.1.8", "jest": "^29.7.0",
"eslint-plugin-prettier": "^5.5.5", "prettier": "^3.2.5",
"globals": "^17.3.0", "ts-jest": "^29.1.2",
"prettier": "^3.8.1", "ts-node": "^10.9.2",
"typescript": "^5.9.3", "typescript": "^5.4.5"
"vitest": "^4.0.18"
} }
} }

View file

@ -1,5 +1,5 @@
import * as core from '@actions/core'; import * as core from '@actions/core';
import {Util} from '@docker/actions-toolkit/lib/util.js'; import {Util} from '@docker/actions-toolkit/lib/util';
export interface Inputs { export interface Inputs {
image: string; image: string;

View file

@ -1,9 +1,8 @@
import * as context from './context';
import * as core from '@actions/core'; import * as core from '@actions/core';
import * as actionsToolkit from '@docker/actions-toolkit'; import * as actionsToolkit from '@docker/actions-toolkit';
import {Docker} from '@docker/actions-toolkit/lib/docker/docker.js'; import {Docker} from '@docker/actions-toolkit/lib/docker/docker';
import * as context from './context.js';
interface Platforms { interface Platforms {
supported: string[]; supported: string[];
@ -34,16 +33,6 @@ actionsToolkit.run(
}); });
}); });
await core.group(`Binfmt version`, async () => {
await Docker.getExecOutput(['run', '--rm', '--privileged', input.image, '--version'], {
ignoreReturnCode: true
}).then(res => {
if (res.stderr.length > 0 && res.exitCode != 0) {
throw new Error(res.stderr.match(/(.*)\s*$/)?.[0]?.trim() ?? 'unknown error');
}
});
});
await core.group(`Installing QEMU static binaries`, async () => { await core.group(`Installing QEMU static binaries`, async () => {
await Docker.getExecOutput(['run', '--rm', '--privileged', input.image, '--install', input.platforms], { await Docker.getExecOutput(['run', '--rm', '--privileged', input.image, '--install', input.platforms], {
ignoreReturnCode: true ignoreReturnCode: true

View file

@ -1,8 +1,9 @@
{ {
"compilerOptions": { "compilerOptions": {
"module": "nodenext",
"moduleResolution": "nodenext",
"esModuleInterop": true, "esModuleInterop": true,
"target": "es6",
"module": "commonjs",
"strict": true,
"newLine": "lf", "newLine": "lf",
"outDir": "./lib", "outDir": "./lib",
"rootDir": "./src", "rootDir": "./src",
@ -11,7 +12,10 @@
"resolveJsonModule": true, "resolveJsonModule": true,
"useUnknownInCatchVariables": false, "useUnknownInCatchVariables": false,
}, },
"include": [ "exclude": [
"src/**/*.ts" "./__tests__/**/*",
"./lib/**/*",
"node_modules",
"jest.config.ts"
] ]
} }

View file

@ -1,16 +0,0 @@
import {defineConfig} from 'vitest/config';
export default defineConfig({
test: {
clearMocks: true,
environment: 'node',
setupFiles: ['./__tests__/setup.unit.ts'],
include: ['**/*.test.ts'],
coverage: {
provider: 'v8',
reporter: ['clover'],
include: ['src/**/*.ts'],
exclude: ['src/**/main.ts']
}
}
});

7357
yarn.lock

File diff suppressed because it is too large Load diff