Skip to content

Commit

Permalink
use env
Browse files Browse the repository at this point in the history
  • Loading branch information
etrepum committed May 5, 2024
1 parent 23ca0ba commit 01d8d9c
Showing 1 changed file with 15 additions and 27 deletions.
42 changes: 15 additions & 27 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,13 @@ jobs:
include:
- os: macos-latest
browser: webkit
playwright-cache: '~/Library/Caches/ms-playwright'
test-results: 'test-results/'
- os: windows-latest
playwright-cache: 'C:\Users\runneradmin\AppData\Local\ms-playwright'
test-results: '~/.npm/_logs/'
- os: ubuntu-latest
playwright-cache: '~/.cache/ms-playwright'
test-results: 'test-results/'
runs-on: ${{ matrix.os }}
env:
CI: true
E2E_EDITOR_MODE: ${{ matrix.editor-mode }}
E2E_EVENTS_MODE: ${{ matrix.events-mode }}
cache_playwright_path: ${{ matrix.os == 'macos-latest' && '~/Library/Caches/ms-playwright' || matrix.os == 'windows-latest' && 'C:\Users\runneradmin\AppData\Local\ms-playwright' || '~/.cache/ms-playwright'}}
test_results_path: ${{ matrix.os == 'windows-latest' && '~/.npm/_logs/' || 'test-results/' }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -120,15 +114,15 @@ jobs:
uses: actions/cache/restore@v4
id: playwright-cache
with:
path: ${{ matrix.playwright-cache }}
path: ${{ env.cache_playwright_path }}
key: playwright-${{ matrix.node-version }}-${{ runner.os }}-${{ runner.arch }}-v${{ secrets.CACHE_VERSION }}-${{ hashFiles('package-lock.json') }}
- name: Install playwright
run: npx playwright install
- name: Save playwright to cache
uses: actions/cache/save@v4
if: steps.playwright-cache.outputs.cache-hit != 'true'
with:
path: ${{ matrix.playwright-cache }}
path: ${{ env.cache_playwright_path }}
key: ${{ steps.playwright-cache.outputs.cache-primary-key }}
- name: Run tests
run: npm run ${{ matrix.test-prefix }}${{ matrix.editor-mode == 'rich-text-with-collab' && 'collab-' || '' }}ci-${{ matrix.browser }}
Expand All @@ -137,7 +131,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: Test Results
path: ${{ matrix.test-results }}
path: ${{ env.test_results_path }}
retention-days: 7

e2e-collab:
Expand All @@ -153,19 +147,13 @@ jobs:
include:
- os: macos-latest
browser: webkit
playwright-cache: '~/Library/Caches/ms-playwright'
test-results: 'test-results/'
- os: windows-latest
playwright-cache: 'C:\Users\runneradmin\AppData\Local\ms-playwright'
test-results: '~/.npm/_logs/'
- os: ubuntu-latest
playwright-cache: '~/.cache/ms-playwright'
test-results: 'test-results/'
runs-on: ${{ matrix.os }}
env:
CI: true
E2E_EDITOR_MODE: ${{ matrix.editor-mode }}
E2E_EVENTS_MODE: ${{ matrix.events-mode }}
cache_playwright_path: ${{ matrix.os == 'macos-latest' && '~/Library/Caches/ms-playwright' || matrix.os == 'windows-latest' && 'C:\Users\runneradmin\AppData\Local\ms-playwright' || '~/.cache/ms-playwright'}}
test_results_path: ${{ matrix.os == 'windows-latest' && '~/.npm/_logs/' || 'test-results/' }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -184,15 +172,15 @@ jobs:
uses: actions/cache/restore@v4
id: playwright-cache
with:
path: ${{ matrix.playwright-cache }}
path: ${{ env.cache_playwright_path }}
key: playwright-${{ matrix.node-version }}-${{ runner.os }}-${{ runner.arch }}-v${{ secrets.CACHE_VERSION }}-${{ hashFiles('package-lock.json') }}
- name: Install playwright
run: npx playwright install
- name: Save playwright to cache
uses: actions/cache/save@v4
if: steps.playwright-cache.outputs.cache-hit != 'true'
with:
path: ${{ matrix.playwright-cache }}
path: ${{ env.cache_playwright_path }}
key: ${{ steps.playwright-cache.outputs.cache-primary-key }}
- name: Run tests
run: npm run ${{ matrix.test-prefix }}${{ matrix.editor-mode == 'rich-text-with-collab' && 'collab-' || '' }}ci-${{ matrix.browser }}
Expand All @@ -201,7 +189,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: Test Results
path: ${{ matrix.test-results }}
path: ${{ env.cache_playwright_path }}
retention-days: 7

e2e-prod:
Expand All @@ -217,13 +205,13 @@ jobs:
include:
- os: macos-latest
browser: webkit
playwright-cache: '~/Library/Caches/ms-playwright'
test-results: 'test-results/'
runs-on: ${{ matrix.os }}
env:
CI: true
E2E_EDITOR_MODE: ${{ matrix.editor-mode }}
E2E_EVENTS_MODE: ${{ matrix.events-mode }}
cache_playwright_path: ${{ matrix.os == 'macos-latest' && '~/Library/Caches/ms-playwright' || matrix.os == 'windows-latest' && 'C:\Users\runneradmin\AppData\Local\ms-playwright' || '~/.cache/ms-playwright'}}
test_results_path: ${{ matrix.os == 'windows-latest' && '~/.npm/_logs/' || 'test-results/' }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -237,15 +225,15 @@ jobs:
uses: actions/cache/restore@v4
id: playwright-cache
with:
path: ${{ matrix.playwright-cache }}
path: ${{ env.cache_playwright_path }}
key: playwright-${{ matrix.node-version }}-${{ runner.os }}-${{ runner.arch }}-v${{ secrets.CACHE_VERSION }}-${{ hashFiles('package-lock.json') }}
- name: Install playwright
run: npx playwright install
- name: Save playwright to cache
uses: actions/cache/save@v4
if: steps.playwright-cache.outputs.cache-hit != 'true'
with:
path: ${{ matrix.playwright-cache }}
path: ${{ env.cache_playwright_path }}
key: ${{ steps.playwright-cache.outputs.cache-primary-key }}
- name: Run tests
run: npm run ${{ matrix.test-prefix }}${{ matrix.editor-mode == 'rich-text-with-collab' && 'collab-' || '' }}ci-${{ matrix.browser }}
Expand All @@ -254,5 +242,5 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: Test Results
path: ${{ matrix.test-results }}
path: ${{ env.test_results_path }}
retention-days: 7

0 comments on commit 01d8d9c

Please sign in to comment.