Skip to content

Commit 73c2f4f

Browse files
committed
Merge upstream master to resolve conflicts
2 parents 7c1669e + 72cd565 commit 73c2f4f

20 files changed

+2079
-6615
lines changed

.prettierrc.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@
66
"singleQuote": true,
77
"trailingComma": "none",
88
"bracketSpacing": false,
9-
"arrowParens": "avoid",
10-
"parser": "typescript"
9+
"arrowParens": "avoid"
1110
}

README.md

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ GitHub Action to install [QEMU](https://github.com/qemu/qemu) static binaries.
1313
___
1414

1515
* [Usage](#usage)
16+
* [Multi-platform build example](#multi-platform-build-example)
1617
* [Customizing](#customizing)
1718
* [inputs](#inputs)
1819
* [outputs](#outputs)
@@ -32,7 +33,7 @@ jobs:
3233
steps:
3334
-
3435
name: Set up QEMU
35-
uses: docker/setup-qemu-action@v3
36+
uses: docker/setup-qemu-action@v4
3637
```
3738
3839
> [!NOTE]
@@ -42,12 +43,11 @@ jobs:
4243
> ```yaml
4344
> -
4445
> name: Set up QEMU
45-
> uses: docker/setup-qemu-action@v3
46+
> uses: docker/setup-qemu-action@v4
4647
> -
47-
-
48-
name: Set up Docker Buildx
49-
uses: docker/setup-buildx-action@v3
50-
```
48+
> name: Set up Docker Buildx
49+
> uses: docker/setup-buildx-action@v4
50+
> ```
5151

5252
### Multi-platform build example
5353

@@ -57,33 +57,33 @@ The following example shows how to use this action to build and push a multi-pla
5757
name: ci
5858
5959
on:
60-
push:
61-
branches:
62-
- 'main'
60+
push:
61+
branches:
62+
- 'main'
6363
6464
jobs:
65-
docker:
66-
runs-on: ubuntu-latest
67-
steps:
68-
-
69-
name: Set up QEMU
70-
uses: docker/setup-qemu-action@v3
71-
-
72-
name: Set up Docker Buildx
73-
uses: docker/setup-buildx-action@v3
74-
-
75-
name: Login to Docker Hub
76-
uses: docker/login-action@v3
77-
with:
78-
username: ${{ secrets.DOCKERHUB_USERNAME }}
79-
password: ${{ secrets.DOCKERHUB_TOKEN }}
80-
-
81-
name: Build and push
82-
uses: docker/build-push-action@v6
83-
with:
84-
push: true
85-
tags: user/app:latest
86-
platforms: linux/amd64,linux/arm64
65+
docker:
66+
runs-on: ubuntu-latest
67+
steps:
68+
-
69+
name: Set up QEMU
70+
uses: docker/setup-qemu-action@v4
71+
-
72+
name: Set up Docker Buildx
73+
uses: docker/setup-buildx-action@v4
74+
-
75+
name: Login to Docker Hub
76+
uses: docker/login-action@v3
77+
with:
78+
username: ${{ secrets.DOCKERHUB_USERNAME }}
79+
password: ${{ secrets.DOCKERHUB_TOKEN }}
80+
-
81+
name: Build and push
82+
uses: docker/build-push-action@v6
83+
with:
84+
push: true
85+
tags: user/app:latest
86+
platforms: linux/amd64,linux/arm64
8787
```
8888

8989
## Customizing

__tests__/context.test.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import {beforeEach, describe, expect, test} from '@jest/globals';
1+
import {beforeEach, describe, expect, test} from 'vitest';
22

3-
import * as context from '../src/context';
3+
import * as context from '../src/context.js';
44

55
describe('getInputs', () => {
66
beforeEach(() => {
@@ -13,7 +13,7 @@ describe('getInputs', () => {
1313
});
1414

1515
// prettier-ignore
16-
test.each([
16+
const cases: [number, Map<string, string>, context.Inputs][] = [
1717
[
1818
0,
1919
new Map<string, string>([
@@ -23,7 +23,7 @@ describe('getInputs', () => {
2323
image: 'docker.io/tonistiigi/binfmt:latest',
2424
platforms: 'all',
2525
cacheImage: true,
26-
} as context.Inputs
26+
}
2727
],
2828
[
2929
1,
@@ -36,7 +36,7 @@ describe('getInputs', () => {
3636
image: 'docker/binfmt:latest',
3737
platforms: 'arm64,riscv64,arm',
3838
cacheImage: false,
39-
} as context.Inputs
39+
}
4040
],
4141
[
4242
2,
@@ -48,10 +48,11 @@ describe('getInputs', () => {
4848
image: 'docker.io/tonistiigi/binfmt:latest',
4949
platforms: 'arm64,riscv64,arm',
5050
cacheImage: true,
51-
} as context.Inputs
51+
}
5252
]
53-
])(
54-
'[%d] given %p as inputs, returns %p',
53+
];
54+
test.each(cases)(
55+
'[%d] given %o as inputs, returns %o',
5556
async (num: number, inputs: Map<string, string>, expected: context.Inputs) => {
5657
inputs.forEach((value: string, name: string) => {
5758
setInput(name, value);

__tests__/setup.unit.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import fs from 'node:fs';
2+
import os from 'node:os';
3+
import path from 'node:path';
4+
5+
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-setup-qemu-action-'));
6+
7+
process.env = Object.assign({}, process.env, {
8+
TEMP: tmpDir,
9+
GITHUB_REPOSITORY: 'docker/setup-qemu-action',
10+
RUNNER_TEMP: path.join(tmpDir, 'runner-temp'),
11+
RUNNER_TOOL_CACHE: path.join(tmpDir, 'runner-tool-cache')
12+
});

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ outputs:
2525
description: 'Available platforms (comma separated)'
2626

2727
runs:
28-
using: 'node20'
28+
using: 'node24'
2929
main: 'dist/index.js'
3030
post: 'dist/index.js'

dev.Dockerfile

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# syntax=docker/dockerfile:1
22

3-
ARG NODE_VERSION=20
3+
ARG NODE_VERSION=24
44

55
FROM node:${NODE_VERSION}-alpine AS base
6-
RUN apk add --no-cache cpio findutils git
6+
RUN apk add --no-cache cpio findutils git rsync
77
WORKDIR /src
88
RUN --mount=type=bind,target=.,rw \
99
--mount=type=cache,target=/src/.yarn/cache <<EOT
10+
set -e
1011
corepack enable
1112
yarn --version
1213
yarn config set --home enableTelemetry 0
@@ -34,18 +35,27 @@ RUN --mount=type=bind,target=.,rw <<EOT
3435
EOT
3536

3637
FROM deps AS build
37-
RUN --mount=type=bind,target=.,rw \
38+
RUN --mount=target=/context \
3839
--mount=type=cache,target=/src/.yarn/cache \
39-
--mount=type=cache,target=/src/node_modules \
40-
yarn run build && mkdir /out && cp -Rf dist /out/
40+
--mount=type=cache,target=/src/node_modules <<EOT
41+
set -e
42+
rsync -a /context/. .
43+
rm -rf dist
44+
yarn run build
45+
mkdir /out
46+
cp -r dist /out
47+
EOT
4148

4249
FROM scratch AS build-update
4350
COPY --from=build /out /
4451

4552
FROM build AS build-validate
46-
RUN --mount=type=bind,target=.,rw <<EOT
53+
RUN --mount=target=/context \
54+
--mount=target=.,type=tmpfs <<EOT
4755
set -e
56+
rsync -a /context/. .
4857
git add -A
58+
rm -rf dist
4959
cp -rf /out/* .
5060
if [ -n "$(git status --porcelain -- dist)" ]; then
5161
echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'
@@ -58,8 +68,7 @@ FROM deps AS format
5868
RUN --mount=type=bind,target=.,rw \
5969
--mount=type=cache,target=/src/.yarn/cache \
6070
--mount=type=cache,target=/src/node_modules \
61-
yarn run format \
62-
&& mkdir /out && find . -name '*.ts' -not -path './node_modules/*' -not -path './.yarn/*' | cpio -pdm /out
71+
yarn run format && mkdir /out && find . -name '*.ts' -not -path './node_modules/*' -not -path './.yarn/*' | cpio -pdm /out
6372

6473
FROM scratch AS format-update
6574
COPY --from=format /out /
@@ -74,7 +83,7 @@ FROM deps AS test
7483
RUN --mount=type=bind,target=.,rw \
7584
--mount=type=cache,target=/src/.yarn/cache \
7685
--mount=type=cache,target=/src/node_modules \
77-
yarn run test --coverage --coverageDirectory=/tmp/coverage
86+
yarn run test --coverage --coverage.reportsDirectory=/tmp/coverage
7887

7988
FROM scratch AS test-coverage
8089
COPY --from=test /tmp/coverage /

dist/index.js

Lines changed: 9 additions & 90 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)