fix: do suggestion to reduce complexity on some regexp #5
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: CI | |
on: | |
push: | |
branches: | |
- '**' | |
pull_request: | |
branches: | |
- main | |
- develop | |
release: | |
types: [created] | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
test_lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
run_install: false | |
- name: Install dependencies | |
run: pnpm install | |
- name: Run linting | |
run: pnpm lint | |
test_karma: | |
runs-on: ubuntu-latest | |
container: trion/ng-cli-karma | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
run_install: false | |
- name: Install dependencies | |
run: pnpm install | |
- name: Run Karma tests | |
run: pnpm test:prod | |
- name: Upload coverage | |
uses: actions/upload-artifact@v4 | |
if: success() | |
with: | |
name: "${{ github.job }}" | |
path: coverage/ | |
sonarcloud_check: | |
name: SonarCloud | |
runs-on: ubuntu-latest | |
needs: [test_lint, test_karma] | |
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- uses: actions/cache@v3 | |
with: | |
node-version: '20.x' | |
path: |- | |
node_modules/ | |
.sonar/cache | |
key: "${{ github.job }}" | |
- uses: actions/download-artifact@v4 | |
with: | |
name: test_karma | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
deploy: | |
runs-on: ubuntu-latest | |
needs: [test_lint, test_karma] | |
container: trion/ng-cli-karma | |
if: github.event_name == 'release' # Only deploy on tag creation | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
run_install: false | |
# Setup .npmrc file to publish to npm | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
registry-url: 'https://registry.npmjs.org' | |
- run: | | |
pnpm install | |
ng build ngx-error-message | |
cd dist/ngx-error-message | |
pnpm publish --provenance --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |