Skip to content

Commit

Permalink
ci: add codecov
Browse files Browse the repository at this point in the history
Добавляем codecov
  • Loading branch information
SevereCloud committed Jan 10, 2023
1 parent bec2891 commit 2a400c1
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 119 deletions.
46 changes: 0 additions & 46 deletions .github/actions/reporter/src/coverage.ts

This file was deleted.

2 changes: 0 additions & 2 deletions .github/actions/reporter/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { GitHubCommentBuilder } from './comment';
import { checkFailedScreenTests } from './checkFailedScreenTests';
import { jest } from './jest';
import { lint } from './lint';
import { coverage } from './coverage';
import { checkUpdatedScreenshots } from './checkUpdatedScreenshots';
import { uploadFailedScreenshots } from './uploadFailedScreenshots';

Expand All @@ -21,7 +20,6 @@ async function run(): Promise<void> {
await Promise.all([
jest(path.join(process.cwd(), 'test-results.json')),
lint(path.join(process.cwd(), 'lint-results.json')),
coverage(path.join(process.cwd(), 'coverage', 'coverage-summary.json'), comment),
uploadFailedScreenshots(comment, gh),
checkFailedScreenTests(path.join(process.cwd(), 'e2e-results.json')),
checkUpdatedScreenshots(gh),
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/branch_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: 'Branch test'

run-name: Test ${{ github.ref_name }}

on:
push:
branches:
- master
- '*-stable'

concurrency:
group: test-${{ github.ref_name }}
cancel-in-progress: true

jobs:
test:
uses: ./.github/workflows/workflow_test.yml

test_e2e:
uses: ./.github/workflows/workflow_test_e2e.yml
79 changes: 8 additions & 71 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,76 +20,15 @@ concurrency:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- run: yarn install --frozen-lockfile --ignore-scripts
- name: Run tests
run: yarn run test:ci
- name: Upload test artifact
uses: actions/upload-artifact@v3
if: always()
with:
name: test-output
path: |
.nyc_output/
lint-results.json
test-results.json
uses: ./.github/workflows/workflow_test.yml
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge

test_e2e:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
appearance: [dark, light]
browser: [chromium, firefox, webkit]
platform: [android, ios, vkcom]
exclude:
- platform: android
browser: firefox
- platform: android
browser: webkit
- platform: ios
browser: firefox
- platform: ios
browser: chromium
steps:
- uses: actions/checkout@v3
with:
lfs: true
ref: refs/pull/${{ github.event.pull_request.number }}/merge
- name: Checkout LFS objects
run: git lfs checkout
- name: Checkout base snapshots
run: git fetch --no-tags --depth=1 origin $GITHUB_BASE_REF && git checkout origin/$GITHUB_BASE_REF packages/vkui/src/**/__image_snapshots__/*.png
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- run: yarn install --frozen-lockfile --ignore-scripts
- name: Install deps for playwright
run: yarn run playwright:install ${{ matrix.browser }}
- name: FYI visual tests
run: yarn run test:e2e:ci
env:
APPEARANCE: ${{ matrix.appearance }}
BROWSER: ${{ matrix.browser }}
PLATFORM: ${{ matrix.platform }}
continue-on-error: true
- name: Upload test artifact
uses: actions/upload-artifact@v3
if: always()
with:
name: e2e-output
path: |
.nyc_output/
__diff_output__/
e2e-results.json
uses: ./.github/workflows/workflow_test_e2e.yml
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge

styleguide:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -186,8 +125,6 @@ jobs:
uses: actions/download-artifact@v3
with:
name: e2e-output
- name: Combine e2e & unit coverage
run: npx nyc report --reporter=json-summary

- run: yarn install --frozen-lockfile --ignore-scripts && yarn run build
working-directory: ./.github/actions/reporter
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/workflow_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
on:
workflow_call:
inputs:
ref:
description: 'The branch, tag or SHA to checkout'
default: ${{ github.ref }}
required: false
type: string

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- run: yarn install --frozen-lockfile --ignore-scripts

- name: Run tests
run: yarn run test:ci

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
flags: unittests
files: .nyc_output/coverage-final.json

- name: Upload test artifact
uses: actions/upload-artifact@v3
if: always()
with:
name: test-output
path: |
lint-results.json
test-results.json
65 changes: 65 additions & 0 deletions .github/workflows/workflow_test_e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
on:
workflow_call:
inputs:
ref:
description: 'The branch, tag or SHA to checkout'
default: ${{ github.ref }}
required: false
type: string

jobs:
test_e2e:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
appearance: [dark, light]
browser: [chromium, firefox, webkit]
platform: [android, ios, vkcom]
exclude:
- platform: android
browser: firefox
- platform: android
browser: webkit
- platform: ios
browser: firefox
- platform: ios
browser: chromium
steps:
- uses: actions/checkout@v3
with:
lfs: true
ref: ${{ inputs.ref }}
- name: Checkout LFS objects
run: git lfs checkout
- name: Checkout base snapshots
run: git fetch --no-tags --depth=1 origin $GITHUB_BASE_REF && git checkout origin/$GITHUB_BASE_REF packages/vkui/src/**/__image_snapshots__/*.png
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- run: yarn install --frozen-lockfile --ignore-scripts
- name: Install deps for playwright
run: yarn run playwright:install ${{ matrix.browser }}
- name: FYI visual tests
run: yarn run test:e2e:ci
env:
APPEARANCE: ${{ matrix.appearance }}
BROWSER: ${{ matrix.browser }}
PLATFORM: ${{ matrix.platform }}
continue-on-error: true

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
flags: e2e-${{ matrix.browser }}-${{ matrix.platform }}-${{ matrix.appearance }}
files: .nyc_output/coverage.json

- name: Upload test artifact
uses: actions/upload-artifact@v3
if: always()
with:
name: e2e-output
path: |
__diff_output__/
e2e-results.json

0 comments on commit 2a400c1

Please sign in to comment.