Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Fix CI #1

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@ jobs:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 16.x
cache: npm

- name: Set up Go
uses: actions/setup-go@v4
Expand All @@ -37,20 +39,32 @@ jobs:
run: npm install

- name: Run dummy tests
run: xvfb-run -a npm test
run: |
ls -alh
git ls-files
xvfb-run -a npm test
if: runner.os == 'Linux'
continue-on-error: true

- name: Run tests
run: xvfb-run -a npm test
run: |
ls -alh
git ls-files
xvfb-run -a npm test
if: runner.os == 'Linux'

- name: Run dummy tests
run: npm test
run: |
ls
git ls-files
npm test
if: runner.os != 'Linux'
continue-on-error: true

- name: Run tests
run: npm test
run: |
ls
git ls-files
npm test
if: runner.os != 'Linux'

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules
/test/suite/testdata/**/*/test.yaml
.env
*.vsix
*.bak
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@types/mocha": "^10.0.1",
"@types/node": "^20.4.2",
"@types/vscode": "^1.80.0",
"@vscode/test-electron": "^2.3.3",
"@vscode/test-electron": "^2.3.9",
"@vscode/vsce": "^2.19.0",
"eslint": "^8.45.0",
"mocha": "^10.2.0",
Expand Down
30 changes: 20 additions & 10 deletions test/runTest.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,39 @@
const path = require("path");
const os = require("os");
const fs = require("fs");

const { runTests } = require("@vscode/test-electron");

// The folder containing the Extension Manifest package.json
// Passed to `--extensionDevelopmentPath`
const extensionDevelopmentPath = path.resolve(__dirname, "../");

// The path to the extension test script
// Passed to --extensionTestsPath
const extensionTestsPath = path.resolve(__dirname, "./suite/index");

const projectConfigPath = path.join(extensionDevelopmentPath, ".yamlfmt");
const backupConfigPath = `${projectConfigPath}.bak`;

async function main() {
try {
// The folder containing the Extension Manifest package.json
// Passed to `--extensionDevelopmentPath`
const extensionDevelopmentPath = path.resolve(__dirname, "../");
fs.renameSync(projectConfigPath, backupConfigPath);

// The path to the extension test script
// Passed to --extensionTestsPath
const extensionTestsPath = path.resolve(__dirname, "./suite/index");
let exitCode = 1;

try {
// Download VS Code, unzip it and run the integration test
await runTests({
exitCode = await runTests({
extensionDevelopmentPath,
extensionTestsPath,
launchArgs: ["--user-data-dir", path.join(os.tmpdir(), "yamlfmt-test")],
});

} catch (err) {
console.error("Failed to run tests", err);
process.exit(1);
}

fs.renameSync(backupConfigPath, projectConfigPath);

process.exit(exitCode);
}

main();
Loading