chore: add a step to validate branch name in Build Artifacts for PRs workflow #65
Workflow file for this run
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/checkout@v4.1.1 | |
with: | |
fetch-depth: 1 | |
- name: Setup Node | |
uses: actions/setup-node@v4.0.1 | |
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/codecov-action@v3.1.4 | |
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/sonarcloud-github-action@v2.1.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |