From d387a8958ddc59388312dcceceeedb1738c83e19 Mon Sep 17 00:00:00 2001 From: 1ilsang <1ilsang@naver.com> Date: Mon, 6 May 2024 03:41:38 +0900 Subject: [PATCH] dump --- .github/actions/playwright-install/action.yml | 53 +++++++++++++++++++ .github/actions/pnpm-install/action.yml | 33 ++++++++++++ .github/workflows/code.yml | 30 +++++++++++ .github/workflows/{playwright.yml => e2e.yml} | 16 ++---- .github/workflows/pr-test.yml | 18 ------- .github/workflows/resuable.yml | 53 ------------------- playwright.config.ts | 1 + 7 files changed, 122 insertions(+), 82 deletions(-) create mode 100644 .github/actions/playwright-install/action.yml create mode 100644 .github/actions/pnpm-install/action.yml create mode 100644 .github/workflows/code.yml rename .github/workflows/{playwright.yml => e2e.yml} (59%) delete mode 100644 .github/workflows/pr-test.yml delete mode 100644 .github/workflows/resuable.yml diff --git a/.github/actions/playwright-install/action.yml b/.github/actions/playwright-install/action.yml new file mode 100644 index 00000000..ad9814ff --- /dev/null +++ b/.github/actions/playwright-install/action.yml @@ -0,0 +1,53 @@ +name: playwright-install + +runs: + using: composite + + steps: + # - 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 action + # shell: bash + # uses: actions/cache@v3 + # id: playwright-cache + # with: + # key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.PLAYWRIGHT_VERSION }} + # path: ${{ github.workspace }}/ms-playwright + + # https://github.com/microsoft/playwright/issues/7249#issuecomment-1385567519 + - name: Store Playwright's Version + shell: bash + run: | + PLAYWRIGHT_VERSION=$(npm ls @playwright/test | grep @playwright | sed 's/.*@//') + echo "Playwright's Version: $PLAYWRIGHT_VERSION" + echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV + + - name: Cache Playwright Browsers for Playwright's Version + shell: bash + id: cache-playwright-browsers + uses: actions/cache@v3 + with: + path: ~/.cache/ms-playwright + key: playwright-browsers-${{ env.PLAYWRIGHT_VERSION }} + + - name: Setup Playwright + shell: bash + if: steps.cache-playwright-browsers.outputs.cache-hit != 'true' + run: pnpm e2e:install + + # - name: ♻️ Restore nextjs-app related caches + # uses: actions/cache@v4 + # with: + # path: | + # ${{ github.workspace }}/.next/cache + # ${{ github.workspace }}/.cache + # ${{ github.workspace }}/**/tsconfig.tsbuildinfo + # key: ${{ runner.os }}-nextjs-cache-${{ hashFiles('yarn.lock') }} + + - name: Build post + shell: bash + run: pnpm e2e:build diff --git a/.github/actions/pnpm-install/action.yml b/.github/actions/pnpm-install/action.yml new file mode 100644 index 00000000..bc348a8d --- /dev/null +++ b/.github/actions/pnpm-install/action.yml @@ -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 diff --git a/.github/workflows/code.yml b/.github/workflows/code.yml new file mode 100644 index 00000000..9956f79a --- /dev/null +++ b/.github/workflows/code.yml @@ -0,0 +1,30 @@ +name: code + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: 🌱 Install pnpm + uses: ./.github/actions/pnpm-install + + - name: 🏁 Lint + run: pnpm lint + + build-export: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: 🌱 Install pnpm + uses: ./.github/actions/pnpm-install + + - name: πŸ— Build-export + run: pnpm deploy-blog diff --git a/.github/workflows/playwright.yml b/.github/workflows/e2e.yml similarity index 59% rename from .github/workflows/playwright.yml rename to .github/workflows/e2e.yml index 6e77665b..14e0ff14 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/e2e.yml @@ -1,4 +1,4 @@ -name: Playwright +name: e2e on: push: @@ -15,18 +15,12 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20.x - - - name: Install dependencies - run: npm install -g pnpm && pnpm install - - name: Install Playwright Browsers - run: pnpm e2e:install + - name: 🌱 Install pnpm + uses: ./.github/actions/pnpm-install - - name: Build post - run: pnpm e2e:build + - name: πŸͺ› Install playwright + uses: ./.github/actions/playwright-install - name: Run Playwright tests run: pnpm e2e diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml deleted file mode 100644 index f798a2f2..00000000 --- a/.github/workflows/pr-test.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Test - -on: - push: - branches: [main] - pull_request: - branches: [main] - -jobs: - lint: - uses: './.github/workflows/resuable.yml' - with: - lint: true - - build-export: - uses: './.github/workflows/resuable.yml' - with: - build-export: true diff --git a/.github/workflows/resuable.yml b/.github/workflows/resuable.yml deleted file mode 100644 index d5d99ad1..00000000 --- a/.github/workflows/resuable.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: reusable - -on: - workflow_call: - inputs: - lint: - type: boolean - default: false - build-export: - type: boolean - default: false - -jobs: - r: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - 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 - run: pnpm install - - - name: Lint - if: inputs.lint - run: pnpm lint - - - name: Build-export - if: inputs.build-export - run: pnpm deploy-blog diff --git a/playwright.config.ts b/playwright.config.ts index 81571248..8b593dbb 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -37,6 +37,7 @@ export default defineConfig({ }, /* Configure projects for major browsers */ + // TODO: workflow_call에 λ”°λ₯Έ μ„ΈλΆ„ν™” κ°€λŠ₯할지? projects: [ { name: 'desktop',