Merge pull request #318 from DotJoshJohnson/ci/add-workflows
Add CI Workflows
This commit is contained in:
commit
0f776cd084
5 changed files with 61 additions and 8 deletions
27
.github/workflows/release.yml
vendored
Normal file
27
.github/workflows/release.yml
vendored
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
name: "Release to Marketplace"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: "ubuntu-latest"
|
||||||
|
steps:
|
||||||
|
- name: "Checkout"
|
||||||
|
uses: "actions/checkout@v2"
|
||||||
|
|
||||||
|
- name: "Setup NodeJS"
|
||||||
|
uses: "actions/setup-node@v2.1.0"
|
||||||
|
|
||||||
|
- name: "Install Dependencies"
|
||||||
|
run: "npm install"
|
||||||
|
|
||||||
|
- name: "Run Tests"
|
||||||
|
run: "npm run test"
|
||||||
|
|
||||||
|
- name: "Publish to Marketplace"
|
||||||
|
uses: "sigma/vsce-publish-action@v0.0.2"
|
||||||
|
with:
|
||||||
|
vsce_token: ${{ secrets.VSCE_TOKEN }}
|
22
.github/workflows/test.yml
vendored
Normal file
22
.github/workflows/test.yml
vendored
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
name: "Run Tests"
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- "master"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: "ubuntu-latest"
|
||||||
|
steps:
|
||||||
|
- name: "Checkout"
|
||||||
|
uses: "actions/checkout@v2"
|
||||||
|
|
||||||
|
- name: "Setup NodeJS"
|
||||||
|
uses: "actions/setup-node@v2.1.0"
|
||||||
|
|
||||||
|
- name: "Install Dependencies"
|
||||||
|
run: "npm install"
|
||||||
|
|
||||||
|
- name: "Run Tests"
|
||||||
|
run: "npm run test"
|
|
@ -261,7 +261,8 @@
|
||||||
"compile": "npm run lint && tsc -p ./",
|
"compile": "npm run lint && tsc -p ./",
|
||||||
"watch": "tsc -watch -p ./",
|
"watch": "tsc -watch -p ./",
|
||||||
"postinstall": "node ./node_modules/vscode/bin/install",
|
"postinstall": "node ./node_modules/vscode/bin/install",
|
||||||
"test": "npm run compile && mocha ./out/test/**/*.js",
|
"test": "npm run compile && mocha './out/test/**/*.js'",
|
||||||
|
"test-windows": "npm run compile && mocha ./out/test/**/*.js",
|
||||||
"lint": "tslint -p tslint.json --fix"
|
"lint": "tslint -p tslint.json --fix"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -277,4 +278,4 @@
|
||||||
"xpath": "0.0.27",
|
"xpath": "0.0.27",
|
||||||
"xqlint": "^0.4.1"
|
"xqlint": "^0.4.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -23,6 +23,7 @@ export function textToXml(textEditor: TextEditor): void {
|
||||||
.replace(/</g, "<")
|
.replace(/</g, "<")
|
||||||
.replace(/>/g, ">")
|
.replace(/>/g, ">")
|
||||||
.replace(/&/g, "&")
|
.replace(/&/g, "&")
|
||||||
|
// tslint:disable-next-line
|
||||||
.replace(/"/g, '"')
|
.replace(/"/g, '"')
|
||||||
.replace(/'/g, "'");
|
.replace(/'/g, "'");
|
||||||
|
|
||||||
|
|
|
@ -124,19 +124,21 @@ describe("V2XmlFormatter", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
function testFormatter(xmlFormatter: XmlFormatter, options: XmlFormattingOptions, fileLabel: string): void {
|
function testFormatter(xmlFormatter: XmlFormatter, options: XmlFormattingOptions, fileLabel: string): void {
|
||||||
const expectedFormattedXml = TestDataLoader.load(`${fileLabel}.formatted.xml`);
|
const expectedFormattedXml = TestDataLoader.load(`${fileLabel}.formatted.xml`).replace(/\r/g, "");
|
||||||
const unformattedXml = TestDataLoader.load(`${fileLabel}.unformatted.xml`);
|
const unformattedXml = TestDataLoader.load(`${fileLabel}.unformatted.xml`);
|
||||||
|
|
||||||
const actualFormattedXml = xmlFormatter.formatXml(unformattedXml, options);
|
const actualFormattedXml = xmlFormatter.formatXml(unformattedXml, options).replace(/\r/g, "");
|
||||||
|
|
||||||
assert.equal(actualFormattedXml, expectedFormattedXml, "Actual formatted XML does not match expected formatted XML.");
|
// tslint:disable-next-line
|
||||||
|
assert.ok((actualFormattedXml === expectedFormattedXml), `Actual formatted XML does not match expected formatted XML.\n\nACTUAL\n${actualFormattedXml.replace(/\s/, "~ws~")}\n\nEXPECTED\n${expectedFormattedXml.replace(/\s/, "~ws~")}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testMinifier(xmlFormatter: XmlFormatter, options: XmlFormattingOptions, fileLabel: string): void {
|
function testMinifier(xmlFormatter: XmlFormatter, options: XmlFormattingOptions, fileLabel: string): void {
|
||||||
const expectedMinifiedXml = TestDataLoader.load(`${fileLabel}.minified.xml`);
|
const expectedMinifiedXml = TestDataLoader.load(`${fileLabel}.minified.xml`).replace(/\r/g, "");
|
||||||
const unminifiedXml = TestDataLoader.load(`${fileLabel}.unminified.xml`);
|
const unminifiedXml = TestDataLoader.load(`${fileLabel}.unminified.xml`);
|
||||||
|
|
||||||
const actualMinifiedXml = xmlFormatter.minifyXml(unminifiedXml, options);
|
const actualMinifiedXml = xmlFormatter.minifyXml(unminifiedXml, options).replace(/\r/g, "");
|
||||||
|
|
||||||
assert.equal(actualMinifiedXml, expectedMinifiedXml, "Actual minified XML does not match expected minified XML.");
|
// tslint:disable-next-line
|
||||||
|
assert.ok((actualMinifiedXml === expectedMinifiedXml), `Actual minified XML does not match expected minified XML.\n\nACTUAL\n${actualMinifiedXml.replace(/\s/, "~ws~")}\n\nEXPECTED\n${expectedMinifiedXml.replace(/\s/, "~ws~")}`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue