mirror of
https://github.com/kevinthedang/discord-ollama.git
synced 2026-08-08 23:54:01 -04:00
57 lines
1.5 KiB
YAML
57 lines
1.5 KiB
YAML
name: Coverage
|
|
run-name: Code Coverage
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
types: [opened, synchronize, reopened, closed]
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
Discord-Node-Coverage:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 2
|
|
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Node Environment
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: lts/jod
|
|
cache: npm
|
|
|
|
- name: Install Project Dependencies
|
|
run: npm install
|
|
|
|
- name: Create Environment Variables
|
|
run: |
|
|
touch .env
|
|
echo CLIENT_TOKEN = ${{ secrets.BOT_TOKEN }} >> .env
|
|
echo OLLAMA_IP = ${{ secrets.OLLAMA_IP }} >> .env
|
|
echo OLLAMA_PORT = ${{ secrets.OLLAMA_PORT }} >> .env
|
|
echo MODEL = ${{ secrets.MODEL }} >> .env
|
|
|
|
- name: Run tests with coverage
|
|
run: npm run coverage
|
|
|
|
- name: Generate coverage badge
|
|
uses: wjervis7/vitest-badge-action@v1.0.0
|
|
if: success() || failure()
|
|
with:
|
|
result-type: statements
|
|
badge-text: 'Coverage (Statements)'
|
|
badge-path: ./imgs/coverage.svg
|
|
upload-badge: false
|
|
|
|
- name: Commit badge with merge
|
|
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
|
|
uses: stefanzweifel/git-auto-commit-action@v7
|
|
with:
|
|
file_pattern: ./imgs/coverage.svg
|
|
commit_message: 'update with coverage badge'
|