Skip to content

Commit

Permalink
Merge pull request #20 from anibalsolon/feature/tests-and-coverage
Browse files Browse the repository at this point in the history
CI/CD Workflow
  • Loading branch information
anibalsolon authored Mar 14, 2022
2 parents 5796600 + 356860d commit ec9df9f
Show file tree
Hide file tree
Showing 22 changed files with 3,046 additions and 1,956 deletions.
2 changes: 2 additions & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
service_name: github-actions
repo_token:
20 changes: 17 additions & 3 deletions .github/workflows/test-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,22 @@ on:
branches:
- develop

name: Unit Testing
name: Build
jobs:

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm install
- run: npm run clear
- run: /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
- run: npm run test:vscode
- run: npm run test:vscode:coverage
env:
DISPLAY: ':99.0'
- run: npm run test:unit:coverage
- run: echo ${{ secrets.COVERALLS_TOKEN }} >> ./.coveralls.yml
- run: npm run test:merge

deploy:
if: github.ref == 'refs/heads/main' && !startsWith(github.event.head_commit.message, '[RELEASE]')
Expand All @@ -27,9 +31,19 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.GH_PAT }}
token: ${{ secrets.GH_TOKEN }}
- run: npm install
- run: git config --global user.name 'Anibal Solon'
- run: git config --global user.email '[email protected]'
- run: npm version patch -m "[RELEASE] %s"
- run: git push

- run: |
[ -z "$PAT" ] && npm run vscode:vsce:publish "$PAT"
env:
PAT: ${{ secrets.VSCE_PAT }}
- run: |
[ -z "$PAT" ] && npm run vscode:ovsx:publish "$PAT"
env:
PAT: ${{ secrets.OVSX_PAT }}
9 changes: 7 additions & 2 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"spec": "./test/unit/**/*.test.ts",
"ui": "tdd",
"recursive": true,
"require": ["ts-node/register"]
"exit": true,
"require": ["ts-node/register", "source-map-support/register"],
"extension": ["ts"],
"exclude": [
"test/suite/**"
]
}
12 changes: 7 additions & 5 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
{
"extension": [
".ts"
],
"extends": "@istanbuljs/nyc-config-typescript",
"exclude": [
"**/*.d.ts",
"**/*.test.js",
"coverage",
"dist",
"test",
".vscode-test",
"webpack.config.js"
],
"reporter": [
"html"
"html",
"text",
"text-summary"
],
"all": true,
"cache": true
"cache": false,
"source-map": true
}
14 changes: 12 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@
"--disable-extensions"
]
},
{
"name": "Run Web Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"${workspaceFolder}/data",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionDevelopmentKind=web"
]
},
{
"name": "Run Extension Tests",
"type": "pwa-node",
Expand All @@ -25,13 +35,13 @@
]
},
{
"name": "Unit Tests",
"name": "Run Unit Tests",
"type": "pwa-node",
"request": "launch",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run",
"test:unittests",
"test:unit",
],
"skipFiles": [
"<node_internals>/**"
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
<!-- (https://raw.githubusercontent.com/anibalsolon/vscode-neuro-viewer/main/neuro-viewer.png) -->
<!-- (https://mattermost.brainhack.org/brainhack/channels/vscode-neuro-viewer) -->

[![The MIT License](https://flat.badgen.net/badge/license/MIT/orange)](http://opensource.org/licenses/MIT)
[![GitHub](https://flat.badgen.net/github/release/anibalsolon/vscode-neuro-viewer)](https://github.com/anibalsolon/vscode-neuro-viewer/releases)
[![Visual Studio Marketplace](https://vsmarketplacebadge.apphb.com/installs-short/anibalsolon.neuro-viewer.svg?style=flat-square)](https://marketplace.visualstudio.com/items?itemName=anibalsolon.neuro-viewer)
[![Coverage Status](https://coveralls.io/repos/github/anibalsolon/vscode-neuro-viewer/badge.svg?branch=develop)](https://coveralls.io/github/anibalsolon/vscode-neuro-viewer?branch=develop)
![Build](https://github.com/anibalsolon/vscode-neuro-viewer/actions/workflows/test-and-deploy.yml/badge.svg?branch=main)

If you got here, you might be familiar with Nifti files. In any case, Nifti is a file format for neuroimaging.
This extension allows the user to visualize the volumetric data in Nifti files, and more features are coming!

Expand Down
3 changes: 2 additions & 1 deletion extension/fileserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ export class FileServer {
}
} catch (error) {
res.writeHead(500);
res.end(error);
console.error(error);
res.end("An internal server error occurred.");
}
}

Expand Down
Loading

0 comments on commit ec9df9f

Please sign in to comment.