From b492d8f62f85502168a2aa474a7b95cc921cace3 Mon Sep 17 00:00:00 2001 From: JT2M0L3Y Date: Fri, 3 Jul 2026 11:07:20 -0700 Subject: [PATCH] switch coverage to codecov --- .github/workflows/build.yml | 14 +++++++------ .github/workflows/coverage.yml | 38 ++++++++++++++++------------------ .github/workflows/deploy.yml | 12 +++++------ .github/workflows/test.yml | 8 ++++--- README.md | 2 +- vitest.config.ts | 5 +++-- 6 files changed, 40 insertions(+), 39 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0b161a4..f48f87e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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: | diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index ce650ba..00eadb0 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -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 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 4291c7e..ec4988c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c7a4a4b..ada25d1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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: | diff --git a/README.md b/README.md index 4890ff8..dc4b0b0 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Builds Tests - Code Coverage + coverage ## About/Goals diff --git a/vitest.config.ts b/vitest.config.ts index 0ecac27..1a2df01 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -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' } } }) \ No newline at end of file