Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

Adding CI #11

Merged
merged 1 commit into from Apr 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,73 @@
on:
pull_request:
branches:
- master
push:
branches:
- master

jobs:
build_test_job:
name: 'Build and test job'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
steps:

- name: 'Checking out repo code'
uses: actions/checkout@v2

- name: 'Validate build'
run: |
npm install
npm run build

- name: 'Run L0 tests'
run: |
npm run test

- name : 'Run test coverage'
if: runner.os == 'Windows'
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$coverage_result = npm run coverage
$start = $false;
$middle = $false;
$end = $false;
$count = 0;

foreach ($j in $coverage_result)
{
if ($j.tostring().startswith("--------------"))
{
if (!$start)
{
$start = $true;
$start_index = $count
}
elseif (!$middle)
{
$middle = $true;
$middle_index = $count
}
elseif (!$end)
{
$end = $true;
$end_index = $count
}
}
$count++
}

$tbl_md = $coverage_result[($start_index+1)..($end_index-1)] -join "\n"
$summary = $coverage_result[($end_index + 1)..$count] -join "\n"
$comment = $tbl_md + "\n" + $summary

$url = "https://api.github.com/repos/${env:GITHUB_REPOSITORY}/issues/${env:PR_NUMBER}/comments"
$headers = @{
"Authorization" = "token ${env:GITHUB_TOKEN}"
}
Invoke-RestMethod -Method POST -Uri $url -Headers $headers -Body "{ `"body`": `"${comment}`" }"
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -136,6 +136,10 @@ _TeamCity*
*.coverage
*.coveragexml

# nyc coverage file
.nyc_output/*
coverage/*

# NCrunch
_NCrunch_*
.*crunch*.local.xml
Expand Down
26 changes: 26 additions & 0 deletions .nycrc
@@ -0,0 +1,26 @@
{
"cache": false,
"check-coverage": false,
"extension": [
".ts"
],
"include": [
"**/*.js",
"**/*.ts"
],
"exclude": [
"coverage/**",
"node_modules/**",
"**/*.d.ts",
"**/*.test.ts",
"**/*.js"
],
"sourceMap": true,
"reporter": [
"html",
"text",
"text-summary"
],
"all": true,
"instrument": true
}