Skip to content

Commit

Permalink
chore: update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
WomB0ComB0 committed Oct 2, 2024
1 parent 24f042c commit 0ca32a2
Show file tree
Hide file tree
Showing 11 changed files with 220 additions and 13 deletions.
11 changes: 7 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=
NEXT_PUBLIC_FIREBASE_APP_ID=
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID=
NEXT_PUBLIC_GOOGLE_MAPS_API_KEY=
NEXT_PUBLIC_GOOGLE_MAPS_API_KEY=
LIVEBLOCKS_API_KEY_PROD=
LIVEBLOCKS_API_KEY_DEV=
NEXT_PUBLIC_GOOGLE_MAPS_MAP_ID=
NEXT_PUBLIC_DISCORD_ID=
GITHUB_TOKEN=
WAKA_TIME_API_KEY=
Expand All @@ -33,10 +31,15 @@ SPOTIFY_CLIENT_SECRET=
SPOTIFY_REFRESH_TOKEN=
UMAMI_API_KEY=
SENTRY_AUTH_TOKEN=

NEXT_PUBLIC_HASHNODE_TOKEN=
REACT_EDITOR=
NEXT_PUBLIC_STRIPE_SECRET_KEY=
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=
NEXT_PUBLIC_STRIPE_WEBHOOK_SECRET=
NEXT_PUBLIC_GCP_PROJECT_ID=
NEXT_PUBLIC_GCP_PRIVATE_KEY_ID=
NEXT_PUBLIC_GCP_PRIVATE_KEY=
NEXT_PUBLIC_GCP_CLIENT_EMAIL=
NEXT_PUBLIC_GCP_CLIENT_ID=
NEXT_PUBLIC_GCP_CLIENT_X509_CERT_URL=
NEXT_PUBLIC_LIVEBLOCKS_PUBLIC_KEY=
31 changes: 31 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,37 @@ jobs:
code:
name: Lint
runs-on: ubuntu-latest
env:
NODE_ENV: ${{ secrets.NODE_ENV }}
NEXT_PUBLIC_FIREBASE_API_KEY: ${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }}
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: ${{ secrets.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN }}
NEXT_PUBLIC_FIREBASE_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_PROJECT_ID }}
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET: ${{ secrets.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET }}
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID }}
NEXT_PUBLIC_FIREBASE_APP_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_APP_ID }}
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID }}
NEXT_PUBLIC_GOOGLE_MAPS_API_KEY: ${{ secrets.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY }}
NEXT_PUBLIC_GOOGLE_MAPS_MAP_ID: ${{ secrets.NEXT_PUBLIC_GOOGLE_MAPS_MAP_ID }}
NEXT_PUBLIC_DISCORD_ID: ${{ secrets.NEXT_PUBLIC_DISCORD_ID }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WAKA_TIME_API_KEY: ${{ secrets.WAKA_TIME_API_KEY }}
SPOTIFY_CLIENT_ID: ${{ secrets.SPOTIFY_CLIENT_ID }}
SPOTIFY_CLIENT_SECRET: ${{ secrets.SPOTIFY_CLIENT_SECRET }}
SPOTIFY_REFRESH_TOKEN: ${{ secrets.SPOTIFY_REFRESH_TOKEN }}
UMAMI_API_KEY: ${{ secrets.UMAMI_API_KEY }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
NEXT_PUBLIC_HASHNODE_TOKEN: ${{ secrets.NEXT_PUBLIC_HASHNODE_TOKEN }}
REACT_EDITOR: ${{ secrets.REACT_EDITOR }}
NEXT_PUBLIC_STRIPE_SECRET_KEY: ${{ secrets.NEXT_PUBLIC_STRIPE_SECRET_KEY }}
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: ${{ secrets.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY }}
NEXT_PUBLIC_STRIPE_WEBHOOK_SECRET: ${{ secrets.NEXT_PUBLIC_STRIPE_WEBHOOK_SECRET }}
NEXT_PUBLIC_GCP_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_GCP_PROJECT_ID }}
NEXT_PUBLIC_GCP_PRIVATE_KEY_ID: ${{ secrets.NEXT_PUBLIC_GCP_PRIVATE_KEY_ID }}
NEXT_PUBLIC_GCP_PRIVATE_KEY: ${{ secrets.NEXT_PUBLIC_GCP_PRIVATE_KEY }}
NEXT_PUBLIC_GCP_CLIENT_EMAIL: ${{ secrets.NEXT_PUBLIC_GCP_CLIENT_EMAIL }}
NEXT_PUBLIC_GCP_CLIENT_ID: ${{ secrets.NEXT_PUBLIC_GCP_CLIENT_ID }}
NEXT_PUBLIC_GCP_CLIENT_X509_CERT_URL: ${{ secrets.NEXT_PUBLIC_GCP_CLIENT_X509_CERT_URL }}
NEXT_PUBLIC_LIVEBLOCKS_PUBLIC_KEY: ${{ secrets.NEXT_PUBLIC_LIVEBLOCKS_PUBLIC_KEY }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/nextjs_bundle_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,36 @@ jobs:
analyze:
env:
SKIP_ENV_VALIDATION: true
NODE_ENV: ${{ secrets.NODE_ENV }}
NEXT_PUBLIC_FIREBASE_API_KEY: ${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }}
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: ${{ secrets.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN }}
NEXT_PUBLIC_FIREBASE_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_PROJECT_ID }}
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET: ${{ secrets.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET }}
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID }}
NEXT_PUBLIC_FIREBASE_APP_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_APP_ID }}
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID }}
NEXT_PUBLIC_GOOGLE_MAPS_API_KEY: ${{ secrets.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY }}
NEXT_PUBLIC_GOOGLE_MAPS_MAP_ID: ${{ secrets.NEXT_PUBLIC_GOOGLE_MAPS_MAP_ID }}
NEXT_PUBLIC_DISCORD_ID: ${{ secrets.NEXT_PUBLIC_DISCORD_ID }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WAKA_TIME_API_KEY: ${{ secrets.WAKA_TIME_API_KEY }}
SPOTIFY_CLIENT_ID: ${{ secrets.SPOTIFY_CLIENT_ID }}
SPOTIFY_CLIENT_SECRET: ${{ secrets.SPOTIFY_CLIENT_SECRET }}
SPOTIFY_REFRESH_TOKEN: ${{ secrets.SPOTIFY_REFRESH_TOKEN }}
UMAMI_API_KEY: ${{ secrets.UMAMI_API_KEY }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
NEXT_PUBLIC_HASHNODE_TOKEN: ${{ secrets.NEXT_PUBLIC_HASHNODE_TOKEN }}
REACT_EDITOR: ${{ secrets.REACT_EDITOR }}
NEXT_PUBLIC_STRIPE_SECRET_KEY: ${{ secrets.NEXT_PUBLIC_STRIPE_SECRET_KEY }}
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: ${{ secrets.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY }}
NEXT_PUBLIC_STRIPE_WEBHOOK_SECRET: ${{ secrets.NEXT_PUBLIC_STRIPE_WEBHOOK_SECRET }}
NEXT_PUBLIC_GCP_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_GCP_PROJECT_ID }}
NEXT_PUBLIC_GCP_PRIVATE_KEY_ID: ${{ secrets.NEXT_PUBLIC_GCP_PRIVATE_KEY_ID }}
NEXT_PUBLIC_GCP_PRIVATE_KEY: ${{ secrets.NEXT_PUBLIC_GCP_PRIVATE_KEY }}
NEXT_PUBLIC_GCP_CLIENT_EMAIL: ${{ secrets.NEXT_PUBLIC_GCP_CLIENT_EMAIL }}
NEXT_PUBLIC_GCP_CLIENT_ID: ${{ secrets.NEXT_PUBLIC_GCP_CLIENT_ID }}
NEXT_PUBLIC_GCP_CLIENT_X509_CERT_URL: ${{ secrets.NEXT_PUBLIC_GCP_CLIENT_X509_CERT_URL }}
NEXT_PUBLIC_LIVEBLOCKS_PUBLIC_KEY: ${{ secrets.NEXT_PUBLIC_LIVEBLOCKS_PUBLIC_KEY }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,37 @@ jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
env:
NODE_ENV: ${{ secrets.NODE_ENV }}
NEXT_PUBLIC_FIREBASE_API_KEY: ${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }}
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: ${{ secrets.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN }}
NEXT_PUBLIC_FIREBASE_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_PROJECT_ID }}
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET: ${{ secrets.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET }}
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID }}
NEXT_PUBLIC_FIREBASE_APP_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_APP_ID }}
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID }}
NEXT_PUBLIC_GOOGLE_MAPS_API_KEY: ${{ secrets.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY }}
NEXT_PUBLIC_GOOGLE_MAPS_MAP_ID: ${{ secrets.NEXT_PUBLIC_GOOGLE_MAPS_MAP_ID }}
NEXT_PUBLIC_DISCORD_ID: ${{ secrets.NEXT_PUBLIC_DISCORD_ID }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WAKA_TIME_API_KEY: ${{ secrets.WAKA_TIME_API_KEY }}
SPOTIFY_CLIENT_ID: ${{ secrets.SPOTIFY_CLIENT_ID }}
SPOTIFY_CLIENT_SECRET: ${{ secrets.SPOTIFY_CLIENT_SECRET }}
SPOTIFY_REFRESH_TOKEN: ${{ secrets.SPOTIFY_REFRESH_TOKEN }}
UMAMI_API_KEY: ${{ secrets.UMAMI_API_KEY }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
NEXT_PUBLIC_HASHNODE_TOKEN: ${{ secrets.NEXT_PUBLIC_HASHNODE_TOKEN }}
REACT_EDITOR: ${{ secrets.REACT_EDITOR }}
NEXT_PUBLIC_STRIPE_SECRET_KEY: ${{ secrets.NEXT_PUBLIC_STRIPE_SECRET_KEY }}
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: ${{ secrets.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY }}
NEXT_PUBLIC_STRIPE_WEBHOOK_SECRET: ${{ secrets.NEXT_PUBLIC_STRIPE_WEBHOOK_SECRET }}
NEXT_PUBLIC_GCP_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_GCP_PROJECT_ID }}
NEXT_PUBLIC_GCP_PRIVATE_KEY_ID: ${{ secrets.NEXT_PUBLIC_GCP_PRIVATE_KEY_ID }}
NEXT_PUBLIC_GCP_PRIVATE_KEY: ${{ secrets.NEXT_PUBLIC_GCP_PRIVATE_KEY }}
NEXT_PUBLIC_GCP_CLIENT_EMAIL: ${{ secrets.NEXT_PUBLIC_GCP_CLIENT_EMAIL }}
NEXT_PUBLIC_GCP_CLIENT_ID: ${{ secrets.NEXT_PUBLIC_GCP_CLIENT_ID }}
NEXT_PUBLIC_GCP_CLIENT_X509_CERT_URL: ${{ secrets.NEXT_PUBLIC_GCP_CLIENT_X509_CERT_URL }}
NEXT_PUBLIC_LIVEBLOCKS_PUBLIC_KEY: ${{ secrets.NEXT_PUBLIC_LIVEBLOCKS_PUBLIC_KEY }}
steps:
- uses: actions/checkout@v4
- name: Setup Bun
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: ⚡ Testing

on:
push:
branches: ["main"]
branches: ["master"]
pull_request:
branches: ["main"]
branches: ["master"]

concurrency:
cancel-in-progress: true
Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
"gen": "graphql-codegen --config codegen.yml",
"lint": "bunx biome check --write ./ || true && bunx stylelint src/styles/**/*.{css,scss,sass} --fix",
"start": "next start",
"type": "tsc --noEmit"
"type": "tsc --noEmit",
"test": "vitest run",
"e2e:ci": "bun run e2e:install && bunx playwright test --project=chromium",
"e2e:install": "bunx playwright install"
},
"dependencies": {
"@biomejs/biome": "1.9.2",
Expand Down Expand Up @@ -92,7 +95,7 @@
"tailwind-merge": "^2.5.2",
"tailwindcss-animate": "^1.0.7",
"uvcanvas": "^0.2.1",
"vitest": "^2.1.1",
"vitest": "^2.1.2",
"zod": "^3.23.8",
"zustand": "^4.5.5"
},
Expand All @@ -111,6 +114,7 @@
"@types/react": "^18.3.10",
"@types/react-dom": "^18.3.0",
"cross-env": "^7.0.3",
"jsdom": "^25.0.1",
"postcss": "^8.4.47",
"tailwindcss": "^3.4.13",
"typescript": "^5.6.2"
Expand Down
68 changes: 68 additions & 0 deletions playwright-report/index.html

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions src/e2e/example.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { expect, test } from '@playwright/test';
import { test, expect } from '@playwright/test';

test('has title', async ({ page }) => {
await page.goto('./');
test('visit page and take screenshot', async ({ page }) => {
const targetUrl = process.env.ENVIRONMENT_URL || 'https://www.mikeodnis.dev'

await expect(page).toHaveTitle(/Mike Odnis/);
});
const response = await page.goto(targetUrl)

expect(response.status(),'should respond with correct status code').toBeLessThan(400)

await page.screenshot({ path: 'screenshot.jpg' })
})
30 changes: 30 additions & 0 deletions src/lib/fetcher.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { describe, it, expect, vi } from 'vitest';
import axios from 'axios';
import fetcher from './fetcher';

// Mock the axios module
vi.mock('axios');

describe('fetcher', () => {
it('should fetch data successfully', async () => {
// Arrange: mock axios.get to return a resolved promise with some data
const mockData = { id: 1, name: 'Test' };
(axios.get as any).mockResolvedValueOnce({ data: mockData });

// Act: call the fetcher function
const result = await fetcher<{ id: number; name: string }>('https://api.example.com/data');

// Assert: verify the function returns the expected data
expect(result).toEqual(mockData);
expect(axios.get).toHaveBeenCalledWith('https://api.example.com/data', undefined);
});

it('should handle axios errors', async () => {
// Arrange: mock axios.get to reject with an error
const mockError = new Error('Network Error');
(axios.get as any).mockRejectedValueOnce(mockError);

// Act & Assert: verify that the fetcher function throws the same error
await expect(fetcher('https://api.example.com/data')).rejects.toThrow('Network Error');
});
});
3 changes: 3 additions & 0 deletions test-results/.last-run.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"status": "interrupted"
}
3 changes: 3 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@ export default defineConfig({
plugins: [react()],
test: {
environment: 'jsdom',
exclude: ['src/e2e/**', 'node_modules'],

},
});

0 comments on commit 0ca32a2

Please sign in to comment.