Skip to content

ci: Add CI check for Parse Server options definitions #7955

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 27 commits into from
Dec 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
847f156
chore(release): 5.2.1-alpha.1 [skip ci]
semantic-release-bot Mar 26, 2022
8987627
feat: add definitions CI check
dblythy Apr 28, 2022
84dd8a3
type
dblythy Apr 28, 2022
dc882f4
Update checkDefinitions.js
dblythy Apr 28, 2022
d413d6d
Update ci.yml
dblythy Apr 28, 2022
7a7b8d9
Update checkDefinitions.js
dblythy Apr 28, 2022
6b09c20
Update checkDefinitions.js
dblythy Apr 28, 2022
6da828a
Update checkDefinitions.js
dblythy Apr 28, 2022
131f350
Merge branch 'definitions-ci-check' of https://github.com/dblythy/par…
dblythy May 5, 2022
23d5cf4
Merge branch 'definitions-ci-check' of https://github.com/dblythy/par…
dblythy May 5, 2022
825c5fa
Merge branch 'definitions-ci-check' of https://github.com/dblythy/par…
dblythy May 5, 2022
616e3a4
update
dblythy May 5, 2022
d86ec46
check src
dblythy May 5, 2022
9496e2d
fix
dblythy May 5, 2022
23d3b6a
Merge branch 'alpha' into definitions-ci-check
mtrezza Jun 10, 2022
98cfa34
Merge branch 'alpha' into definitions-ci-check
dblythy Dec 16, 2022
1412ac8
Update ci.yml
dblythy Dec 16, 2022
5efe65e
Update definitionsCheck.js
dblythy Dec 16, 2022
c79ce0d
Update definitionsCheck.js
dblythy Dec 16, 2022
bac45d4
Update definitionsCheck.js
dblythy Dec 16, 2022
2c98de8
Update definitionsCheck.js
dblythy Dec 16, 2022
a853807
add ci check
dblythy Dec 16, 2022
cc48359
Update package.json
dblythy Dec 16, 2022
fb877c8
add abort
dblythy Dec 16, 2022
fd1e1e5
Update Definitions.js
dblythy Dec 16, 2022
2902fe0
Update definitionsCheck.js
dblythy Dec 16, 2022
d4e3ae6
Merge branch 'alpha' into definitions-ci-check
dblythy Dec 16, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,27 @@ jobs:
- name: Install dependencies
run: npm ci
- run: npm run lint
check-definitions:
name: Check Definitions
timeout-minutes: 5
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.NODE_VERSION }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ matrix.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.NODE_VERSION }}-
- name: Install dependencies
run: npm ci
- name: CI Definitions Check
run: npm run ci:definitionsCheck
check-circular:
name: Circular Dependencies
timeout-minutes: 5
Expand Down
39 changes: 39 additions & 0 deletions ci/definitionsCheck.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const fs = require('fs').promises;
const { exec } = require('child_process');
const core = require('@actions/core');
const { nextTick } = require('process');
const { AbortController } = require("node-abort-controller");
(async () => {
const [currentDefinitions, currentDocs] = await Promise.all([
fs.readFile('./src/Options/Definitions.js', 'utf8'),
fs.readFile('./src/Options/docs.js', 'utf8'),
]);
exec('npm run definitions');
const ac = new AbortController();
const { signal } = ac;
const watcher = fs.watch('./src/Options/docs.js', {signal});
let i = 0;
// eslint-disable-next-line
for await (const _ of watcher) {
i++;
if (i === 3) {
ac.abort();
break;
}
}
await new Promise(resolve => nextTick(resolve));
const [newDefinitions, newDocs] = await Promise.all([
fs.readFile('./src/Options/Definitions.js', 'utf8'),
fs.readFile('./src/Options/docs.js', 'utf8'),
]);
if (currentDefinitions !== newDefinitions || currentDocs !== newDocs) {
console.error(
'\x1b[31m%s\x1b[0m',
'Definitions files cannot be updated manually. Please update src/Options/index.js then run `npm run definitions` to generate definitions.'
);
core.error('Definitions files cannot be updated manually. Please update src/Options/index.js then run `npm run definitions` to generate definitions.');
process.exit(1);
} else {
process.exit(0);
}
})();
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
"mongodb-runner": "4.8.1",
"mongodb-version-list": "1.0.0",
"node-fetch": "3.2.10",
"node-abort-controller": "3.0.1",
"nyc": "15.1.0",
"prettier": "2.0.5",
"semantic-release": "17.4.6",
Expand All @@ -107,6 +108,7 @@
"scripts": {
"ci:check": "node ./ci/ciCheck.js",
"ci:checkNodeEngine": "node ./ci/nodeEngineCheck.js",
"ci:definitionsCheck": "node ./ci/definitionsCheck.js",
"definitions": "node ./resources/buildConfigDefinitions.js && prettier --write 'src/Options/*.js'",
"docs": "jsdoc -c ./jsdoc-conf.json",
"lint": "flow && eslint --cache ./",
Expand Down