Add "Test source" workflow #228
Workflow file for this run
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: Unit Tests | |
on: | |
pull_request: | |
paths: | |
- dist/** | |
- src/** | |
- jest.config.json | |
push: | |
branches: | |
- main | |
defaults: | |
run: | |
shell: sh | |
jobs: | |
unit-tests: | |
name: Unit Tests | |
timeout-minutes: 5 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout ${{ github.repository }} | |
uses: actions/checkout@v4 | |
- name: Cache yarn dependencies | |
id: yarn-cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
.yarn/cache | |
node_modules | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/.yarnrc.yml') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Compile | |
if: ${{ steps.yarn-cache.outputs.cache-hit != 'true' }} | |
run: yarn install | |
- name: Unit tests | |
if: github.ref != 'refs/heads/main' | |
env: | |
DEEPL_API_KEY: ${{ secrets.DEEPL_API_KEY }} | |
MYMEMORY_API_KEY: ${{ secrets.MYMEMORY_API_KEY }} | |
run: yarn test | |
- name: Unit tests with coverage | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
uses: paambaati/codeclimate-action@v5.0.0 | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
DEEPL_API_KEY: ${{ secrets.DEEPL_API_KEY }} | |
MYMEMORY_API_KEY: ${{ secrets.MYMEMORY_API_KEY }} | |
with: | |
coverageCommand: yarn test | |
debug: true |