Skip to content

Commit

Permalink
add tests and new deploy action
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasheriques committed Jan 11, 2025
1 parent 7122abc commit 3cadf92
Show file tree
Hide file tree
Showing 8 changed files with 1,157 additions and 32 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Test and Block Deploy
on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

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

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test

- name: Block Deployment if Tests Fail
if: failure()
run: |
curl -X POST ${{ secrets.DEPLOY_HOOK_URL }} \
-H "Content-Type: application/json" \
-d '{"target":"preview", "state":"canceled"}'
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"get:articles": "node -r dotenv/config --loader ts-node/esm src/lib/generate-article-list.ts dotenv_config_path=.env.local",
"get:subs": "node src/scripts/get-subs.js",
"test": "vitest",
"test:ci": "vitest run",
"test:coverage": "vitest run --coverage"
},
"dependencies": {
Expand Down Expand Up @@ -78,21 +79,28 @@
},
"devDependencies": {
"@tailwindcss/typography": "^0.5.15",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.1.0",
"@testing-library/user-event": "^14.5.2",
"@types/node": "^20",
"@types/pako": "^2.0.3",
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/react-syntax-highlighter": "^15.5.13",
"@vitejs/plugin-react": "^4.3.4",
"@vitest/coverage-v8": "2.1.8",
"axios": "^1.7.9",
"dotenv": "^16.4.7",
"eslint": "^8",
"eslint-config-next": "15.0.2",
"jsdom": "^26.0.0",
"postcss": "^8",
"tailwind-scrollbar": "^3.1.0",
"tailwindcss": "^3.4.1",
"ts-node": "^10.9.2",
"typescript": "^5",
"vite-tsconfig-paths": "^5.1.4",
"vitest": "^2.1.8"
}
}
Loading

0 comments on commit 3cadf92

Please sign in to comment.