-
Notifications
You must be signed in to change notification settings - Fork 44
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
Update framework metadata information. #21
Open
parfeon
wants to merge
2
commits into
master
Choose a base branch
from
docs/SDK-687/add-pubnub-yml-and-validator-action
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: validate-pubnub-yml | ||
|
||
# Controls when the action will run. Workflow runs when manually triggered using the UI | ||
# or API. | ||
on: [push] | ||
|
||
jobs: | ||
build: | ||
name: Validate PubNub yml | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: '12.x' | ||
- name: Install dependencies | ||
run: | | ||
npm install [email protected] | ||
npm install [email protected] | ||
npm install [email protected] | ||
npm install [email protected] | ||
- name: Validate | ||
run: GITHUB_TOKEN=${{ secrets.GH_TOKEN }} node ./.github/workflows/validate-yml.js |
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,94 @@ | ||
const YAML = require('yaml') | ||
const Ajv = require('ajv'); | ||
const fetch = require('node-fetch'); | ||
const fs = require('fs'); | ||
const chalk = require('chalk'); | ||
|
||
const ghToken = process.env.GITHUB_TOKEN; | ||
const ghHeaders = {'User-Agent': 'sdk-bot', 'Authorization': 'token ' + ghToken,'Accept': 'application/vnd.github.v3.raw'}; | ||
|
||
const sdkReposJSONBranch = "develop"; | ||
let sdkReposJSONPath = "http://api.github.com/repos/pubnub/documentation-resources/contents/website-common/tools/build/sdk-repos.json?ref=" + sdkReposJSONBranch; | ||
startExecution(sdkReposJSONPath); | ||
|
||
async function startExecution(sdkReposJSONPath){ | ||
var sdkRepos = await requestGetFromGithub(sdkReposJSONPath); | ||
var sdkReposAndFeatureMappingArray = parseReposAndFeatureMapping(sdkRepos); | ||
var schemaText = await requestGetFromGithub(sdkReposAndFeatureMappingArray[2]); | ||
|
||
schema = JSON.parse(schemaText); | ||
var yaml = fs.readFileSync(".pubnub.yml", 'utf8'); | ||
|
||
if(yaml != null){ | ||
yml = YAML.parse(yaml); | ||
var ajv = new Ajv({schemaId: 'id', "verbose":true, "allErrors": true}); | ||
const validate = ajv.compile(schema); | ||
const valid = validate(yml); | ||
if (validate.errors!= null) { | ||
console.log(chalk.cyan("===================================")); | ||
console.log(chalk.red(yml["version"] + " validation errors...")); | ||
console.log(chalk.cyan("===================================")); | ||
console.log(validate.errors); | ||
console.log(chalk.cyan("===================================")); | ||
var result = {code:1, repo: yml["version"], msg: "validation errors"}; | ||
printResult(result); | ||
process.exit(1); | ||
} | ||
else { | ||
var result = {code: 0, repo: yml["version"], msg: "validation pass"}; | ||
printResult(result); | ||
} | ||
} else { | ||
var result = {code:1, repo: "yml null", msg: "validation errors"}; | ||
printResult(result); | ||
process.exit(1); | ||
} | ||
} | ||
|
||
function printResult(result){ | ||
var str = result.repo + ", " + result.msg; | ||
if(result.code === 0){ | ||
console.log(chalk.green(str) + ", Code: " + result.code); | ||
} else { | ||
console.log(chalk.red(str) + ", Code: " + result.code); | ||
} | ||
} | ||
|
||
async function requestGetFromGithub(url){ | ||
try { | ||
const response = await fetch(url, { | ||
headers: ghHeaders, | ||
method: 'get', | ||
}); | ||
if(response.status == 200){ | ||
const json = await response.text(); | ||
return json; | ||
} else { | ||
console.error(chalk.red("res.status: " + response.status + "\n URL: " + url)); | ||
return null; | ||
} | ||
|
||
} catch (error) { | ||
console.error(chalk.red("requestGetFromGithub: " + error + "\n URL: " + url)); | ||
return null; | ||
} | ||
} | ||
|
||
function parseReposAndFeatureMapping(body){ | ||
if(body != null){ | ||
var sdkRepos = JSON.parse(body); | ||
var locations = sdkRepos["locations"]; | ||
if(locations!=null){ | ||
var sdkURLs = locations["sdks"]; | ||
var featureMappingURL = locations["featureMapping"]; | ||
var pubnubYAMLSchemaURL = locations["pubnubYAMLSchema"]; | ||
return [sdkURLs, featureMappingURL, pubnubYAMLSchemaURL]; | ||
} else { | ||
console.log(chalk.red("response locations null")); | ||
return null; | ||
} | ||
} else { | ||
console.log(chalk.red("response body null")); | ||
return null; | ||
} | ||
} |
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,151 @@ | ||
--- | ||
name: eon-chart | ||
scm: https://github.com/pubnub/eon-chart | ||
version: "1.3.1" | ||
schema: 1 | ||
files: | ||
- ./eon-chart.js | ||
changelog: | ||
- version: 1.3.1 | ||
date: 2017-07-29 | ||
changes: | ||
- type: improvement | ||
text: "Export `c3` as `window.c3`." | ||
- version: 1.3.0 | ||
date: 2017-07-20 | ||
changes: | ||
- type: feat | ||
text: "Add `category` option for `xType`." | ||
- version: 1.2.7 | ||
date: 2017-07-07 | ||
changes: | ||
- type: improvement | ||
text: "Remove package info from bower" | ||
- type: bug | ||
text: "Fix Webpack export." | ||
- version: 1.2.2 | ||
date: 2017-07-07 | ||
changes: | ||
- type: improvement | ||
text: "Update Webpack export for globals" | ||
- version: 1.2.0 | ||
date: 2017-07-07 | ||
changes: | ||
- type: improvement | ||
text: "Move from Bower builds to Webpack" | ||
- version: 1.1.0 | ||
date: 2016-11-17 | ||
changes: | ||
- type: bug | ||
text: "Fix console errors upon losing page visibility." | ||
- version: 1.0.2 | ||
date: 2016-10-25 | ||
changes: | ||
- type: bug | ||
text: "`subscribedChannel` should be used instead of `channel`." | ||
- version: 1.0.1 | ||
date: 2016-10-19 | ||
changes: | ||
- type: improvement | ||
text: "Update demos to use hotlink." | ||
- version: 1.0.0 | ||
date: 2016-10-18 | ||
changes: | ||
- type: feature | ||
text: "Support subscribing to array of PubNub channels." | ||
- type: feature | ||
text: "Add support for channel groups." | ||
- type: bug | ||
text: "Fix demo applications." | ||
features: | ||
channel-groups: | ||
- CHANNEL-GROUPS-LIST-CHANNELS-IN-GROUP | ||
storage: | ||
- STORAGE-INCLUDE-TIMETOKEN | ||
- STORAGE-START-END | ||
- STORAGE-COUNT | ||
- STORAGE-FETCH-MESSAGES | ||
subscribe: | ||
- SUBSCRIBE-CHANNELS | ||
- SUBSCRIBE-CHANNEL-GROUPS | ||
- SUBSCRIBE-PUBSUB-V2 | ||
sdks: | ||
- full-name: EON Charts Framework | ||
short-name: EON Charts | ||
tier: 3 | ||
artifacts: | ||
- artifact-type: framework | ||
language: JavaScript | ||
tags: | ||
- Web | ||
source-repository: https://github.com/pubnub/eon-chart | ||
documentation: https://www.pubnub.com/developers/eon | ||
distributions: | ||
- distribution-type: source | ||
distribution-repository: GitHub release | ||
package-name: EON Charts Framework | ||
location: https://github.com/pubnub/eon-chart/releases/tag/1.3.1 | ||
supported-platforms: | ||
supported-browsers: | ||
minimun-supported-version: | ||
- Safari 10.0 | ||
- Mozilla Firefox 51.0 | ||
- Google Chrome 56.0 | ||
- Opera 41.0 | ||
- Microsoft Edge 38 | ||
requires: | ||
- name: c3 | ||
min-version: 0.4.14 | ||
max-version: 0.4.24 | ||
location: Shipped within framework | ||
license: MIT | ||
license-url: https://github.com/c3js/c3/blob/master/LICENSE | ||
is-required: Required | ||
- name: pubnub | ||
min-version: 4.12.0 | ||
max-version: 4.32.0 | ||
location: Shipped within framework | ||
license: MIT | ||
license-url: https://github.com/pubnub/javascript/blob/master/LICENSE | ||
is-required: Required | ||
- name: visibilityjs | ||
min-version: 1.2.4 | ||
max-version: 1.2.8 | ||
location: Shipped within framework | ||
license: MIT | ||
license-url: https://github.com/ai/visibilityjs/blob/master/LICENSE | ||
is-required: Required | ||
- distribution-type: package | ||
distribution-repository: NPM | ||
package-name: EON Charts Framework | ||
location: https://www.npmjs.com/package/eon-chart | ||
supported-platforms: | ||
supported-browsers: | ||
minimun-supported-version: | ||
- Safari 10.0 | ||
- Mozilla Firefox 51.0 | ||
- Google Chrome 56.0 | ||
- Opera 41.0 | ||
- Microsoft Edge 38 | ||
requires: | ||
- name: c3 | ||
min-version: 0.4.14 | ||
max-version: 0.4.24 | ||
location: Shipped within framework | ||
license: MIT | ||
license-url: https://github.com/c3js/c3/blob/master/LICENSE | ||
is-required: Required | ||
- name: pubnub | ||
min-version: 4.12.0 | ||
max-version: 4.32.0 | ||
location: Shipped within framework | ||
license: MIT | ||
license-url: https://github.com/pubnub/javascript/blob/master/LICENSE | ||
is-required: Required | ||
- name: visibilityjs | ||
min-version: 1.2.4 | ||
max-version: 1.2.8 | ||
location: Shipped within framework | ||
license: MIT | ||
license-url: https://github.com/ai/visibilityjs/blob/master/LICENSE | ||
is-required: Required |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be api-client