Skip to content

Commit 1c105ae

Browse files
authored
update dev dependencies and workflow (#160)
Co-authored-by: CrazyMax <[email protected]>
1 parent a4fcb50 commit 1c105ae

17 files changed

+2945
-18734
lines changed

.eslintrc.json

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"env": {
3+
"node": true,
4+
"es2021": true,
5+
"jest/globals": true
6+
},
7+
"extends": [
8+
"eslint:recommended",
9+
"plugin:@typescript-eslint/recommended",
10+
"plugin:jest/recommended",
11+
"plugin:prettier/recommended"
12+
],
13+
"parser": "@typescript-eslint/parser",
14+
"parserOptions": {
15+
"ecmaVersion": "latest",
16+
"sourceType": "module"
17+
},
18+
"plugins": [
19+
"@typescript-eslint",
20+
"jest",
21+
"prettier"
22+
]
23+
}

__tests__/context.test.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,34 @@
1+
import {describe, expect, it} from '@jest/globals';
12
import * as context from '../src/context';
23

34
describe('getInputList', () => {
45
it('handles single line correctly', async () => {
56
await setInput('foo', 'bar');
67
const res = await context.getInputList('foo');
7-
console.log(res);
88
expect(res).toEqual(['bar']);
99
});
1010

1111
it('handles multiple lines correctly', async () => {
1212
setInput('foo', 'bar\nbaz');
1313
const res = await context.getInputList('foo');
14-
console.log(res);
1514
expect(res).toEqual(['bar', 'baz']);
1615
});
1716

1817
it('handles comma correctly', async () => {
1918
setInput('foo', 'bar,baz');
2019
const res = await context.getInputList('foo');
21-
console.log(res);
2220
expect(res).toEqual(['bar', 'baz']);
2321
});
2422

2523
it('handles different new lines correctly', async () => {
2624
setInput('foo', 'bar\r\nbaz');
2725
const res = await context.getInputList('foo');
28-
console.log(res);
2926
expect(res).toEqual(['bar', 'baz']);
3027
});
3128

3229
it('handles different new lines and comma correctly', async () => {
3330
setInput('foo', 'bar\r\nbaz,bat');
3431
const res = await context.getInputList('foo');
35-
console.log(res);
3632
expect(res).toEqual(['bar', 'baz', 'bat']);
3733
});
3834
});

__tests__/labeler.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {describe, expect, test} from '@jest/globals';
12
import {Inputs} from '../src/context';
23
import {Labeler, LabelStatus} from '../src/labeler';
34

codecov.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
comment: false
2+
github_checks:
3+
annotations: false

dev.Dockerfile

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# syntax=docker/dockerfile:1
2+
3+
ARG NODE_VERSION=12
4+
5+
FROM node:${NODE_VERSION}-alpine AS base
6+
RUN apk add --no-cache cpio findutils git
7+
WORKDIR /src
8+
9+
FROM base AS deps
10+
RUN --mount=type=bind,target=.,rw \
11+
--mount=type=cache,target=/src/node_modules \
12+
yarn install && mkdir /vendor && cp yarn.lock /vendor
13+
14+
FROM scratch AS vendor-update
15+
COPY --from=deps /vendor /
16+
17+
FROM deps AS vendor-validate
18+
RUN --mount=type=bind,target=.,rw <<EOT
19+
set -e
20+
git add -A
21+
cp -rf /vendor/* .
22+
if [ -n "$(git status --porcelain -- yarn.lock)" ]; then
23+
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor-update"'
24+
git status --porcelain -- yarn.lock
25+
exit 1
26+
fi
27+
EOT
28+
29+
FROM deps AS build
30+
RUN --mount=type=bind,target=.,rw \
31+
--mount=type=cache,target=/src/node_modules \
32+
yarn run build && mkdir /out && cp -Rf dist /out/
33+
34+
FROM scratch AS build-update
35+
COPY --from=build /out /
36+
37+
FROM build AS build-validate
38+
RUN --mount=type=bind,target=.,rw <<EOT
39+
set -e
40+
git add -A
41+
cp -rf /out/* .
42+
if [ -n "$(git status --porcelain -- dist)" ]; then
43+
echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'
44+
git status --porcelain -- dist
45+
exit 1
46+
fi
47+
EOT
48+
49+
FROM deps AS format
50+
RUN --mount=type=bind,target=.,rw \
51+
--mount=type=cache,target=/src/node_modules \
52+
yarn run format \
53+
&& mkdir /out && find . -name '*.ts' -not -path './node_modules/*' | cpio -pdm /out
54+
55+
FROM scratch AS format-update
56+
COPY --from=format /out /
57+
58+
FROM deps AS lint
59+
RUN --mount=type=bind,target=.,rw \
60+
--mount=type=cache,target=/src/node_modules \
61+
yarn run lint
62+
63+
FROM deps AS test
64+
ENV RUNNER_TEMP=/tmp/github_runner
65+
ENV RUNNER_TOOL_CACHE=/tmp/github_tool_cache
66+
ARG GITHUB_REPOSITORY
67+
RUN --mount=type=bind,target=.,rw \
68+
--mount=type=cache,target=/src/node_modules \
69+
--mount=type=secret,id=GITHUB_TOKEN \
70+
GITHUB_TOKEN=$(cat /run/secrets/GITHUB_TOKEN) yarn run test --coverageDirectory=/tmp/coverage
71+
72+
FROM scratch AS test-coverage
73+
COPY --from=test /tmp/coverage /

0 commit comments

Comments
 (0)