Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: codecov adjusments #8

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 91 additions & 39 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,22 @@ on:
pull_request:
branches:
- main

jobs:
lint:
prepare:
runs-on: ubuntu-latest
outputs:
store_path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
steps:
- uses: actions/checkout@v3

- name: Set node version to 18
- name: Set Node.js version
uses: actions/setup-node@v3
with:
node-version: 22

- uses: pnpm/action-setup@v2
name: Install pnpm
- name: Install pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
version: 10
Expand All @@ -31,68 +34,117 @@ jobs:
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
name: Setup pnpm cache
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
key: ${{ runner.os }}-node-22-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-node-22-pnpm-store-

- name: Install dependencies
run: pnpm install --frozen-lockfile

lint:
runs-on: ubuntu-latest
needs: prepare
steps:
- uses: actions/checkout@v3

- name: Set Node.js version
uses: actions/setup-node@v3
with:
node-version: 22

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 10

- name: Use pnpm cache
uses: actions/cache@v3
with:
path: ${{ needs.prepare.outputs.store_path }}
key: ${{ runner.os }}-node-22-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
${{ runner.os }}-node-22-pnpm-store-

- name: Installing modules
run: pnpm i
- name: Install dependencies
run: pnpm install --frozen-lockfile --offline

- name: Building module
run: pnpm build
- name: Run ESLint
run: pnpm lint

- name: Running eslint
run: npx eslint
typecheck:
runs-on: ubuntu-latest
needs: prepare
steps:
- uses: actions/checkout@v3

- name: Running typecheck
- name: Set Node.js version
uses: actions/setup-node@v3
with:
node-version: 22

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 10

- name: Use pnpm cache
uses: actions/cache@v3
with:
path: ${{ needs.prepare.outputs.store_path }}
key: ${{ runner.os }}-node-22-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-node-22-pnpm-store-

- name: Install dependencies
run: pnpm install --frozen-lockfile --offline

- name: Run TypeScript Typecheck
run: pnpm run typecheck

unit-test:
runs-on: ubuntu-latest

needs: prepare
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v3

- name: Setup Node.js
- name: Set Node.js version
uses: actions/setup-node@v3
with:
node-version: 22

- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 10
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
name: Setup pnpm cache
- name: Use pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
path: ${{ needs.prepare.outputs.store_path }}
key: ${{ runner.os }}-node-22-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
${{ runner.os }}-node-22-pnpm-store-

- name: Installing modules
run: pnpm i
- name: Install dependencies
run: pnpm install --frozen-lockfile --offline

- name: Running tests
- name: Run Tests with Coverage
run: pnpm run test:coverage

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
- name: Upload Coverage Reports
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
files: ./test-report.junit.xml
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./

- name: Upload Test Results
uses: codecov/test-results-action@v1
with:
fail_ci_if_error: true
files: ./coverage/cobertura-coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
104 changes: 104 additions & 0 deletions .github/workflows/ci.yml.bk
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: ci

on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set node version to 18
uses: actions/setup-node@v3
with:
node-version: 22

- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 10
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Installing modules
run: pnpm i

- name: Building module
run: pnpm build

- name: Running eslint
run: npx eslint

- name: Running typecheck
run: pnpm run typecheck

unit-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@master

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 22

- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 10
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Installing modules
run: pnpm i

- name: Running tests
run: pnpm run test:coverage

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
files: ./test-report.junit.xml
token: ${{ secrets.CODECOV_TOKEN }}

# - name: Upload test results to Codecov
# uses: codecov/test-results-action@v1
# with:
# fail_ci_if_error: true
# files: ./coverage/cobertura-coverage.xml
# token: ${{ secrets.CODECOV_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ coverage
.DS_Store
.idea
*.log
*.tgz
*.tgz
*junit.xml
3 changes: 2 additions & 1 deletion vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// vite.config.ts
import { defineConfig } from 'vitest/config'

export default defineConfig({
test: {
outputFile: './test-report.junit.xml',
reporters: ['junit'],
coverage: {
reporter: ['cobertura'],
},
Expand Down
Loading