Skip to content

Commit e71df4a

Browse files
authored
ci(build): set file encoding to utf-8 for logging #1
ci(build): set file encoding to utf-8 for logging
2 parents 8024a0f + 4d8e843 commit e71df4a

6 files changed

Lines changed: 115 additions & 118 deletions

File tree

.github/workflows/glibc_smoke_test.yml

Lines changed: 0 additions & 118 deletions
This file was deleted.

ci/run_oss_tests.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ steps:
66
mavenPOMFile: "questdb/pom.xml"
77
jdkVersionOption: "default"
88
goals: "test"
9+
mavenOptions: "-Xlog:gc -Dfile.encoding=UTF-8 -Xmx3072m -XX:+UseParallelGC"
910
options: "--batch-mode --quiet
1011
-Dtest.include=**/cutlass/http/line/*,**/cutlass/line/**/*
1112
-DfailIfNoTests=false

ci/validate-pr-title/dangerfile.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
const { danger, fail } = require("danger");
2+
const { validate } = require("./validate");
3+
4+
validate({ title: danger.github.pr.title, onError: fail });

ci/validate-pr-title/readme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
This folder contains configuration files which are used to run validation rules on Github pull requests titles.
2+
3+
It is done by running [Danger JS](https://danger.systems/js/) tool in [github action](../../.github/workflows/danger.yml).
4+
5+
In addition, the validation rules are tested. Tests can be executed with node, by running `node ./validate.test.js`

ci/validate-pr-title/validate.js

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
const allowedTypes = [
2+
"feat",
3+
"fix",
4+
"chore",
5+
"docs",
6+
"style",
7+
"refactor",
8+
"perf",
9+
"test",
10+
"ci",
11+
"revert",
12+
];
13+
14+
const allowedSubTypes = [
15+
"build",
16+
"log",
17+
"core",
18+
"ilp",
19+
"http",
20+
"conf",
21+
"utils",
22+
];
23+
24+
const errorMessage = `
25+
Please update the PR title to match this format:
26+
\`type(subType): description\`
27+
28+
Where \`type\` is one of:
29+
${allowedTypes.map((t) => `\`${t}\``).join(", ")}
30+
31+
And: \`subType\` is one of:
32+
${allowedSubTypes.map((t) => `\`${t}\``).join(", ")}
33+
34+
For Example:
35+
36+
\`\`\`
37+
perf(sql): improve pattern matching performance for SELECT sub-queries
38+
\`\`\`
39+
`.trim();
40+
41+
/* The basic valid PR title formats are:
42+
* 1. allowedType(allowedSubtype): optional description
43+
* 2. allowedType: optional description
44+
*
45+
* consult ./validate.test.js for a full list
46+
* */
47+
const prTitleRegex = new RegExp(
48+
`^(((?:${allowedTypes.join("|")})\\((?:${allowedSubTypes.join(
49+
"|",
50+
)})\\))|build): .*`,
51+
);
52+
53+
function validate({ title, onError }) {
54+
// Early return for title that matches predefined regex.
55+
// No action required in such case.
56+
if (title.match(prTitleRegex)) {
57+
return;
58+
}
59+
60+
onError(errorMessage);
61+
}
62+
63+
module.exports = {
64+
allowedTypes,
65+
allowedSubTypes,
66+
validate,
67+
};
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
const assert = require("node:assert").strict;
2+
const { validate, allowedTypes, allowedSubTypes } = require("./validate");
3+
4+
const testValid = (title) =>
5+
assert.doesNotThrow(() =>
6+
validate({
7+
title,
8+
onError: () => {
9+
throw `should accept "${title}"`;
10+
},
11+
})
12+
);
13+
14+
const testInvalid = (title) =>
15+
assert.throws(
16+
() => validate({ title, onError }),
17+
`should NOT accept "${title}"`
18+
);
19+
20+
allowedTypes.forEach((type) => {
21+
allowedSubTypes.forEach((subType) => {
22+
testValid(
23+
`${type}(${subType}): foo`,
24+
`should accept "${type}(${subType}): foo"`
25+
);
26+
});
27+
});
28+
29+
testValid("build: 6.6");
30+
testValid("build: hello world");
31+
testInvalid("build");
32+
33+
testValid(`build: house`);
34+
testInvalid(`build(house)`);
35+
36+
testInvalid(`foo: bar`);
37+
testInvalid(`update(bar): baz`);
38+
testInvalid(`ui: updating stuff`);

0 commit comments

Comments
 (0)