Skip to content

refactor: truncate user names in comment section #1009

refactor: truncate user names in comment section

refactor: truncate user names in comment section #1009

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
NEXT_PUBLIC_SITE_URL: ${{ secrets.NEXT_PUBLIC_SITE_URL }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
UPSTASH_REDIS_REST_URL: ${{ secrets.UPSTASH_REDIS_REST_URL }}
UPSTASH_REDIS_REST_TOKEN: ${{ secrets.UPSTASH_REDIS_REST_TOKEN }}
IP_ADDRESS_SALT: ${{ secrets.IP_ADDRESS_SALT }}
BETTER_AUTH_SECRET: ${{ secrets.BETTER_AUTH_SECRET }}
GITHUB_CLIENT_ID: ${{ secrets.GH_CLIENT_ID }}
GITHUB_CLIENT_SECRET: ${{ secrets.GH_CLIENT_SECRET }}
jobs:
tests:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Configure environment
uses: ./.github/actions/setup
- name: Run unit tests
run: pnpm test:unit
eslint:
name: ESLint
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Configure environment
uses: ./.github/actions/setup
- name: Run ESLint
run: pnpm lint
types:
name: TypeScript
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Configure environment
uses: ./.github/actions/setup
- name: Run type check
run: pnpm type-check
prettier:
name: Prettier
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Configure environment
uses: ./.github/actions/setup
- name: Run Prettier format check
run: pnpm format:check
spelling:
name: Spelling
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Configure environment
uses: ./.github/actions/setup
- name: Run spelling check
run: pnpm check:spelling
knip:
name: Knip
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Configure environment
uses: ./.github/actions/setup
- name: Run Knip
run: pnpm check:knip
i18n:
name: i18n
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Configure environment
uses: ./.github/actions/setup
- name: Run i18n check
run: pnpm check:i18n
e2e:
name: End-to-end tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Configure environment
uses: ./.github/actions/setup
- name: Install Playwright with dependencies
run: pnpm playwright install --with-deps chromium --only-shell
- name: Create test posts and copy dummy images
run: |
mkdir -p apps/web/src/content/blog/en/
mkdir -p apps/web/public/images/blog/
frontmatter() {
local title="$1"
local slug="$2"
local display_title="${title//_/ }"
cat << EOF
---
title: $display_title
date: '1970-01-01T00:00:00Z'
modifiedTime: '1970-01-01T00:00:00Z'
summary: This is a test post.
---
This is a test post.
EOF
}
dummy_image_path="apps/web/public/images/dummy.png"
if [ ! -f "$dummy_image_path" ]; then
echo "Error: Dummy image not found at $dummy_image_path"
exit 1
fi
titles=("Test_Submit_Comment" "Test_Delete_Comment" "Test_Reply_Comment" "Test_Delete_Reply" "Test_View_Post" "Test_Like_Post")
slugs=("test-submit" "test-delete" "test-reply" "test-delete-reply" "test-view" "test-like")
for i in "${!titles[@]}"; do
title="${titles[$i]}"
slug="${slugs[$i]}"
post_path="apps/web/src/content/blog/en/$slug.mdx"
cover_dir="apps/web/public/images/blog/$slug"
cover_path="$cover_dir/cover.png"
frontmatter "$title" "$slug" > "$post_path"
if [ -f "$post_path" ]; then
echo "Successfully created test post at $post_path"
else
echo "Error: Failed to create test post at $post_path"
exit 1
fi
mkdir -p "$cover_dir"
cp "$dummy_image_path" "$cover_path"
if [ -f "$cover_path" ]; then
echo "Successfully copied dummy image to $cover_path"
else
echo "Error: Failed to copy dummy image to $cover_path"
exit 1
fi
done
- name: Build apps
run: pnpm build:apps
- name: Run services
run: docker compose up -d
- name: Migrate database
run: pnpm db:migrate
- name: Seed database
run: pnpm db:seed
- name: Run Playwright tests
run: pnpm test:e2e
- name: Upload Playwright report
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: apps/web/playwright-report/
retention-days: 30