mirror of
https://github.com/Cameri/nostream.git
synced 2025-03-18 05:41:49 +01:00
180 lines
5.0 KiB
YAML
180 lines
5.0 KiB
YAML
name: CI Checks
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
concurrency:
|
|
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
commit-lint:
|
|
name: Lint commits
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version-file: .nvmrc
|
|
cache: npm
|
|
- name: Install package dependencies
|
|
run: npm ci
|
|
- name: Run commitlint
|
|
uses: wagoid/commitlint-github-action@v5
|
|
lint:
|
|
name: Lint code
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version-file: .nvmrc
|
|
cache: npm
|
|
- name: Install package dependencies
|
|
run: npm ci
|
|
- name: Run ESLint
|
|
run: npm run lint
|
|
build-check:
|
|
name: Build check
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version-file: .nvmrc
|
|
cache: npm
|
|
- name: Install package dependencies
|
|
run: npm ci
|
|
- name: Run ESLint
|
|
run: npm run build:check
|
|
test-units-and-cover:
|
|
name: Unit Tests And Coverage
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- commit-lint
|
|
- lint
|
|
- build-check
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version-file: .nvmrc
|
|
cache: npm
|
|
- name: Install package dependencies
|
|
run: npm ci
|
|
- name: Run unit tests
|
|
run: npm run test:unit
|
|
- name: Run coverage for unit tests
|
|
run: npm run cover:unit
|
|
if: ${{ always() }}
|
|
- uses: actions/upload-artifact@v3
|
|
name: Upload coverage report for unit tests
|
|
if: ${{ always() }}
|
|
with:
|
|
path: .coverage/*/lcov.info
|
|
- name: Coveralls
|
|
uses: coverallsapp/github-action@master
|
|
if: ${{ always() }}
|
|
with:
|
|
path-to-lcov: ./.coverage/unit/lcov.info
|
|
flag-name: Unit
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
parallel: true
|
|
test-integrations-and-cover:
|
|
name: Integration Tests and Coverage
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- commit-lint
|
|
- lint
|
|
- build-check
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version-file: .nvmrc
|
|
- name: Run integration tests
|
|
run: npm run docker:test:integration
|
|
- name: Generate Cucumber report annotations
|
|
uses: deblockt/cucumber-report-annotations-action@v1.7
|
|
if: ${{ always() }}
|
|
continue-on-error: true
|
|
with:
|
|
access-token: ${{ secrets.GITHUB_TOKEN }}
|
|
path: .test-reports/integration/report.json
|
|
- name: Run coverage for integration tests
|
|
run: npm run docker:cover:integration
|
|
- name: Coveralls
|
|
uses: coverallsapp/github-action@master
|
|
if: ${{ always() }}
|
|
with:
|
|
path-to-lcov: .coverage/integration/lcov.info
|
|
flag-name: Integration
|
|
parallel: true
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
- uses: actions/upload-artifact@v3
|
|
name: Upload coverage report for integration tests
|
|
if: ${{ always() }}
|
|
with:
|
|
path: .coverage/*/lcov.info
|
|
sonarcloud:
|
|
name: Sonarcloud
|
|
needs: [test-units-and-cover, test-integrations-and-cover]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: actions/download-artifact@v3
|
|
name: Download unit & integration coverage reports
|
|
with:
|
|
path: .coverage
|
|
- name: SonarCloud Scan
|
|
uses: sonarsource/sonarcloud-github-action@master
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
post-tests:
|
|
name: Post Tests
|
|
needs: [test-units-and-cover, test-integrations-and-cover]
|
|
runs-on: ubuntu-latest
|
|
if: ${{ always() }}
|
|
steps:
|
|
- name: Coveralls Finished
|
|
uses: coverallsapp/github-action@master
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
parallel-finished: true
|
|
release:
|
|
name: Release
|
|
runs-on: ubuntu-latest
|
|
needs: [test-units-and-cover, test-integrations-and-cover]
|
|
if: github.ref == 'refs/heads/main'
|
|
environment: release
|
|
env:
|
|
TELEGRAM_BOT_ID: ${{ secrets.TELEGRAM_BOT_ID }}
|
|
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version-file: .nvmrc
|
|
- name: Install package dependencies
|
|
run: npm ci
|
|
- name: Release
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.RELEASE_PAT }}
|
|
run: npx semantic-release
|