chore: Initialize CI pipelines (#205)

This commit is contained in:
Shi Chen 2022-07-07 11:03:42 +08:00 коммит произвёл GitHub
Родитель c94f4fdfda
Коммит 7c0c7eb931
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
8 изменённых файлов: 145 добавлений и 25 удалений

45
.github/workflows/linux.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,45 @@
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
linux:
name: Linux
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- name: Setup Build Environment
run: |
sudo apt-get update
sudo apt-get install -y libxkbfile-dev pkg-config libsecret-1-dev libxss1 dbus xvfb libgtk-3-0 libgbm1
sudo /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
sleep 3
- name: Setup Node.js environment
uses: actions/setup-node@v2
with:
node-version: 14
- name: Install Node.js modules
run: npm install
- name: Install VSCE
run: npm install -g vsce
- name: Linting
run: npm run tslint
- name: Compiling
run: npm run compile
- name: Build VSIX file
run: vsce package
- name: Test extension
run: DISPLAY=:99 npm test

38
.github/workflows/macOS.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,38 @@
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
darwin:
name: macOS
runs-on: macos-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- name: Setup Node.js environment
uses: actions/setup-node@v2
with:
node-version: 14
- name: Install Node.js modules
run: npm install
- name: Install VSCE
run: npm install -g vsce
- name: Linting
run: npm run tslint
- name: Compiling
run: npm run compile
- name: Build VSIX file
run: vsce package
- name: Test extension
run: npm test

38
.github/workflows/windows.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,38 @@
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
windows:
name: Windows
runs-on: windows-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- name: Setup Node.js environment
uses: actions/setup-node@v2
with:
node-version: 14
- name: Install Node.js modules
run: npm install
- name: Install VSCE
run: npm install -g vsce
- name: Linting
run: npm run tslint
- name: Compiling
run: npm run compile
- name: Build VSIX file
run: vsce package
- name: Test extension
run: npm test

1
.gitignore поставляемый
Просмотреть файл

@ -3,5 +3,4 @@ node_modules
.vscode-test/
*.vsix
*.log
.*
dist

30
package-lock.json сгенерированный
Просмотреть файл

@ -200,9 +200,9 @@
"dev": true
},
"@types/mocha": {
"version": "5.2.7",
"resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.7.tgz",
"integrity": "sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==",
"version": "9.1.1",
"resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.1.1.tgz",
"integrity": "sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw==",
"dev": true
},
"@types/node": {
@ -241,6 +241,18 @@
"@microsoft/1ds-post-js": "^3.2.3"
}
},
"@vscode/test-electron": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-2.1.5.tgz",
"integrity": "sha512-O/ioqFpV+RvKbRykX2ItYPnbcZ4Hk5V0rY4uhQjQTLhGL9WZUvS7exzuYQCCI+ilSqJpctvxq2llTfGXf9UnnA==",
"dev": true,
"requires": {
"http-proxy-agent": "^4.0.1",
"https-proxy-agent": "^5.0.0",
"rimraf": "^3.0.2",
"unzipper": "^0.10.11"
}
},
"@webassemblyjs/ast": {
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz",
@ -3274,18 +3286,6 @@
"uuid": "^8.3.2"
}
},
"vscode-test": {
"version": "1.6.1",
"resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-1.6.1.tgz",
"integrity": "sha512-086q88T2ca1k95mUzffvbzb7esqQNvJgiwY4h29ukPhFo8u+vXOOmelUoU5EQUHs3Of8+JuQ3oGdbVCqaxuTXA==",
"dev": true,
"requires": {
"http-proxy-agent": "^4.0.1",
"https-proxy-agent": "^5.0.0",
"rimraf": "^3.0.2",
"unzipper": "^0.10.11"
}
},
"watchpack": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz",

Просмотреть файл

@ -183,16 +183,16 @@
"@types/glob": "^7.2.0",
"@types/lodash": "^4.14.182",
"@types/md5": "^2.3.2",
"@types/mocha": "^5.2.7",
"@types/mocha": "^9.1.1",
"@types/node": "^10.17.60",
"@types/vscode": "1.63.0",
"@types/xml2js": "^0.4.11",
"@vscode/test-electron": "^2.1.5",
"glob": "^7.2.3",
"mocha": "^9.2.2",
"ts-loader": "^4.4.2",
"tslint": "^5.20.1",
"typescript": "^4.7.4",
"vscode-test": "^1.6.1",
"webpack": "^5.73.0",
"webpack-cli": "^4.10.0"
},

Просмотреть файл

@ -3,7 +3,7 @@
import * as path from "path";
import { runTests } from "vscode-test";
import { runTests } from "@vscode/test-electron";
async function main(): Promise<void> {
try {

Просмотреть файл

@ -5,15 +5,15 @@ import * as glob from "glob";
import * as Mocha from "mocha";
import * as path from "path";
// tslint:disable-next-line:export-name
export function run(): Promise<void> {
// Create the mocha test
const mocha = new Mocha({
ui: "tdd"
ui: "tdd",
color: true,
timeout: 1 * 60 * 1000,
});
mocha.useColors(true);
const testsRoot = path.resolve(__dirname, "..");
const testsRoot = __dirname;
return new Promise((c, e) => {
glob("**/**.test.js", { cwd: testsRoot }, (err, files) => {
@ -22,11 +22,11 @@ export function run(): Promise<void> {
}
// Add files to the test suite
files.forEach(f => mocha.addFile(path.resolve(testsRoot, f)));
files.forEach((f) => mocha.addFile(path.resolve(testsRoot, f)));
try {
// Run the mocha test
mocha.run(failures => {
mocha.run((failures) => {
if (failures > 0) {
e(new Error(`${failures} tests failed.`));
} else {