feat: refactor type model (#194) #127
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: main-test | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "docs/" | |
- "**.md" | |
jobs: | |
test: | |
name: Coverage - Calculation | |
runs-on: ubuntu-latest | |
outputs: | |
workspaces: ${{ steps.workspaces.outputs.directories }} | |
steps: | |
# Cloning | |
- uses: actions/checkout@v3 | |
# Collection | |
- name: Collect NPM workspaces | |
id: workspaces | |
uses: secondtruth/collect-directories-by-contained-files@v1.0.0 | |
with: | |
files-glob: "*/*/package.json" | |
unique: true | |
# Setup and Caching | |
- name: Use latest Node.js LTS version | |
uses: actions/setup-node@v3 | |
with: | |
node-version: lts/* | |
# 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 | |
# Generate lcov.info file | |
run: npm run test:coverage:ci | |
# Artifact | |
- name: SynTest - Upload Test Results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-results | |
path: ${{ github.workspace }}/**/coverage/lcov.info | |
# 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 | |
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 |