Electron tests in CI #82
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: Bundling Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
web5ApiVersion: | |
description: "Select the desired @web5/api version" | |
required: false | |
dwnVersion: | |
description: "Select the desired @tbd54566975/dwn-sdk-js version" | |
required: false | |
env: | |
CI: true | |
PNPM_CACHE_FOLDER: .pnpm-store | |
jobs: | |
test-node-web5: | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: [20, 18] | |
os: [ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: ⬇️ Checkout source | |
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | |
- name: 📦 Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: ⚙️ Set up Node.js | |
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 | |
with: | |
node-version: ${{ matrix.node-version }} | |
registry-url: https://registry.npmjs.org/ | |
- name: 📥 Install dependencies | |
run: pnpm install | |
- name: 🔃 Update Web5 Version | |
if: ${{ github.event.inputs.web5ApiVersion }} | |
run: | | |
pnpm i -w @web5/api@${{ github.event.inputs.web5ApiVersion }} | |
- name: 🧪 Run Web5 tests | |
run: pnpm test:web5 | |
test-node-dwn: | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: [20, 18] | |
os: [ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: ⬇️ Checkout source | |
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | |
- name: 📦 Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: ⚙️ Set up Node.js | |
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 | |
with: | |
node-version: ${{ matrix.node-version }} | |
registry-url: https://registry.npmjs.org/ | |
- name: 📥 Install dependencies | |
run: pnpm install | |
- name: 🔃 Update dwn-sdk-js Version | |
if: ${{ github.event.inputs.dwnVersion }} | |
run: | | |
pnpm i -w @tbd54566975/dwn-sdk-js@${{ github.event.inputs.dwnVersion }} | |
- name: 🧪 Run DWN tests | |
run: pnpm test:dwn | |
# reference: https://github.com/remarkablemark/react-native-cli-quickstart/blob/master/.github/workflows/e2e-ios.yml | |
test-rn-ios: | |
timeout-minutes: 60 | |
runs-on: macos-latest | |
defaults: | |
run: | |
working-directory: ./tests/reactnative | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
cache: yarn | |
node-version: 18 | |
cache-dependency-path: ./tests/reactnative/yarn.lock | |
- name: Install Yarn dependencies | |
run: yarn --frozen-lockfile --prefer-offline | |
- name: 🔃 Update Web5 Version | |
if: ${{ github.event.inputs.web5ApiVersion }} | |
run: | | |
yarn add @web5/api@${{ github.event.inputs.web5ApiVersion }} | |
cat package.json | |
- name: 🔃 Update dwn-sdk-js Version | |
if: ${{ github.event.inputs.dwnVersion }} | |
run: | | |
yarn add @tbd54566975/dwn-sdk-js@${{ github.event.inputs.dwnVersion }} | |
cat package.json | |
- name: Install macOS dependencies | |
run: | | |
brew tap wix/brew | |
brew install applesimutils | |
env: | |
HOMEBREW_NO_AUTO_UPDATE: 1 | |
HOMEBREW_NO_INSTALL_CLEANUP: 1 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
ruby-version: 2.7.6 | |
# - name: Cache CocoaPods | |
# id: cache-cocoapods | |
# uses: actions/cache@v3 | |
# with: | |
# path: tests/reactnative/ios/Pods | |
# key: ${{ runner.os }}-pods-${{ hashFiles('tests/reactnative/ios/Podfile.lock') }} | |
# restore-keys: | | |
# ${{ runner.os }}-pods- | |
- name: Install CocoaPods | |
# if: steps.cache-cocoapods.outputs.cache-hit != 'true' | |
run: cd ios ; pod install ; cd - | |
- name: Detox rebuild framework cache | |
run: yarn detox rebuild-framework-cache | |
- name: Cache Detox build | |
id: cache-detox-build | |
uses: actions/cache@v3 | |
with: | |
path: tests/reactnative/ios/build | |
key: ${{ runner.os }}-detox-build | |
restore-keys: | | |
${{ runner.os }}-detox-build | |
- name: Detox build | |
run: yarn detox build --configuration ios.sim.release | |
- name: Detox test | |
run: yarn detox test --configuration ios.sim.release --cleanup --headless --record-logs all --take-screenshots failing | |
- name: Upload artifacts | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-rn-ios-detox-artifacts | |
path: tests/reactnative/artifacts | |
test-browsers: | |
timeout-minutes: 15 | |
strategy: | |
fail-fast: false | |
matrix: | |
browser: | |
[ | |
"desktop-safari", | |
"desktop-chrome", | |
"desktop-firefox", | |
"desktop-edge", | |
"mobile-safari", | |
"mobile-chrome", | |
] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: Install pnpm | |
run: npm install -g pnpm | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: 🔃 Update Web5 Version | |
if: ${{ github.event.inputs.web5ApiVersion }} | |
run: | | |
pnpm i -w @web5/api@${{ github.event.inputs.web5ApiVersion }} | |
cat package.json | |
- name: 🔃 Update dwn-sdk-js Version | |
if: ${{ github.event.inputs.dwnVersion }} | |
run: | | |
pnpm i -w @tbd54566975/dwn-sdk-js@${{ github.event.inputs.dwnVersion }} | |
cat package.json | |
- name: Install Playwright Browsers | |
run: pnpm playwright install --with-deps | |
- name: Run browser tests | |
run: TEST_PARAMS="--project=${{ matrix.browser }} --trace=on" pnpm test:browser | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 | |
test-electron: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./tests/electron-vite | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
cache: yarn | |
node-version: 18 | |
cache-dependency-path: ./tests/electron-vite/yarn.lock | |
- name: Install Yarn dependencies | |
run: yarn --frozen-lockfile --prefer-offline | |
- name: 🔃 Update Web5 Version | |
if: ${{ github.event.inputs.web5ApiVersion }} | |
run: | | |
yarn add @web5/api@${{ github.event.inputs.web5ApiVersion }} | |
cat package.json | |
- name: 🔃 Update dwn-sdk-js Version | |
if: ${{ github.event.inputs.dwnVersion }} | |
run: | | |
yarn add @tbd54566975/dwn-sdk-js@${{ github.event.inputs.dwnVersion }} | |
cat package.json | |
- name: Build electron app | |
run: yarn build | |
- name: Install Playwright Browsers | |
run: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 yarn playwright install | |
- name: Run browser tests | |
run: yarn test --trace=on | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: playwright-report | |
path: tests/electron-vite/playwright-report/ | |
retention-days: 30 |