chore[#90]: lint config for user-service-e2e #4
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: Lint and Test | |
on: | |
push: | |
branches: | |
- 'milestone-**' | |
- 'issue-**' | |
pull_request: | |
branches: | |
- 'milestone-**' | |
- development | |
- main | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 21.6.1 | |
cache: 'npm' | |
- name: Cache node_modules | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
- name: Install dependencies | |
run: npm install | |
shared-code: | |
needs: setup | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 21.6.1 | |
- name: Restore node_modules | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
fail-on-cache-miss: true | |
- name: Lint | |
run: npx nx lint shared | |
- name: Unit and Integration tests | |
run: npx nx test shared -- --coverage --coverageReporters=cobertura | |
- name: Coverage report | |
uses: irongut/CodeCoverageSummary@v1.3.0 | |
if: github.event_name == 'pull_request' | |
with: | |
filename: coverage/shared/cobertura-coverage.xml | |
badge: true | |
fail_below_min: false | |
format: markdown | |
hide_branch_rate: false | |
hide_complexity: true | |
indicators: true | |
output: both | |
thresholds: '80 90' | |
- name: Cache coverage report | |
uses: actions/cache@v4 | |
if: github.event_name == 'pull_request' | |
with: | |
path: code-coverage-results.md | |
key: ${{ runner.os }}-shared-coverage-report | |
auth-service: | |
needs: setup | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 21.6.1 | |
- name: Restore node_modules | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
fail-on-cache-miss: true | |
- name: Lint | |
run: npx nx lint auth-service | |
- name: Lint E2E | |
run: npx nx lint auth-service-e2e | |
- name: Unit and Integration tests | |
run: npx nx test auth-service -- --coverage --coverageReporters=cobertura | |
- name: Coverage report | |
uses: irongut/CodeCoverageSummary@v1.3.0 | |
if: github.event_name == 'pull_request' | |
with: | |
filename: coverage/auth-service/cobertura-coverage.xml | |
badge: true | |
fail_below_min: false | |
format: markdown | |
hide_branch_rate: false | |
hide_complexity: true | |
indicators: true | |
output: both | |
thresholds: '80 90' | |
- name: Cache coverage report | |
uses: actions/cache@v4 | |
if: github.event_name == 'pull_request' | |
with: | |
path: code-coverage-results.md | |
key: ${{ runner.os }}-auth-service-coverage-report | |
financial-service: | |
needs: setup | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 21.6.1 | |
- name: Restore node_modules | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
fail-on-cache-miss: true | |
- name: Lint | |
run: npx nx lint financial-service | |
- name: Lint E2E | |
run: npx nx lint financial-service-e2e | |
- name: Unit and Integration tests | |
run: npx nx test financial-service -- --coverage --coverageReporters=cobertura | |
- name: Coverage report | |
uses: irongut/CodeCoverageSummary@v1.3.0 | |
if: github.event_name == 'pull_request' | |
with: | |
filename: coverage/financial-service/cobertura-coverage.xml | |
badge: true | |
fail_below_min: false | |
format: markdown | |
hide_branch_rate: false | |
hide_complexity: true | |
indicators: true | |
output: both | |
thresholds: '80 90' | |
- name: Cache coverage report | |
uses: actions/cache@v4 | |
if: github.event_name == 'pull_request' | |
with: | |
path: code-coverage-results.md | |
key: ${{ runner.os }}-financial-service-coverage-report | |
user-service: | |
needs: setup | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 21.6.1 | |
- name: Restore node_modules | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
fail-on-cache-miss: true | |
- name: Lint | |
run: npx nx lint user-service | |
- name: Lint E2E | |
run: npx nx lint user-service-e2e | |
- name: Unit and Integration tests | |
run: npx nx test user-service -- --coverage --coverageReporters=cobertura | |
- name: Coverage report | |
uses: irongut/CodeCoverageSummary@v1.3.0 | |
if: github.event_name == 'pull_request' | |
with: | |
filename: coverage/user-service/cobertura-coverage.xml | |
badge: true | |
fail_below_min: false | |
format: markdown | |
hide_branch_rate: false | |
hide_complexity: true | |
indicators: true | |
output: both | |
thresholds: '80 90' | |
- name: Cache coverage report | |
uses: actions/cache@v4 | |
if: github.event_name == 'pull_request' | |
with: | |
path: code-coverage-results.md | |
key: ${{ runner.os }}-user-service-coverage-report | |
report: | |
if: github.event_name == 'pull_request' | |
needs: | |
- shared-code | |
- auth-service | |
- financial-service | |
- user-service | |
runs-on: ubuntu-latest | |
steps: | |
- name: Restore shared code report | |
uses: actions/cache@v4 | |
with: | |
path: shared-code-coverage-results.md | |
key: ${{ runner.os }}-shared-coverage-report | |
- name: Restore auth-service report | |
uses: actions/cache@v4 | |
with: | |
path: auth-service-code-coverage-results.md | |
key: ${{ runner.os }}-auth-service-coverage-report | |
- name: Restore financial-service report | |
uses: actions/cache@v4 | |
with: | |
path: financial-service-code-coverage-results.md | |
key: ${{ runner.os }}-financial-service-coverage-report | |
- name: Restore user-service report | |
uses: actions/cache@v4 | |
with: | |
path: user-service-code-coverage-results.md | |
key: ${{ runner.os }}-user-service-coverage-report | |
- name: Set title for shared code | |
run: | | |
cat <<EOF >> code-coverage-output.md | |
## 📦 Shared | |
EOF | |
- name: Merge shared report file | |
run: cat shared-code-coverage-results.md >> code-coverage-output.md | |
- name: Set title for auth-service | |
run: | | |
cat <<EOF >> code-coverage-output.md | |
## 📦 Auth Service | |
EOF | |
- name: Merge auth-service report file | |
run: cat auth-service-coverage-results.md >> code-coverage-output.md | |
- name: Set title for financial-service | |
run: | | |
cat <<EOF >> code-coverage-output.md | |
## 📦 Financial Service | |
EOF | |
- name: Merge financial-service report file | |
run: cat financial-service-coverage-results.md >> code-coverage-output.md | |
- name: Set title for user-service | |
run: | | |
cat <<EOF >> code-coverage-output.md | |
## 📦 User Service | |
EOF | |
- name: Merge user-service report file | |
run: cat user-service-coverage-results.md >> code-coverage-output.md | |
- name: Set final PR message | |
run: | | |
cat <<EOF >> code-coverage-output.md | |
⛔️ This comment can be replaced by Github Actions. Do not quote or react to it. | |
EOF | |
- name: Add coverage PR comment | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
header: code-coverage | |
recreate: true | |
path: code-coverage-output.md |