ci: reorganize workflow dependencies and remove standalone test workflow
This commit is contained in:
parent
8046f8b324
commit
fdc94b16ac
5 changed files with 23 additions and 92 deletions
3
.github/workflows/deploy.yml
vendored
3
.github/workflows/deploy.yml
vendored
|
|
@ -74,6 +74,7 @@ jobs:
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: 🐳 Build
|
name: 🐳 Build
|
||||||
|
needs: [test, typecheck]
|
||||||
# only build/deploy main branch on pushes
|
# only build/deploy main branch on pushes
|
||||||
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
|
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
@ -127,7 +128,7 @@ jobs:
|
||||||
deploy:
|
deploy:
|
||||||
name: 🚀 Deploy
|
name: 🚀 Deploy
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [test, typecheck, build]
|
needs: [build]
|
||||||
# only deploy main/dev branch on pushes
|
# only deploy main/dev branch on pushes
|
||||||
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
|
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
|
||||||
|
|
||||||
|
|
|
||||||
90
.github/workflows/test.yml
vendored
90
.github/workflows/test.yml
vendored
|
|
@ -1,90 +0,0 @@
|
||||||
name: Test
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- develop
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- develop
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
name: Run Tests
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
services:
|
|
||||||
postgres:
|
|
||||||
image: postgres:15
|
|
||||||
env:
|
|
||||||
POSTGRES_USER: test
|
|
||||||
POSTGRES_PASSWORD: test
|
|
||||||
POSTGRES_DB: brackt_test
|
|
||||||
options: >-
|
|
||||||
--health-cmd pg_isready
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
ports:
|
|
||||||
- 5432:5432
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: '20'
|
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Run type check
|
|
||||||
run: npm run typecheck
|
|
||||||
continue-on-error: true
|
|
||||||
|
|
||||||
- name: Run unit tests
|
|
||||||
run: npm run test:run
|
|
||||||
env:
|
|
||||||
DATABASE_URL: postgresql://test:test@localhost:5432/brackt_test
|
|
||||||
|
|
||||||
- name: Upload test coverage
|
|
||||||
uses: codecov/codecov-action@v3
|
|
||||||
if: always()
|
|
||||||
with:
|
|
||||||
files: ./coverage/coverage-final.json
|
|
||||||
flags: unittests
|
|
||||||
continue-on-error: true
|
|
||||||
|
|
||||||
- name: Comment test results on PR
|
|
||||||
uses: actions/github-script@v7
|
|
||||||
if: github.event_name == 'pull_request' && always()
|
|
||||||
with:
|
|
||||||
script: |
|
|
||||||
const fs = require('fs');
|
|
||||||
let coverageComment = '## ✅ Tests Passed\n\n';
|
|
||||||
|
|
||||||
try {
|
|
||||||
const coverage = JSON.parse(fs.readFileSync('./coverage/coverage-summary.json', 'utf8'));
|
|
||||||
const total = coverage.total;
|
|
||||||
|
|
||||||
coverageComment += '**Coverage:**\n';
|
|
||||||
coverageComment += `- Lines: ${total.lines.pct}%\n`;
|
|
||||||
coverageComment += `- Statements: ${total.statements.pct}%\n`;
|
|
||||||
coverageComment += `- Functions: ${total.functions.pct}%\n`;
|
|
||||||
coverageComment += `- Branches: ${total.branches.pct}%\n`;
|
|
||||||
} catch (error) {
|
|
||||||
coverageComment += 'Coverage report not available.\n';
|
|
||||||
}
|
|
||||||
|
|
||||||
github.rest.issues.createComment({
|
|
||||||
issue_number: context.issue.number,
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
body: coverageComment
|
|
||||||
});
|
|
||||||
continue-on-error: true
|
|
||||||
|
|
@ -10,7 +10,8 @@ describe('Utils', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle conditional classes', () => {
|
it('should handle conditional classes', () => {
|
||||||
const result = cn('foo', false && 'bar', 'baz');
|
const condition = false;
|
||||||
|
const result = cn('foo', condition && 'bar', 'baz');
|
||||||
expect(result).toContain('foo');
|
expect(result).toContain('foo');
|
||||||
expect(result).toContain('baz');
|
expect(result).toContain('baz');
|
||||||
expect(result).not.toContain('bar');
|
expect(result).not.toContain('bar');
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,7 @@ export async function findLeaguesWithActiveSeasonsByUserId(
|
||||||
name: schema.leagues.name,
|
name: schema.leagues.name,
|
||||||
createdBy: schema.leagues.createdBy,
|
createdBy: schema.leagues.createdBy,
|
||||||
currentSeasonId: schema.leagues.currentSeasonId,
|
currentSeasonId: schema.leagues.currentSeasonId,
|
||||||
|
isPublicDraftBoard: schema.leagues.isPublicDraftBoard,
|
||||||
createdAt: schema.leagues.createdAt,
|
createdAt: schema.leagues.createdAt,
|
||||||
updatedAt: schema.leagues.updatedAt,
|
updatedAt: schema.leagues.updatedAt,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
18
cypress/tsconfig.json
Normal file
18
cypress/tsconfig.json
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2020",
|
||||||
|
"lib": ["ES2020", "DOM"],
|
||||||
|
"types": ["cypress", "@testing-library/cypress"],
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"strict": true,
|
||||||
|
"noEmit": true
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"**/*.ts",
|
||||||
|
"**/*.tsx"
|
||||||
|
]
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue