feat: standardise log for tracking server #93
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests with lint check and code coverage | |
on: | |
workflow_call: | |
secrets: | |
SONAR_TOKEN: | |
required: true | |
pull_request: | |
types: ['opened', 'reopened', 'synchronize'] | |
jobs: | |
coverage: | |
name: Tests with lint check and code coverage | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 1 | |
- name: Setup Node | |
uses: actions/[email protected] | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'npm' | |
- name: Install Dependencies | |
run: npm ci | |
- name: Run Tests & lint check | |
run: | | |
npm run test | |
npm run check:lint | |
- name: Upload Coverage Reports to Codecov | |
uses: codecov/[email protected] | |
with: | |
directory: ./reports/coverage | |
- name: Update sonar-project.properties | |
run: | | |
# Retrieve the version from package.json | |
version=$(node -e "console.log(require('./package.json').version)") | |
# Update the sonar-project.properties file with the version | |
sed -i "s/sonar.projectVersion=.*$/sonar.projectVersion=$version/" sonar-project.properties | |
- name: Fix filesystem paths in generated reports | |
if: always() | |
run: | | |
sed -i 's+home/runner/work/rudderstack-shopify-tracker/rudderstack-shopify-tracker+/github/workspace+g' reports/coverage/lcov.info | |
sed -i 's+/home/runner/work/rudderstack-shopify-tracker/rudderstack-shopify-tracker+/github/workspace+g' reports/eslint.json | |
- name: SonarCloud Scan | |
if: always() | |
uses: SonarSource/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |