Skip to content

Fix action.

Fix action. #977

Workflow file for this run

name: tests
on:
pull_request:
push:
branches:
- master
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
tests:
name: Run Tests
runs-on: "ubuntu-24.04"
steps:

Check failure on line 19 in .github/workflows/tests.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/tests.yml

Invalid workflow file

You have an error in your yaml syntax on line 19
- name: checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: "20.18.3"
cache: "yarn"
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Check cache for yarn
uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-cache-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-cache-
- name: Install dependencies
run: yarn install --legacy-peer-deps --prefer-offline
- name: Run Tests
if: github.event_name != 'pull_request'
continue-on-error: true
id: run-tests
run: yarn test --coverage --collectCoverageFrom="./src/**" > /tmp/coverage_report
- name: Post Test Coverage Report in PR
uses: ArtiomTr/jest-coverage-report-action@v2
continue-on-error: true
if: github.event_name == 'pull_request'
with:
test-script: yarn test --collectCoverageFrom="./src/**"
annotations: all
- name: Gain access to test-reports bucket
if: (steps.run-tests.outcome == 'failure' || steps.run-tests.outcome == 'success') && github.ref == 'refs/heads/develop'
uses: google-github-actions/setup-gcloud@v0
with:
project_id: "netdata-cloud-testing"
service_account_key: ${{ secrets.TEST_AUTOMATION_SERVICE_ACCOUNT }}
export_default_credentials: true
- name: Upload report to test-reports bucket
if: (steps.run-tests.outcome == 'failure' || steps.run-tests.outcome == 'success') && github.ref == 'refs/heads/develop'
run: |
gsutil -h "Cache-Control: max-age=0, no-store" cp \
/tmp/coverage_report gs://${{ secrets.TEST_AUTOMATION_STORAGE_BUCKET }}/${{ github.event.repository.name }}/coverage_report
gsutil acl set project-private gs://${{ secrets.TEST_AUTOMATION_STORAGE_BUCKET }}/${{ github.event.repository.name }}/coverage_report
- name: Publish test coverage report
if: (steps.run-tests.outcome == 'failure' || steps.run-tests.outcome == 'success') && github.ref == 'refs/heads/develop'
uses: aurelien-baudet/workflow-dispatch@v2
with:
repo: netdata/cloud-workflows
ref: refs/heads/main
workflow: test_coverage_publisher.yml
token: ${{ secrets.TEST_AUTOMATION_TOKEN }}
inputs: '{ "service-name": "${{ github.event.repository.name }}"}'