diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index 018be4422..442c840f1 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -1,10 +1,11 @@ -name: Validate JSON schema +name: Generate JSON Schema on: pull_request: jobs: validate: + name: Compare generated against provided runs-on: ubuntu-latest timeout-minutes: 10 steps: @@ -19,3 +20,11 @@ jobs: run: | cd generate npm run generate + - name: Upload generated schemas + if: always() + uses: actions/upload-artifact@v3 + with: + name: schemas + path: | + generate/generated/*.json + diff --git a/.github/workflows/markdown-link-check.yml b/.github/workflows/markdown-link-check.yml index 35697713c..520861266 100644 --- a/.github/workflows/markdown-link-check.yml +++ b/.github/workflows/markdown-link-check.yml @@ -1,4 +1,4 @@ -name: Check Markdown links +name: Check Markdown Links on: pull_request: @@ -7,7 +7,8 @@ permissions: contents: read jobs: - markdown-link-check: + check-links: + name: Check links runs-on: ubuntu-latest timeout-minutes: 10 steps: diff --git a/.github/workflows/py-validation.yml b/.github/workflows/py-validation.yml index 8558635c8..26b2f2547 100644 --- a/.github/workflows/py-validation.yml +++ b/.github/workflows/py-validation.yml @@ -1,4 +1,4 @@ -name: Validate JSON examples +name: Validate JSON Examples on: pull_request: @@ -9,7 +9,7 @@ permissions: jobs: build: # Name the Job - name: Validate JSON examples against their schema + name: Validate examples against schema runs-on: ubuntu-latest diff --git a/generate/aff.mjs b/generate/aff.mjs index 0ee034fb9..acb5d0df6 100644 --- a/generate/aff.mjs +++ b/generate/aff.mjs @@ -1,47 +1,70 @@ import * as fs from 'node:fs'; import * as path from 'node:path'; import * as child_process from 'node:child_process'; -import {initializeABAP} from "./output/init.mjs"; +import { initializeABAP } from "./output/init.mjs"; await initializeABAP(); +import * as core from '@actions/core'; async function run() { if (fs.existsSync("generated") === false) { fs.mkdirSync("generated"); } + function createAnnotations(diff, file) { + let lines = diff.split('\n'); + + let lineNumber; + const regExp = /^[0-9]/; + + lines.forEach(line => { + + if (line.startsWith('>')) { + let text = line.split(' ').slice(1).join(' '); + console.log(`::error file=${file},line=${lineNumber}::${text}`); + ++lineNumber; + } else if (regExp.test(line)) { + lineNumber = parseInt(line.split("c")[0].split(",")[0]); // 16 + } + }); + + } + + const types = []; for (const f of fs.readdirSync("../file-formats/")) { if (f.length === 4) { types.push(f.toUpperCase()); } } + types.sort(); + let error = false; for (const type of types) { - console.log(type); if (type === "ENHO") { - console.log("\tskip, https://github.com/SAP/abap-file-formats/issues/409"); + core.notice(type + " skipped, https://github.com/SAP/abap-file-formats/issues/409"); continue; } - const result = await abap.Classes["CL_RUN"].run({object_type: new abap.types.String().set(type)}); + const result = await abap.Classes["CL_RUN"].run({ object_type: new abap.types.String().set(type) }); const filename = "generated" + path.sep + type.toLowerCase() + "-v1.json"; + const filename_aff = `../file-formats/${type.toLowerCase()}/${type.toLowerCase()}-v1.json`; fs.writeFileSync(filename, result.get()); - const command = `diff --strip-trailing-cr generated/${type.toLowerCase()}-v1.json ../file-formats/${type.toLowerCase()}/${type.toLowerCase()}-v1.json`; + + const command = `diff ${filename_aff} ${filename}`; const output = child_process.execSync(`${command} || true`); if (output.toString().length > 0) { - console.log(command); - console.log(output.toString()); - error = true; + core.setFailed(type + ": Provided and generated JSON Schema differ") + createAnnotations(output.toString(), path.resolve(filename_aff)); + //core.info(command); + //core.info(output.toString()); } else { - console.log("\tOK\n"); + core.notice(type + " success"); } - } - if (error === true) { - exit(1); } + } run(); diff --git a/generate/package-lock.json b/generate/package-lock.json index 79a241ea7..a02ee0881 100644 --- a/generate/package-lock.json +++ b/generate/package-lock.json @@ -1,7 +1,7 @@ { "name": "abap-file-formats", "version": "0.0.0", - "lockfileVersion": 2, + "lockfileVersion": 3, "requires": true, "packages": { "": { @@ -12,21 +12,22 @@ "@abaplint/database-sqlite": "^2.7.96", "@abaplint/runtime": "^2.7.100", "@abaplint/transpiler-cli": "^2.7.100", + "@actions/core": "^1.10.1", "oras-pull": "^0.1.5" } }, "node_modules/@abaplint/database-sqlite": { - "version": "2.7.96", - "resolved": "https://registry.npmjs.org/@abaplint/database-sqlite/-/database-sqlite-2.7.96.tgz", - "integrity": "sha512-xU1tIdTMvpOvzd9CGTm11d17n3nHiapSNxyxNDiWZBrDuF8oOxuQWbbKkekobsHeNw0ZITdb+fGTMC8k5pYigQ==", + "version": "2.7.119", + "resolved": "https://registry.npmjs.org/@abaplint/database-sqlite/-/database-sqlite-2.7.119.tgz", + "integrity": "sha512-WAXKQaVk+ehJnuQw7kpPEAHnfmtosyW5cU8l46ylitb04DyVmMPlZ8SBJTOygPByvFyKnDUupu7fiLENocNy+A==", "dependencies": { "sql.js": "^1.8.0" } }, "node_modules/@abaplint/runtime": { - "version": "2.7.100", - "resolved": "https://registry.npmjs.org/@abaplint/runtime/-/runtime-2.7.100.tgz", - "integrity": "sha512-IN/tM2e0cPNxBToKYTaCqT/Xh8/eZaSWtZPEh7GE8DYmcPqzI8/8CNKpaZjIwpmVzKhwbkXjoEuq/DB7bUKmHA==", + "version": "2.7.136", + "resolved": "https://registry.npmjs.org/@abaplint/runtime/-/runtime-2.7.136.tgz", + "integrity": "sha512-w8//A4ee3/zrqGft3Mckr7KyqtwMOdIPobfoCEzqTpL2wziGlgtp9GHoMZX1e/x3EtbiLWwxfJCGHvERag59ig==", "dependencies": { "temporal-polyfill": "^0.1.1" }, @@ -35,9 +36,9 @@ } }, "node_modules/@abaplint/transpiler-cli": { - "version": "2.7.100", - "resolved": "https://registry.npmjs.org/@abaplint/transpiler-cli/-/transpiler-cli-2.7.100.tgz", - "integrity": "sha512-hZzQZ/HkXS/z8Y06nbMdrNVfFM6KSdnqHetGwhcdNHZCrK3AThdBNLSkupkcZpCoEhrizBbtqYu6Jvc8vWlRsA==", + "version": "2.7.136", + "resolved": "https://registry.npmjs.org/@abaplint/transpiler-cli/-/transpiler-cli-2.7.136.tgz", + "integrity": "sha512-baVz9h7zij90+T5fxCN3aHVxQh0Up2+ICybTakleZLDSMgRzkpq8LQ+lmNRK44suAadrc74WDvWJ7OODlcJnyA==", "bin": { "abap_transpile": "abap_transpile" }, @@ -45,6 +46,32 @@ "url": "https://github.com/sponsors/larshp" } }, + "node_modules/@actions/core": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.1.tgz", + "integrity": "sha512-3lBR9EDAY+iYIpTnTIXmWcNbX3T2kCkAEQGIQx4NVQ0575nk2k3GRZDTPQG+vVtS2izSLmINlxXf0uLtnrTP+g==", + "dependencies": { + "@actions/http-client": "^2.0.1", + "uuid": "^8.3.2" + } + }, + "node_modules/@actions/http-client": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.0.tgz", + "integrity": "sha512-q+epW0trjVUUHboliPb4UF9g2msf+w61b32tAkFEwL/IwP0DQWgbCMM0Hbe3e3WXSKz5VcUXbzJQgy8Hkra/Lg==", + "dependencies": { + "tunnel": "^0.0.6", + "undici": "^5.25.4" + } + }, + "node_modules/@fastify/busboy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.0.tgz", + "integrity": "sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA==", + "engines": { + "node": ">=14" + } + }, "node_modules/chownr": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", @@ -157,9 +184,9 @@ } }, "node_modules/sql.js": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/sql.js/-/sql.js-1.8.0.tgz", - "integrity": "sha512-3HD8pSkZL+5YvYUI8nlvNILs61ALqq34xgmF+BHpqxe68yZIJ1H+sIVIODvni25+CcxHUxDyrTJUL0lE/m7afw==" + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/sql.js/-/sql.js-1.9.0.tgz", + "integrity": "sha512-+QMN8NU5KJxofT+lEaSLYdhh+Pdq7ZYS6X5bSbpmD+4SKFf+qBmr+coKT07LZ+keUNh1sf3Nz9dQwD8WNI2i/Q==" }, "node_modules/tar": { "version": "6.2.0", @@ -195,176 +222,48 @@ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" }, - "node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" - }, - "node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, - "node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" - } - }, - "dependencies": { - "@abaplint/database-sqlite": { - "version": "2.7.96", - "resolved": "https://registry.npmjs.org/@abaplint/database-sqlite/-/database-sqlite-2.7.96.tgz", - "integrity": "sha512-xU1tIdTMvpOvzd9CGTm11d17n3nHiapSNxyxNDiWZBrDuF8oOxuQWbbKkekobsHeNw0ZITdb+fGTMC8k5pYigQ==", - "requires": { - "sql.js": "^1.8.0" - } - }, - "@abaplint/runtime": { - "version": "2.7.100", - "resolved": "https://registry.npmjs.org/@abaplint/runtime/-/runtime-2.7.100.tgz", - "integrity": "sha512-IN/tM2e0cPNxBToKYTaCqT/Xh8/eZaSWtZPEh7GE8DYmcPqzI8/8CNKpaZjIwpmVzKhwbkXjoEuq/DB7bUKmHA==", - "requires": { - "temporal-polyfill": "^0.1.1" - } - }, - "@abaplint/transpiler-cli": { - "version": "2.7.100", - "resolved": "https://registry.npmjs.org/@abaplint/transpiler-cli/-/transpiler-cli-2.7.100.tgz", - "integrity": "sha512-hZzQZ/HkXS/z8Y06nbMdrNVfFM6KSdnqHetGwhcdNHZCrK3AThdBNLSkupkcZpCoEhrizBbtqYu6Jvc8vWlRsA==" - }, - "chownr": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", - "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==" - }, - "cross-fetch": { - "version": "3.1.8", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.8.tgz", - "integrity": "sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==", - "requires": { - "node-fetch": "^2.6.12" + "node_modules/tunnel": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", + "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", + "engines": { + "node": ">=0.6.11 <=0.7.0 || >=0.7.3" } }, - "fs-minipass": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", - "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", - "requires": { - "minipass": "^3.0.0" - }, + "node_modules/undici": { + "version": "5.28.2", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.2.tgz", + "integrity": "sha512-wh1pHJHnUeQV5Xa8/kyQhO7WFa8M34l026L5P/+2TYiakvGy5Rdc8jWZVyG7ieht/0WgJLEd3kcU5gKx+6GC8w==", "dependencies": { - "minipass": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", - "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", - "requires": { - "yallist": "^4.0.0" - } - } - } - }, - "minipass": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", - "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==" - }, - "minizlib": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", - "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", - "requires": { - "minipass": "^3.0.0", - "yallist": "^4.0.0" + "@fastify/busboy": "^2.0.0" }, - "dependencies": { - "minipass": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", - "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", - "requires": { - "yallist": "^4.0.0" - } - } - } - }, - "mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==" - }, - "node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "requires": { - "whatwg-url": "^5.0.0" - } - }, - "oras-pull": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/oras-pull/-/oras-pull-0.1.5.tgz", - "integrity": "sha512-0PyOnupaG7OSQvC591GRSrA0cUEcWUZ7eahDBEMSpOPpHuikwD5gG51RhCb+uwOyvfDo+8DteyvseCzRijV5+A==", - "requires": { - "cross-fetch": "^3.1.5", - "tar": "^6.1.13" - } - }, - "sql.js": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/sql.js/-/sql.js-1.8.0.tgz", - "integrity": "sha512-3HD8pSkZL+5YvYUI8nlvNILs61ALqq34xgmF+BHpqxe68yZIJ1H+sIVIODvni25+CcxHUxDyrTJUL0lE/m7afw==" - }, - "tar": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.0.tgz", - "integrity": "sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==", - "requires": { - "chownr": "^2.0.0", - "fs-minipass": "^2.0.0", - "minipass": "^5.0.0", - "minizlib": "^2.1.1", - "mkdirp": "^1.0.3", - "yallist": "^4.0.0" + "engines": { + "node": ">=14.0" } }, - "temporal-polyfill": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/temporal-polyfill/-/temporal-polyfill-0.1.1.tgz", - "integrity": "sha512-/5e4EVRA0wBI/bEhWLirSjwUg1lELhQyTXxw9zNbVhqjKvI9BLczs+3wtsoD9sn3HN2ImAMW5XJQwAiXgWT+GA==", - "requires": { - "temporal-spec": "~0.1.0" + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "bin": { + "uuid": "dist/bin/uuid" } }, - "temporal-spec": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/temporal-spec/-/temporal-spec-0.1.0.tgz", - "integrity": "sha512-sMNggMeS6trCgMQuudgFHhX1gtBK3e+AT1zGrMsFYG1wlqtRT5E9rcvm3I1iNlvHpJX/3DO6L4qtWAuEl/T04Q==" - }, - "tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" - }, - "webidl-conversions": { + "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" }, - "whatwg-url": { + "node_modules/whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "requires": { + "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" } }, - "yallist": { + "node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" diff --git a/generate/package.json b/generate/package.json index 963c26190..9dbd611c5 100644 --- a/generate/package.json +++ b/generate/package.json @@ -25,6 +25,7 @@ "@abaplint/database-sqlite": "^2.7.96", "@abaplint/runtime": "^2.7.100", "@abaplint/transpiler-cli": "^2.7.100", + "@actions/core": "^1.10.1", "oras-pull": "^0.1.5" } }