[25.07.26 / TASK-229] Feature - FE Git Action E2E CI 적용 #15
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Process E2E Testing | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
process-e2e-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 23 | |
- name: Install dependencies | |
run: | | |
npm install -g pnpm | |
pnpm install --frozen-lockfile | |
npx cypress install | |
- name: Create .env file for Testing | |
run: | | |
echo "NEXT_PUBLIC_BASE_URL=http://localhost:3000" >> .env | |
echo "NEXT_PUBLIC_CHANNELTALK_PLUGIN_KEY=sample_key" >> .env | |
echo "NEXT_PUBLIC_GA_ID=sample_id" >> .env | |
echo "NEXT_PUBLIC_SENTRY_AUTH_TOKEN=sample_token" >> .env | |
echo "NEXT_PUBLIC_SENTRY_DSN=sample_dsn" >> .env | |
- name: Start application server | |
run: | | |
pnpm dev & | |
env: | |
CI: true | |
- name: Wait for server | |
run: npx wait-on http://localhost:3000 --timeout 60000 | |
- name: Run Cypress tests | |
uses: cypress-io/github-action@v6 | |
with: | |
browser: chrome | |
headless: true | |
record: false | |
wait-on: 'http://localhost:3000' | |
wait-on-timeout: 120 | |
install: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NEXT_PUBLIC_BASE_URL: 'http://localhost:3000' | |
NEXT_PUBLIC_CHANNELTALK_PLUGIN_KEY: 'sample_key' | |
NEXT_PUBLIC_GA_ID: 'sample_id' | |
NEXT_PUBLIC_SENTRY_AUTH_TOKEN: 'sample_token' | |
NEXT_PUBLIC_SENTRY_DSN: 'sample_dsn' | |
- name: Upload screenshots | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: cypress-screenshots | |
path: cypress/screenshots | |
slackNotify: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Notify message to slack | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_WEBHOOK: ${{ secrets.GIT_ACTION_SLACK_WEBHOOK }} | |
SLACK_CHANNEL: ${{ secrets.GIT_ACTION_SLACK_CHANNEL }} | |
SLACK_COLOR: ${{ job.status }} # 또는 'green', '#ff00ff' 처럼 직접 색상 지정 | |
SLACK_USERNAME: Github | |
SLACK_ICON: https://cdn-icons-png.flaticon.com/512/25/25231.png | |
SLACK_TITLE: E2E Test | |
SLACK_MESSAGE: 'E2E CI 테스트가 실패했습니다. Artifact를 확인해주세요.' |