-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: 별도의 job workflows 생성 - test, e2e, deploy-vercel
- Loading branch information
Showing
3 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Deploy to Vercel | ||
on: | ||
workflow_call: | ||
jobs: | ||
deploy-vercel: | ||
runs-on: ubuntu-latest | ||
env: | ||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | ||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install Vercel CLI | ||
run: npm install --global vercel@latest | ||
|
||
- name: Pull Vercel Environment Information | ||
run: | | ||
if [ "${{ github.ref }}" == "refs/heads/main" ]; then | ||
vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}; | ||
else | ||
vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}; | ||
fi | ||
- name: Build Project Artifacts | ||
run: | | ||
if [ "${{ github.ref }}" == "refs/heads/main" ]; then | ||
vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}; | ||
else | ||
vercel build --token=${{ secrets.VERCEL_TOKEN }}; | ||
fi | ||
- name: Deploy Project Artifacts to Vercel | ||
run: | | ||
if [ "${{ github.ref }}" == "refs/heads/main" ]; then | ||
vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}; | ||
else | ||
vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}; | ||
fi |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: End to End Test | ||
on: | ||
workflow_call: | ||
inputs: | ||
node-version: | ||
type: number | ||
required: false | ||
default: 20 | ||
env: | ||
type: choice | ||
required: true | ||
options: | ||
- dev | ||
- prod | ||
jobs: | ||
e2e: | ||
runs-on: ubuntu-latest | ||
env: | ||
APP_ENV: ${{ inputs.env }} | ||
NOTION_ROOT_PAGE_ID: ${{ secrets.NOTION_ROOT_PAGE_ID }} | ||
NOTION_ACTIVE_USER_ID: ${{ secrets.NOTION_ACTIVE_USER_ID }} | ||
NOTION_AUTH_TOKEN: ${{ secrets.NOTION_AUTH_TOKEN }} | ||
NOTION_API_TOKEN: ${{ secrets.NOTION_API_TOKEN }} | ||
NOTION_DB_ID: ${{ secrets.NOTION_DB_ID }} | ||
NOTION_PORTFOLIO_PAGE_ID: ${{ secrets.NOTION_PORTFOLIO_PAGE_ID }} | ||
BLOG_ODR_TOKEN: ${{ secrets.BLOG_ODR_TOKEN }} | ||
NEXT_PUBLIC_GA_ID: ${{ secrets.NEXT_PUBLIC_GA_ID }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ inputs.node-version }} | ||
cache: 'yarn' | ||
|
||
- name: Cache dependencies | ||
id: dependencies-cache | ||
uses: actions/cache@v3 | ||
with: | ||
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} | ||
path: '**/node_modules' | ||
restore-keys: | | ||
${{ runner.os }}-node- | ||
- name: Install Packages | ||
if: steps.dependencies-cache.outputs.cache-hit != 'true' | ||
run: yarn install | ||
|
||
- name: Build project | ||
run: yarn build | ||
|
||
- name: Install Playwright Browsers | ||
run: npx playwright install --with-deps | ||
|
||
- name: Start e2e test | ||
run: | | ||
echo "APP_ENV is ${{ env.APP_ENV }}" | ||
yarn e2e | ||
- uses: actions/upload-artifact@v4 | ||
if: ${{ !cancelled() }} | ||
with: | ||
name: playwright-report | ||
path: playwright-report/ | ||
retention-days: 30 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Unit and Integration Tests | ||
on: | ||
workflow_call: | ||
inputs: | ||
node-version: | ||
required: false | ||
type: number | ||
default: 20 | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ inputs.node-version }} | ||
cache: 'yarn' | ||
|
||
- name: Cache dependencies | ||
id: dependencies-cache | ||
uses: actions/cache@v3 | ||
with: | ||
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} | ||
path: '**/node_modules' | ||
restore-keys: | | ||
${{ runner.os }}-node- | ||
- name: Install Packages | ||
if: steps.dependencies-cache.outputs.cache-hit != 'true' | ||
run: yarn install | ||
|
||
- name: Run Unit and Integration Tests | ||
run: yarn run test |