From ec30d26cb2104150318c8b584742d49ab2c2b1be Mon Sep 17 00:00:00 2001 From: finn Date: Fri, 15 Mar 2024 14:11:25 -0700 Subject: [PATCH] bundler bonanza readme is out of date. wonder how many of these will fail --- .github/workflows/cross-environment-tests.yml | 254 +++++++++++++++++- 1 file changed, 245 insertions(+), 9 deletions(-) diff --git a/.github/workflows/cross-environment-tests.yml b/.github/workflows/cross-environment-tests.yml index 2347f7f17..9f98e7766 100644 --- a/.github/workflows/cross-environment-tests.yml +++ b/.github/workflows/cross-environment-tests.yml @@ -13,10 +13,17 @@ on: workflow_dispatch: jobs: - bundler-bonanza: - runs-on: ubuntu-latest + test-node-web5: + strategy: + fail-fast: false + matrix: + node-version: [20, 18] + os: [ubuntu-latest] + + runs-on: ${{ matrix.os }} + steps: - - name: Checkout source + - name: Checkout web5-js uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 with: path: web5-js @@ -26,22 +33,251 @@ jobs: with: repository: TBD54566975/bundler-bonanza path: bundler-bonanza + + - name: ๐Ÿ“ฆ Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + + - name: โš™๏ธ Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + registry-url: https://registry.npmjs.org/ + + - name: build web5-js + run: | + cd web5-js + pnpm install + pnpm build + + - name: ๐Ÿ“ฅ Install dependencies + run: | + cd bundler-bonanza + npm install --save ../web5-js/packages/api + pnpm install --no-frozen-lockfile + + - name: ๐Ÿงช Run Web5 tests + run: cd bundler-bonanza && pnpm test:web5 + + # 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 web5-js + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 + with: + path: web5-js - - name: Init Hermit - uses: cashapp/activate-hermit@31ce88b17a84941bb1b782f1b7b317856addf286 #v1.1.0 + - name: Checkout bundler-bonanza + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 with: - cache: "true" - working-directory: web5-js + repository: TBD54566975/bundler-bonanza + path: bundler-bonanza + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + cache: yarn + node-version: 18 + cache-dependency-path: ./bundler-bonanza/tests/reactnative/yarn.lock - name: build web5-js run: | cd web5-js pnpm install pnpm build + + - name: ๐Ÿ“ฅ Install dependencies + run: | + cd bundler-bonanza + npm install --save ../web5-js/packages/api + yarn --prefer-offline + + - name: Install macOS dependencies + run: | + brew tap wix/brew + brew install applesimutils + env: + HOMEBREW_NO_AUTO_UPDATE: 1 + HOMEBREW_NO_INSTALL_CLEANUP: 1 + + - name: Restore CocoaPods + id: restore-cocoapods + uses: actions/cache/restore@v3 + with: + path: bundler-bonanza/tests/reactnative/ios/Pods + key: ${{ runner.os }}-pods-${{ hashFiles('bundler-bonanza/tests/reactnative/ios/Podfile.lock') }} + restore-keys: | + ${{ runner.os }}-pods- + + - name: Install CocoaPods + run: NO_FLIPPER=1 cd bundler-bonanza/ios && pod install + + - name: Save CocoaPods + uses: actions/cache/save@v3 + if: success() + id: save-cocoapods + with: + path: bundler-bonanza/tests/reactnative/ios/Pods + key: ${{ runner.os }}-pods-${{ hashFiles('bundler-bonanza/tests/reactnative/ios/Podfile.lock') }} + + - name: Restore Detox build + id: restore-detox-build + uses: actions/cache/restore@v3 + with: + path: bundler-bonanza/tests/reactnative/ios/build + key: ${{ runner.os }}-detox-${{ hashFiles('bundler-bonanza/tests/reactnative/ios/Podfile.lock') }} + + - name: Detox build + if: steps.restore-detox-build.outputs.cache-hit != 'true' + run: cd bundler-bonanza && yarn detox build --configuration ios.sim.debug + + - name: Save Detox Build + uses: actions/cache/save@v3 + if: success() + id: save-detox-build + with: + path: bundler-bonanza/tests/reactnative/ios/build + key: ${{ runner.os }}-detox-${{ hashFiles('bundler-bonanza/tests/reactnative/ios/Podfile.lock') }} + + - name: Run tests + run: cd bundler-bonanza && yarn test + + - name: Upload artifacts + if: failure() + uses: actions/upload-artifact@v3 + with: + name: test-rn-ios-detox-artifacts + path: bundler-bonanza/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: + - name: Checkout web5-js + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 + with: + path: web5-js - - name: run bundler-bonanza + - name: Checkout bundler-bonanza + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 + with: + repository: TBD54566975/bundler-bonanza + path: bundler-bonanza + + - uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install pnpm + run: npm install -g pnpm + + - name: build web5-js + run: | + cd web5-js + pnpm install + pnpm build + + - name: ๐Ÿ“ฅ Install dependencies run: | cd bundler-bonanza npm install --save ../web5-js/packages/api pnpm install --no-frozen-lockfile - pnpm test:web5 + + - name: Install Playwright Browsers + run: pnpm playwright install --with-deps + + - name: Run browser tests + run: cd bundler-bonanza && TEST_PARAMS="--project=${{ matrix.browser }} --trace=on" pnpm test:browser + + - uses: actions/upload-artifact@v3 + if: always() + with: + name: playwright-report + path: bundler-bonanza/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: ./bundler-bonanza/tests/electron-vite + + steps: + - name: Checkout web5-js + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 + with: + path: web5-js + + - name: build web5-js + run: | + cd web5-js + pnpm install + pnpm build + + - name: Checkout bundler-bonanza + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 + with: + repository: TBD54566975/bundler-bonanza + path: bundler-bonanza + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + cache: yarn + node-version: 18 + cache-dependency-path: ./bundler-bonanza/tests/electron-vite/yarn.lock + + - name: ๐Ÿ“ฅ Install dependencies + run: | + cd bundler-bonanza + npm install --save ../web5-js/packages/api + yarn --prefer-offline + env: + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 + + - name: Build electron app + run: cd bundler-bonanza && yarn build + + - name: Run electron tests + run: cd bundler-bonanza && yarn test --trace=on + if: matrix.os != 'ubuntu-latest' + + - name: Run electron tests (xvfb) + run: cd bundler-bonanza && 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: bundler-bonanza/tests/electron-vite/playwright-report/ + retention-days: 30 \ No newline at end of file