Skip to content

fix: tests

fix: tests #176

Workflow file for this run

name: Release
on:
push:
branches: [ prod, staging ]
env:
NODE_VERSION: 20.10.0
ENABLE_CACHE: yes
jobs:
prepare:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.ref }}-prepare
cancel-in-progress: true
outputs:
node-version: ${{ steps.variable.outputs.node-version }}
enable-cache: ${{ steps.variable.outputs.enable-cache }}
steps:
- name: Define variables
id: variable
run: |
echo "node-version=$NODE_VERSION" >> $GITHUB_OUTPUT
echo "enable-cache=$ENABLE_CACHE" >> $GITHUB_OUTPUT
release:
name: Release
needs: [prepare]
runs-on: ubuntu-latest
concurrency:
group: ${{ github.ref }}-release
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ needs.prepare.outputs.node-version }}
cache: ${{ needs.prepare.outputs.enable-cache == 'yes' && 'npm' || '' }}
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Run check typescript
run: npm run ts:check
- name: Run eslint
run: npm run lint:check
- name: Test
run: npm run test -- --coverage
- uses: actions/upload-artifact@v4
with:
name: coverage-lcov
path: coverage
- name: Build
run: |
npm pkg delete scripts.prepare
npm run build
- name: Release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
sonarcube:
runs-on: ubuntu-latest
needs: [release,prepare]
concurrency:
group: ${{ github.ref }}-sonarcube
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
name: coverage-lcov
path: coverage
- id: package-version
run: npx @lomray/microservices-cli package-version
- uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_CLOUD_TOKEN }}
with:
args: >
-Dsonar.projectVersion=${{ steps.package-version.outputs.version }}