Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get the test pipeline working #10

Merged
merged 4 commits into from
Sep 8, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 0 additions & 140 deletions .github/workflows/pipeline.yml

This file was deleted.

22 changes: 20 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:

jobs:
relabel:
name: Relabeler Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -29,10 +30,21 @@ jobs:
run: npm ci

- name: Build project
run: npm run build # Assumes you have a build script in package.json
run: npm run build

- name: Test
run: npm test
run: |
npm test

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage/lcov.info # cSpell: ignore lcov
#token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests # cSpell: ignore unittests
name: relabeler-tests
verbose: true
fail_ci_if_error: true

- name: Create artifact
run: |
Expand All @@ -46,7 +58,13 @@ jobs:
path: artifact/

- name: Run Relabeler
id: relabeler
uses: ./ # This uses the action from the root of the branch or PR
with:
who-to-greet: "GitHub"
repositoryToken: ${{ secrets.GITHUB_TOKEN }}

- name: Print Relabeler Outputs
run: |
echo "Repository: ${{ steps.relabeler.outputs.repository }}"
echo "Time: ${{ steps.relabeler.outputs.time }}"
90 changes: 48 additions & 42 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,47 +11,53 @@ pr:
- main

pool:
vmImage: 'ubuntu-latest'
vmImage: "ubuntu-latest"

steps:
- task: NodeTool@0
inputs:
versionSpec: '18.x'
displayName: 'Install Node.js'

- script: |
npm install
displayName: 'npm install'

- script: |
npm run build
displayName: 'npm build'

- script: |
npm test
displayName: 'npm test'

- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '**/TEST-*.xml'

- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'Cobertura' # cSpell: ignore Cobertura
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/*coverage.xml'

- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(System.DefaultWorkingDirectory)/build'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
replaceExistingArchive: true

- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifact: 'drop'
publishLocation: 'pipeline'
- task: NodeTool@0
inputs:
versionSpec: "18.x"
displayName: "Install Node.js"

- script: |
npm install
displayName: "npm install"

- script: |
npm run build
displayName: "npm build"

- script: |
npm test
displayName: "npm test and coverage"

- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFormat: "JUnit"
testResultsFiles: "**/TEST-*.xml"

- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: "Cobertura" # cSpell: ignore Cobertura
summaryFileLocation: "$(System.DefaultWorkingDirectory)/coverage/cobertura-coverage.xml"

- task: PublishPipelineArtifact@1
inputs:
targetPath: "$(System.DefaultWorkingDirectory)/coverage/cobertura-coverage.xml"
artifact: "coverage-report"
publishLocation: "pipeline"

- task: ArchiveFiles@2
inputs:
rootFolderOrFile: "$(System.DefaultWorkingDirectory)/dist"
includeRootFolder: false
archiveType: "zip"
archiveFile: "$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip"
replaceExistingArchive: true

- task: PublishPipelineArtifact@1
inputs:
targetPath: "$(Build.ArtifactStagingDirectory)"
artifact: "build-artifact"
publishLocation: "pipeline"
36 changes: 36 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
coverage:
status:
project:
default:
# Thresholds for overall project coverage
target: 80% # Set your desired coverage target
threshold: 1% # Allowable drop in coverage
patch:
default:
# Thresholds for coverage of new changes
target: 80% # Set your desired coverage target for new changes
threshold: 5% # Allowable drop in coverage for new changes

comment:
layout: "reach, diff, flags, files"
behavior: default
require_changes: false

parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no

flags:
unittests:
paths:
- "src/"

# Exclude specific files or directories from coverage
ignore:
- "__tests__/"
- "node_modules/"
- "dist/"
4 changes: 2 additions & 2 deletions jest.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ export default {
},
collectCoverage: true,
coverageDirectory: 'coverage',
coverageReporters: ['cobertura', 'text'] // cSpell: ignore cobertura
};
coverageReporters: ['lcov', 'text', 'cobertura'], // Generates both LCOV and Cobertura reports
}; // cSpell: ignore lcov cobertura
Loading