This repository has been archived by the owner on Dec 12, 2024. It is now read-only.
Add Android to CI #91
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-rn-android: | |
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: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
cache: gradle | |
distribution: temurin | |
java-version: 17 | |
- name: Cache Detox build | |
id: cache-detox-build | |
uses: actions/cache@v3 | |
with: | |
path: tests/reactnative/android/app/build | |
key: ${{ runner.os }}-detox-build-android | |
restore-keys: | | |
${{ runner.os }}-detox-build-android | |
- name: Detox build | |
run: yarn detox build --configuration android.emu.release | |
- name: Get device name | |
id: device | |
run: node -e "console.log('AVD_NAME=' + require('./.detoxrc').devices.emulator.device.avdName)" >> $GITHUB_OUTPUT | |
- name: Detox test | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 33 | |
arch: x86_64 | |
avd-name: ${{ steps.device.outputs.AVD_NAME }} | |
script: yarn detox test --configuration android.emu.release --headless --record-logs all --take-screenshots failing | |
- name: Upload artifacts | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: detox-artifacts | |
path: 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 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
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 | |
env: | |
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 | |
- 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: Run electron tests | |
run: yarn test --trace=on | |
if: matrix.os != 'ubuntu-latest' | |
- name: Run electron tests (xvfb) | |
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn test --trace=on | |
if: matrix.os == 'ubuntu-latest' | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: playwright-report | |
path: tests/electron-vite/playwright-report/ | |
retention-days: 30 |