Skip to content

Commit 2dd6325

Browse files
authored
Merge pull request #48 from crazy-max/nits
fix some nits to be consistent across actions
2 parents 2fe291b + 5cff5dd commit 2dd6325

File tree

5 files changed

+29
-39
lines changed

5 files changed

+29
-39
lines changed

__tests__/context.test.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('getInputs', () => {
3232
});
3333

3434
// prettier-ignore
35-
test.each([
35+
const cases: [number, Map<string, string>, context.Inputs][] = [
3636
[
3737
0,
3838
new Map<string, string>([
@@ -41,7 +41,7 @@ describe('getInputs', () => {
4141
{
4242
version: '',
4343
cacheBinary: true,
44-
} as context.Inputs
44+
}
4545
],
4646
[
4747
1,
@@ -52,18 +52,16 @@ describe('getInputs', () => {
5252
{
5353
version: 'v2.32.4',
5454
cacheBinary: false
55-
} as context.Inputs
55+
}
5656
]
57-
])(
58-
'[%d] given %p as inputs, returns %p',
59-
async (num: number, inputs: Map<string, string>, expected: context.Inputs) => {
60-
inputs.forEach((value: string, name: string) => {
61-
setInput(name, value);
62-
});
63-
const res = await context.getInputs();
64-
expect(res).toEqual(expected);
65-
}
66-
);
57+
];
58+
test.each(cases)('[%d] given %o as inputs, returns %o', async (num: number, inputs: Map<string, string>, expected: context.Inputs) => {
59+
inputs.forEach((value: string, name: string) => {
60+
setInput(name, value);
61+
});
62+
const res = await context.getInputs();
63+
expect(res).toEqual(expected);
64+
});
6765
});
6866

6967
// See: https://github.com/actions/toolkit/blob/master/packages/core/src/core.ts#L67

__tests__/setup.unit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import fs from 'node:fs';
22
import os from 'node:os';
33
import path from 'node:path';
44

5-
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-actions-toolkit-'));
5+
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-setup-compose-action-'));
66

77
process.env = Object.assign({}, process.env, {
88
TEMP: tmpDir,

dev.Dockerfile

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
ARG NODE_VERSION=20
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 /

tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"module": "nodenext",
44
"moduleResolution": "nodenext",
55
"esModuleInterop": true,
6-
"strict": true,
76
"newLine": "lf",
87
"outDir": "./lib",
98
"rootDir": "./src",

vitest.config.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
1-
/**
2-
* Copyright 2026 actions-toolkit authors
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
171
import {defineConfig} from 'vitest/config';
182

193
export default defineConfig({
@@ -26,7 +10,7 @@ export default defineConfig({
2610
provider: 'v8',
2711
reporter: ['clover'],
2812
include: ['src/**/*.ts'],
29-
exclude: ['src/**/main.ts', '__tests__/**', 'dist/**']
13+
exclude: ['src/**/main.ts']
3014
}
3115
}
3216
});

0 commit comments

Comments
 (0)