Skip to content

Implement decorators #304

Implement decorators

Implement decorators #304

Workflow file for this run

name: pr-test
on:
pull_request:
paths-ignore:
- "docs/"
- "**.md"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
# Stop remaining runs when a build fails that is not experimental
fail-fast: true
matrix:
# Run the pipeline on all the currently supported OS versions
os: [ubuntu-latest]
# Run the pipeline on all the currently supported LTS versions and the upcoming version
node-version: [lts/*]
# Run the pipeline on all the currently supported architectures
architecture: [x64]
include:
# Report coverage for only one configuration
- os: ubuntu-latest
node-version: lts/*
architecture: x64
report_coverage: true
outputs:
workspaces: ${{ steps.workspaces.outputs.directories }}
steps:
# Cloning
- uses: actions/checkout@v3
# Collection
- name: Collect NPM workspaces
id: workspaces
uses: secondtruth/[email protected]
with:
files-glob: "*/*/package.json"
unique: true
# Setup and Caching
- name: Use Node.js ${{ matrix.node-version }} (${{ matrix.architecture }})
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
architecture: ${{ matrix.architecture }}
# NPM Cache using all package-lock files as hash
cache: "npm"
cache-dependency-path: "**/package-lock.json"
# Dependencies
- name: SynTest - Install Dependencies
run: npm ci
# Testing
- name: SynTest - Run Tests
id: test
# Generate lcov.info file and Mocha test report
run: npm run test:coverage:ci
# Artifact
- name: SynTest - Upload Test Results
if: ${{ matrix.report_coverage }}
uses: actions/upload-artifact@v3
with:
name: coverage-results
path: ${{ github.workspace }}/**/coverage/lcov.info
# Test Report
- name: Test Report
uses: dorny/test-reporter@v1
if: ${{ matrix.report_coverage }}
with:
name: Mocha Tests
path: ${{ github.workspace }}/**/test-results.json
reporter: mocha-json
# Send coverage information to Coveralls
coverage:
name: Coverage(${{ matrix.workspace }}) - Collection
needs: test
runs-on: ubuntu-latest
defaults:
run:
working-directory: "."
strategy:
# Keep running other versions when a job fails
fail-fast: false
matrix:
workspace: ${{ fromJson(needs.test.outputs.workspaces) }}
steps:
# Cloning
- uses: actions/checkout@v3
# Download test results
- uses: actions/download-artifact@v3
id: artifact
with:
name: coverage-results
# Check if the coverage file exists
- name: Check for coverage files
id: check_files
uses: andstor/file-existence-action@v2
with:
files: ${{ matrix.workspace }}/coverage/lcov.info
# Run the Coveralls action which uploads the lcov.info file
- name: Coveralls(${{ matrix.workspace }})
uses: coverallsapp/github-action@master
if: steps.check_files.outputs.files_exists == 'true'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# We collect all coverages in parallel
parallel: true
flag-name: ${{ matrix.workspace }}
base-path: ${{ matrix.workspace }}/
path-to-lcov: ${{ matrix.workspace }}/coverage/lcov.info
- if: steps.check_files.outputs.files_exists == 'false'
run: echo "::warning file=${{ matrix.workspace }}/coverage/lcov.info::Coverage file missing"
# Indicate sending coverage to Coveralls is finished
coverage-finished:
name: Coverage - Finish
needs: coverage
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true