-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* YAML validator * Fix error in platforms schema * Delete github action * Validate yaml files using superstruct lib * Fix typo
- Loading branch information
1 parent
0c49736
commit e9c8727
Showing
5 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
deployments: | ||
required: true | ||
type: list | ||
schema: | ||
type: dict | ||
schema: | ||
name: | ||
required: true | ||
type: string | ||
platforms: | ||
required: true | ||
type: list | ||
schema: | ||
type: dict | ||
schema: | ||
name: | ||
required: true | ||
type: string | ||
tsv_format: | ||
require: false | ||
type: boolean | ||
rename_as_ict: | ||
require: false | ||
type: boolean | ||
process_as_ict: | ||
require: false | ||
type: boolean | ||
coords_divisor: | ||
require: false | ||
type: integer | ||
files: | ||
required: true | ||
type: list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const { | ||
array, | ||
assert, | ||
boolean, | ||
number, | ||
object, | ||
optional, | ||
string, | ||
} = require('superstruct'); | ||
const { readCampaignYaml } = require('../src/utils'); | ||
|
||
const structure = array( | ||
object({ | ||
name: string(), | ||
platforms: array( | ||
object({ | ||
name: string(), | ||
tsv_format: optional(boolean()), | ||
rename_as_ict: optional(boolean()), | ||
process_as_ict: optional(boolean()), | ||
coords_divisor: optional(number()), | ||
files: array(string()), | ||
}) | ||
), | ||
}) | ||
); | ||
|
||
test('YAML files should be valid', () => { | ||
const campaigns = fs.readdirSync('../campaigns/'); | ||
campaigns | ||
.filter((c) => fs.existsSync(path.join('../campaigns/', c, 'deployments.yaml'))) | ||
.forEach((c) => { | ||
console.log(`Checking: ${c}`); | ||
assert(readCampaignYaml(path.join('../campaigns/', c)), structure); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters