mirror of
https://github.com/kevinthedang/discord-ollama.git
synced 2026-08-08 23:54:01 -04:00
switch coverage to codecov
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
name: Builds
|
||||
run-name: Validate Node and Docker Builds
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
@@ -9,15 +10,16 @@ jobs:
|
||||
Discord-Node-Build: # test if the node install and run
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 2
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node Environment lts/jod
|
||||
- name: Set up Node Environment
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: lts/jod
|
||||
cache: "npm"
|
||||
node-version: current
|
||||
cache: npm
|
||||
|
||||
- name: Install Project Dependencies
|
||||
run: |
|
||||
@@ -48,11 +50,11 @@ jobs:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node Environment lts/jod
|
||||
- name: Set up Node Environment
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: lts/jod
|
||||
cache: "npm"
|
||||
node-version: current
|
||||
cache: npm
|
||||
|
||||
- name: Create Environment Variables
|
||||
run: |
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
name: Coverage
|
||||
run-name: Code Coverage
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
@@ -10,19 +14,19 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
environment: coverage
|
||||
timeout-minutes: 2
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node Environment lts/jod
|
||||
- name: Set up Node Environment
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: lts/jod
|
||||
cache: "npm"
|
||||
node-version: current
|
||||
cache: npm
|
||||
|
||||
- name: Install Project Dependencies
|
||||
run: |
|
||||
npm install
|
||||
run: npm install
|
||||
|
||||
- name: Create Environment Variables
|
||||
run: |
|
||||
@@ -32,19 +36,13 @@ jobs:
|
||||
echo OLLAMA_PORT = ${{ secrets.OLLAMA_PORT }} >> .env
|
||||
echo MODEL = ${{ secrets.MODEL }} >> .env
|
||||
|
||||
- name: Collect Code Coverage
|
||||
run: |
|
||||
LINE_PCT=$(npm run coverage | tail -2 | head -1 | awk '{print $3}')
|
||||
echo "COVERAGE=$LINE_PCT" >> $GITHUB_ENV
|
||||
|
||||
- name: Upload Code Coverage
|
||||
uses: schneegans/dynamic-badges-action@v1.7.0
|
||||
- name: Run tests with coverage
|
||||
run: npm run coverage
|
||||
|
||||
- name: Upload Coverage to Codecov
|
||||
id: codecov
|
||||
uses: codecov/codecov-action@v5
|
||||
with:
|
||||
auth: ${{ secrets.GIST_SECRET }}
|
||||
gistID: ${{ vars.GIST_ID }}
|
||||
filename: coverage.json
|
||||
label: Coverage
|
||||
message: ${{ env.COVERAGE }}
|
||||
valColorRange: ${{ env.COVERAGE }}
|
||||
maxColorRange: 100
|
||||
minColorRange: 0
|
||||
files: coverage/lcov.info
|
||||
fail_ci_if_error: true
|
||||
continue-on-error: true
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
name: Deploy
|
||||
run-name: Deploy Application Latest
|
||||
# on:
|
||||
# push:
|
||||
# tags:
|
||||
# - 'v*'
|
||||
|
||||
on: workflow_dispatch
|
||||
|
||||
jobs:
|
||||
@@ -11,6 +8,7 @@ jobs:
|
||||
runs-on: self-hosted
|
||||
environment: deploy
|
||||
timeout-minutes: 5
|
||||
|
||||
steps:
|
||||
- name: Checkout Repo
|
||||
uses: actions/checkout@v4
|
||||
@@ -40,14 +38,14 @@ jobs:
|
||||
git clone https://github.com/kevinthedang/discord-ollama.git ${{ secrets.PATH }}
|
||||
cd ${{ secrets.PATH }}
|
||||
|
||||
- name: Install nvm and Node.js lts/jod
|
||||
- name: Install nvm and Node.js
|
||||
run: |
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||
echo "NVM installed successfully."
|
||||
nvm install lts/jod
|
||||
nvm alias default lts/jod
|
||||
nvm install current
|
||||
nvm alias default current
|
||||
node -v
|
||||
npm -v
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
name: Tests
|
||||
run-name: Unit Tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
@@ -21,15 +22,16 @@ jobs:
|
||||
Discord-Node-Test:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 2
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node Environment lts/jod
|
||||
- name: Set up Node Environment
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: lts/jod
|
||||
cache: "npm"
|
||||
node-version: current
|
||||
cache: npm
|
||||
|
||||
- name: Install Project Dependencies
|
||||
run: |
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<a href="#"></a><a href="https://github.com/kevinthedang/discord-ollama/actions/workflows/build.yml"><img alt="Builds" src="https://github.com/kevinthedang/discord-ollama/actions/workflows/build.yml/badge.svg" /></a>
|
||||
<!-- <a href="#"></a><a href="https://github.com/kevinthedang/discord-ollama/actions/workflows/deploy.yml"><img alt="Deploy Status" src="https://github.com/kevinthedang/discord-ollama/actions/workflows/deploy.yml/badge.svg" /></a> -->
|
||||
<a href="#"></a><a href="https://github.com/kevinthedang/discord-ollama/actions/workflows/test.yml"><img alt="Tests" src="https://github.com/kevinthedang/discord-ollama/actions/workflows/test.yml/badge.svg" /></a>
|
||||
<a href="#"></a><a href="https://github.com/kevinthedang/discord-ollama/actions/workflows/coverage.yml"><img alt="Code Coverage" src="https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/kevinthedang/bc7b5dcfa16561ab02bb3df67a99b22d/raw/coverage.json"></a>
|
||||
<a href="https://codecov.io/gh/kevinthedang/discord-ollama"><img src="https://img.shields.io/codecov/c/github/kevinthedang/discord-ollama?logo=codecov" alt="coverage" /></a>
|
||||
</div>
|
||||
|
||||
## About/Goals
|
||||
|
||||
+3
-2
@@ -6,8 +6,9 @@ export default defineConfig({
|
||||
globals: true, // <-- reduces test file imports
|
||||
reporters: ['verbose'], // <-- verbose output
|
||||
coverage: {
|
||||
exclude: [...configDefaults.exclude, 'build/*', 'tests/*'], // <-- exclude JS build
|
||||
reporter: ['text-summary'] // <-- report in text-summary
|
||||
include: ['src/**/*.ts'],
|
||||
reporter: 'lcov',
|
||||
reportsDirectory: './coverage'
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user