Merge pull request #318 from DotJoshJohnson/ci/add-workflows

Add CI Workflows
This commit is contained in:
Josh Johnson 2020-07-06 22:38:31 -04:00 committed by GitHub
commit 0f776cd084
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 61 additions and 8 deletions

27
.github/workflows/release.yml vendored Normal file
View 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
View 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"

View File

@ -261,7 +261,8 @@
"compile": "npm run lint && tsc -p ./",
"watch": "tsc -watch -p ./",
"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"
},
"devDependencies": {
@ -277,4 +278,4 @@
"xpath": "0.0.27",
"xqlint": "^0.4.1"
}
}
}

View File

@ -23,6 +23,7 @@ export function textToXml(textEditor: TextEditor): void {
.replace(/&lt;/g, "<")
.replace(/&gt;/g, ">")
.replace(/&amp;/g, "&")
// tslint:disable-next-line
.replace(/&quot;/g, '"')
.replace(/&apos;/g, "'");

View File

@ -124,19 +124,21 @@ describe("V2XmlFormatter", () => {
});
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 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 {
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 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~")}`);
}