Add GH actions

This commit is contained in:
pietervdvn 2021-04-10 14:25:06 +02:00
parent 244bbebb0b
commit 4e1fc46ff2
3 changed files with 55 additions and 44 deletions

View file

@ -9,5 +9,23 @@
"https://wens.be/free-antwerpenize-bicycle-font",
" https://antwerpenize.be/post/634396003556081664/antwerpenize-lettertype"
]
},
{
"authors": [],
"path": "car.svg",
"license": "CC0",
"sources": []
},
{
"authors": [],
"path": "logo.svg",
"license": "CC0; trivial",
"sources": []
},
{
"authors": [],
"path": "plug.svg",
"license": "CC0; trivial",
"sources": []
}
]

View file

@ -70,7 +70,7 @@ function validateLayer(layerJson: LayerConfigJson, context?: string): number {
errorCount++
}
}
} catch (e) {
console.error("Layer ", layerJson.id ?? JSON.stringify(layerJson).substring(0, 50), " is invalid: ", e)
return 1
@ -94,7 +94,7 @@ for (const themeFile of themeFiles) {
console.error("Unknown layer id: ", layer)
themeErrorCount++
}
}else if(layer.builtin === undefined){
} else if (layer.builtin === undefined) {
// layer.builtin contains layer overrides - we can skip those
layerErrorCount += validateLayer(layer, themeFile.id)
}
@ -104,7 +104,7 @@ for (const themeFile of themeFiles) {
try {
const theme = new LayoutConfig(themeFile, true, "test")
if(theme.id !== theme.id.toLowerCase()){
if (theme.id !== theme.id.toLowerCase()) {
console.error("Theme ids should be in lowercase, but it is ", theme.id)
}
} catch (e) {
@ -113,4 +113,9 @@ for (const themeFile of themeFiles) {
}
}
console.log("Found ", layerErrorCount, "errors in the layers; " + themeErrorCount + " errors in the themes")
if (layerErrorCount + themeErrorCount == 0) {
console.log("All good!")
} else {
const msg = (`Found ${layerErrorCount} errors in the layers; ${themeErrorCount} errors in the themes`)
throw msg;
}

View file

@ -127,25 +127,6 @@ function createLicenseInfoFor(path): void {
writeFileSync(path + ".license_info.json", JSON.stringify(li, null, " "))
}
function shuffle(array) {
var currentIndex = array.length, temporaryValue, randomIndex;
// While there remain elements to shuffle...
while (0 !== currentIndex) {
// Pick a remaining element...
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;
// And swap it with the current element.
temporaryValue = array[currentIndex];
array[currentIndex] = array[randomIndex];
array[randomIndex] = temporaryValue;
}
return array;
}
function cleanLicenseInfo(allPaths: string[], allLicenseInfos: SmallLicense[]){
// Read the license info file from the generated assets, creates a compiled license info in every directory
// Note: this removes all the old license infos
@ -172,6 +153,24 @@ function cleanLicenseInfo(allPaths: string[], allLicenseInfos: SmallLicense[]){
}
function queryMissingLicenses(missingLicenses: string[]) {
process.on('SIGINT', function () {
console.log("Aborting... Bye!");
process.exit();
});
let i = 1;
for (const missingLicens of missingLicenses) {
console.log(i + " / " + missingLicenses.length)
i++;
if (i < missingLicenses.length - 5) {
// continue
}
createLicenseInfoFor(missingLicens)
}
console.log("You're through!")
}
console.log("Checking and compiling license info")
const contents = ScriptUtils.readDirRecSync("./assets")
@ -183,27 +182,16 @@ writeFileSync("./assets/generated/license_info.json", JSON.stringify(licenseInfo
const artwork = contents.filter(pth => pth.match(/(.svg|.png|.jpg)$/i) != null)
const missingLicenses = missingLicenseInfos(licenseInfos, artwork)
console.log(`There are ${missingLicenses.length} licenses missing.`, missingLicenses)
cleanLicenseInfo(licensePaths, licenseInfos)
// shuffle(missingLicenses)
// cleanLicenseInfo(licensePaths, licenseInfos)
process.on('SIGINT', function () {
console.log("Aborting... Bye!");
process.exit();
});
let i = 1;
for (const missingLicens of missingLicenses) {
console.log(i + " / " + missingLicenses.length)
i++;
if (i < missingLicenses.length - 5) {
// continue
}
createLicenseInfoFor(missingLicens)
if(missingLicenses.length > 0){
const msg = `There are ${missingLicenses.length} licenses missing.`
/*
console.log(msg)
/*/
throw msg
//*/
}
console.log("You're through!")
// queryMissingLicenses(missingLicenses)