translation/angular

View on GitHub
.github/workflows/test.yml

Summary

Maintainability
Test Coverage
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Build Status

on: [push]

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        node-version: [14.x, 16.x, 18.x]
        angular-version: ['06', '09', '12', '13', '14'] # other versions are not tested in CI but are present in the repository samples
    name: Node.js ${{ matrix.node-version }} - Angular v${{ matrix.angular-version }}
    env:
      CC_TEST_REPORTER_ID: c3f1809198d464f50a6824df3f568499cc5ec35ec08ea6e6c005ce3a932cd035
    steps:
    - uses: actions/checkout@v3
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v3
      with:
        node-version: ${{ matrix.node-version }}
        cache: 'npm'
    - run: npm update
    - run: npm ci
    - run: npm test
    - name: Install Angular dependencies
      run: |
        cd samples/v${{ matrix.angular-version }}
        npm install
    - name: Remove all segments from corresponding Translation.io Project
      run: |
        node -e 'require("./samples/tio-utils").purgeProject("TRANSLATIONANGULARV${{ matrix.angular-version }}WITHNODE${{ matrix.node-version }}")'
    - name: Place correct API key in tio.config.json file
      run: |
        cd samples/v${{ matrix.angular-version }}
        sed -i 's/TRANSLATIONANGULARTESTING/TRANSLATIONANGULARV${{ matrix.angular-version }}WITHNODE${{ matrix.node-version }}/g' tio.config.json
        sed -i 's/\.x/X/g' tio.config.json
    - name: Initialize Translation.io project for Node 18
      if: ${{ matrix.node-version == '18.x' }}
      env:
        NODE_OPTIONS: --openssl-legacy-provider
      run: |
        cd samples/v${{ matrix.angular-version }}
        npm run translation:init
    - name: Initialize Translation.io project for Node < 18
      if: ${{ matrix.node-version != '18.x' }}
      run: |
        cd samples/v${{ matrix.angular-version }}
        npm run translation:init
    - name: Execute specs of initialized project
      run: |
        cd samples/v${{ matrix.angular-version }}
        node spec.js
    - name: Publish code coverage
      if: ${{ matrix.node-version == '18.x' && matrix.angular-version == '14' }} # only one is needed!
      uses: paambaati/codeclimate-action@v3.0.0
      with:
        debug: true
        verifyDownload: true