fixed 測試清空數據庫 failed #74
Workflow file for this run
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
name: Build And Test Extensions | |
on: | |
push: | |
branches: | |
- 'develop' | |
- 'hotfix/**' | |
- 'feature/**' | |
pull_request: | |
branches: [develop] | |
workflow_dispatch: | |
inputs: | |
debug: | |
description: 'Enable debug logging' | |
required: false | |
default: 'false' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
browser: [chrome, edge, chromium] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Setup Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: 20 | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build And Package Extensions | |
run: pnpm build --zip --target=${{ matrix.browser }}-mv3 | |
# upload to github artifacts for each browser with matrix | |
- name: Upload to GitHub Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.browser }}-mv3 | |
path: build/ | |
test: | |
runs-on: ubuntu-latest | |
needs: build | |
strategy: | |
fail-fast: false | |
matrix: | |
browser: [chrome, edge, chromium] | |
theme: ['', '-theme'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
id: download | |
with: | |
name: ${{ matrix.browser }}-mv3 | |
path: build/ | |
- name: Unzip artifacts | |
run: unzip build/${{ matrix.browser }}-mv3-prod.zip -d build/extension | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Setup Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: 20 | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Install Playwright Browsers | |
run: pnpm exec playwright install --with-deps | |
- name: Setup Project | |
id: project | |
run: | | |
# set output variable | |
echo "project=${{ matrix.browser }}${{ matrix.theme}}" >> $GITHUB_OUTPUT | |
- name: Test | |
run: | | |
if [ "${{ inputs.debug }}" == "true" ]; then | |
echo "Enabled Debug Mode" | |
export DEBUG="pw:api" | |
fi | |
pnpm test -- --project=${{ steps.project.outputs.project }} | |
- name: Upload Test Results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.project.outputs.project }}-test-results | |
path: | | |
test-results/ | |
playwright-report/ | |
if-no-files-found: ignore |