-
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.
Merge pull request #195 from 1ilsang/feat/github-action-enhance
feat(github-action): Separate jobs for enhancement build script
- Loading branch information
Showing
20 changed files
with
242 additions
and
134 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,32 @@ | ||
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action?platform=mac#creating-an-action-metadata-file | ||
name: nextjs-build-export | ||
|
||
inputs: | ||
e2e: | ||
required: false | ||
default: 'false' | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
- name: Restore Next.js related caches | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
${{ github.workspace }}/.next | ||
${{ github.workspace }}/out | ||
key: ${{ runner.os }}-nextjs-store-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}-${{ inputs.e2e == 'true' && 'e2e' || 'default' }} | ||
restore-keys: | | ||
${{ runner.os }}-nextjs-store-${{ hashFiles('**/pnpm-lock.yaml') }}- | ||
id: cache-nextjs-build | ||
|
||
- name: Build and Export [default] | ||
shell: bash | ||
if: steps.cache-nextjs-build.outputs.cache-hit != 'true' && inputs.e2e == 'false' | ||
run: pnpm deploy-blog | ||
|
||
- name: Build and Export [e2e] | ||
shell: bash | ||
if: steps.cache-nextjs-build.outputs.cache-hit != 'true' && inputs.e2e == 'true' | ||
run: pnpm e2e:build |
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,25 @@ | ||
name: playwright-install | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
# https://github.com/microsoft/playwright/issues/7249#issuecomment-1373375487 | ||
- name: Get playwright version | ||
shell: bash | ||
run: | | ||
echo "PLAYWRIGHT_VERSION=$(node -e "process.stdout.write(require('@playwright/test/package.json').version)")" >> $GITHUB_OUTPUT | ||
id: playwright-version | ||
|
||
- name: Cache Playwright Browsers for Playwright's Version | ||
uses: actions/cache@v4 | ||
with: | ||
# https://playwright.dev/docs/browsers#managing-browser-binaries | ||
path: ~/Library/Caches/ms-playwright | ||
key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.PLAYWRIGHT_VERSION }} | ||
id: cache-playwright-browsers | ||
|
||
- name: Setup Playwright | ||
shell: bash | ||
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true' | ||
run: pnpm e2e:install |
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,33 @@ | ||
name: pnpm-install | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: .nvmrc | ||
|
||
- name: Install pnpm | ||
uses: pnpm/action-setup@v3 | ||
with: | ||
version: 8 | ||
run_install: false | ||
|
||
- name: Get pnpm store directory | ||
shell: bash | ||
run: | | ||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | ||
- name: Setup pnpm cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ env.STORE_PATH }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: Install dependencies | ||
shell: bash | ||
run: pnpm install |
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,30 @@ | ||
name: code | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
lint: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: 🌱 Install pnpm | ||
uses: ./.github/actions/pnpm-install | ||
|
||
- name: 🏁 Lint | ||
run: pnpm lint | ||
|
||
build-export: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: 🌱 Install pnpm | ||
uses: ./.github/actions/pnpm-install | ||
|
||
- name: 🏗 Build and Export | ||
uses: ./.github/actions/nextjs-build-export |
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,55 @@ | ||
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions | ||
name: e2e-reusable | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
others: | ||
type: boolean | ||
default: false | ||
dom-snapshot: | ||
type: boolean | ||
default: false | ||
screen-snapshot: | ||
type: boolean | ||
default: false | ||
|
||
jobs: | ||
i: | ||
timeout-minutes: 60 | ||
runs-on: macos-latest | ||
env: | ||
TZ: Asia/Seoul | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: 🌱 Install pnpm | ||
uses: ./.github/actions/pnpm-install | ||
|
||
- name: 🥦 Install playwright | ||
uses: ./.github/actions/playwright-install | ||
|
||
- name: 🏗 Build and Export | ||
uses: ./.github/actions/nextjs-build-export | ||
with: | ||
e2e: 'true' | ||
|
||
- name: 🍄 Run Playwright [others] | ||
if: inputs.others | ||
run: pnpm e2e:others | ||
|
||
- name: 🧊 Run Playwright [dom-snapshot] | ||
if: inputs.dom-snapshot | ||
run: pnpm e2e:dom | ||
|
||
- name: 🩸 Run Playwright [screen-snapshot] | ||
if: inputs.screen-snapshot | ||
run: pnpm e2e:screen | ||
|
||
- uses: actions/upload-artifact@v4 | ||
if: failure() | ||
with: | ||
name: playwright-report-$${{ inputs.others && 'others' || inputs.dom-snapshot && 'dom-snapshot' || inputs.screen-snapshot && 'screen-snapshot' || 'no-input-name' }} | ||
path: playwright-report/ | ||
retention-days: 10 |
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,23 @@ | ||
name: e2e | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
others: | ||
uses: './.github/workflows/e2e-reusable.yml' | ||
with: | ||
others: true | ||
|
||
dom-snapshot: | ||
uses: './.github/workflows/e2e-reusable.yml' | ||
with: | ||
dom-snapshot: true | ||
|
||
screen-snapshot: | ||
uses: './.github/workflows/e2e-reusable.yml' | ||
with: | ||
screen-snapshot: true |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
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
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
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
Oops, something went wrong.