Skip to content

Commit

Permalink
adding tests to ci
Browse files Browse the repository at this point in the history
  • Loading branch information
mohit2152sharma committed Dec 19, 2024
1 parent 5771c08 commit 21f7836
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 43 deletions.
54 changes: 14 additions & 40 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,60 +1,34 @@
# File: .github/workflows/publish.yml
# TODO: Add setup to run tests and linting in ci
name: publish-to-github-pages
name: Deploy to dokploy
on:
push:
branches:
- main

permissions:
contents: read
pages: write
id-token: write
pull_request:
workflow_dispatch:

env:
NODE_ENV: production

concurrency:
group: 'pages'
cancel-in-progress: false
group: ${{ github.ref }}
cancel-in-progress: true

jobs:
build:
test:
runs-on: ubuntu-latest

permissions:
contents: read
pull-requests: write
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4

- name: Setup Node.js ⚙️ - Cache dependencies ⚡ - Install dependencies 🔧
uses: ./.github/workflows/setup-node
with:
working-directory: longpost
node-env: ${{ env.NODE_ENV }}

- name: Setup Pages ⚙️
uses: actions/configure-pages@v4
with:
static_site_generator: next

- name: Build with Next.js 🏗️
run: npx next build
working-directory: longpost

- name: Upload artifact 📡
uses: actions/upload-pages-artifact@v3
with:
path: longpost/out

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
needs: build

steps:
- name: Publish to GitHub Pages 🚀
id: deployment
uses: actions/deploy-pages@v4
- name: Run tests
run: npx vitest --coverage.enabled true
- name: Report converage
if: always()
uses: davelosert/vitest-coverage-report-action@v2
Empty file.
5 changes: 3 additions & 2 deletions .github/workflows/setup-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ description: 'Setup Node.js ⚙️ - Cache dependencies ⚡ - Install dependenci
inputs:
working-directory:
description: 'Working directory'
required: true
required: false
default: '.'
node-env:
description: 'Node Environment'
required: false
Expand All @@ -14,7 +15,7 @@ runs:
- name: Setup Node.js ⚙️
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22.10.0

- name: Install pnpm
uses: pnpm/action-setup@v4
Expand Down
6 changes: 5 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ export default defineConfig({
plugins: [sveltekit()],

test: {
include: ['src/**/*.{test,spec}.{js,ts}', 'tests/**/*.{test,spec}.{js,ts}']
include: ['src/**/*.{test,spec}.{js,ts}', 'tests/**/*.{test,spec}.{js,ts}'],
coverage: {
reporter: ['text', 'json-summary', 'json'],
reportOnFailure: true
}
}
});

0 comments on commit 21f7836

Please sign in to comment.