From 5b5159ec6381b2f1080a0a5293e7919439ccc2c8 Mon Sep 17 00:00:00 2001 From: kyranjamie Date: Thu, 14 Mar 2024 11:49:00 +0100 Subject: [PATCH] ci: fix test-app --- .github/actions/provision/action.yml | 5 ----- .github/workflows/build-extension.yml | 2 +- .github/workflows/playwright.yml | 16 +++----------- .tool-versions | 2 -- Dockerfile | 28 ------------------------ README.md | 22 +++++++++---------- package.json | 2 ++ playwright.config.ts | 2 +- pnpm-lock.yaml | 14 ++++++++++++ test-app/webpack/webpack.config.base.cjs | 1 + webpack/webpack.config.base.js | 1 - 11 files changed, 33 insertions(+), 62 deletions(-) delete mode 100644 .tool-versions delete mode 100644 Dockerfile diff --git a/.github/actions/provision/action.yml b/.github/actions/provision/action.yml index 79e6bbf2076..6c4351b14f8 100644 --- a/.github/actions/provision/action.yml +++ b/.github/actions/provision/action.yml @@ -25,14 +25,9 @@ runs: ${{ runner.os }}-pnpm-store- - uses: nick-fields/retry@v2 - if: steps.cache.outputs.cache-hit != 'true' env: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 with: timeout_minutes: 5 max_attempts: 3 command: pnpm install --frozen-lockfile - - - name: Pandacodegen - run: pnpm panda codegen - shell: bash diff --git a/.github/workflows/build-extension.yml b/.github/workflows/build-extension.yml index b127e7b3a2d..0f6bea18f3b 100644 --- a/.github/workflows/build-extension.yml +++ b/.github/workflows/build-extension.yml @@ -20,7 +20,7 @@ jobs: - uses: kyranjamie/pull-request-fixed-header@v1.0.1 with: - header: '> _Building Leather at commit `${{ env.SHORT_SHA }}`_' + header: '> _Building Leather at commit ${{ env.SHORT_SHA }}_' GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} build: diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 28d783ae51f..3fa9b461258 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -31,18 +31,6 @@ jobs: id: playwright-version run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package.json').devDependencies['@playwright/test'])")" >> $GITHUB_ENV - - uses: actions/cache@v4 - id: cache - with: - path: '**/node_modules' - key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**/package.json') }}-${{ env.PLAYWRIGHT_VERSION }}-force - - - name: Install dependencies - if: steps.cache.outputs.cache-hit != 'true' - env: - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 - run: pnpm install --frozen-lockfile - - name: Cache playwright binaries uses: actions/cache@v4 id: playwright-cache @@ -98,7 +86,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions/setup-node@v4 + + - name: Set up pnpm + uses: pnpm/action-setup@v3 - name: Install dependencies run: pnpm install --frozen-lockfile diff --git a/.tool-versions b/.tool-versions deleted file mode 100644 index a6271e18977..00000000000 --- a/.tool-versions +++ /dev/null @@ -1,2 +0,0 @@ -nodejs 16.13.0 -yarn 1.22.19 diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index daf58578856..00000000000 --- a/Dockerfile +++ /dev/null @@ -1,28 +0,0 @@ -FROM debian:buster-slim as builder -LABEL maintainer="ux@blockstack.com" - -ARG NODE_VERSION=12 -ENV WALLET_ENVIRONMENT="production" -ENV NODE_VERSION=${NODE_VERSION} -WORKDIR /src - - -COPY . . -RUN apt-get update -y \ - && apt-get install -y build-essential python3 zip curl git \ - && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ - && curl -sL https://deb.nodesource.com/setup_${NODE_VERSION:-12}.x | bash - \ - && sh -c 'echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list' \ - && apt-get update -y \ - && apt-get install -y yarn nodejs \ - && chmod +x build-ext.sh \ - && yarn \ - && yarn build \ - && ./build-ext.sh /leather-chromium.zip - - -FROM alpine:3.16 -COPY --from=builder /leather-chromium.zip . - -# Wait for extension.zip to be copied into local -CMD sleep 30 diff --git a/README.md b/README.md index e024189f18b..6a55fb2b4a2 100755 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ use `react-refresh` to update the extension as you work. This gives us near inst persists the state of the application between changes. To start development mode for the extension, run this command: ```bash -yarn dev +pnpm dev ``` #### Optional: run test app @@ -35,13 +35,13 @@ can do. In a separate terminal, run: ```bash -yarn dev:test-app +pnpm dev:test-app ``` ### Loading extension in your browser You'll need to add it to your browser of choice. Leather only -supports Chromium and Firefox browsers. When you run `yarn dev`, it will compile the application to the `/dist` folder +supports Chromium and Firefox browsers. When you run `pnpm dev`, it will compile the application to the `/dist` folder - [Chrome instructions](https://developer.chrome.com/docs/extensions/mv3/faq/#faq-dev-01) - [Firefox instructions](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension#trying_it_out) @@ -53,13 +53,13 @@ Several testing scripts are available in [`package.json`](./package.json). The integration tests expect the extension to be built prior to running. The extension can be built for tests with the command below. ```bash -yarn build:test +pnpm build:test ``` The integration tests use Playwright, which requires the system to have the browsers it needs. The following command installs everything Playwright needs. ```bash -yarn playwright install --with-deps +pnpm playwright install --with-deps ``` Note that the installed browsers are tied to the version of Playwright being used, and it may be necessary to run the above command again in some situations, such as when upgrading Playwright or switching branches. [Read the documentation for more information](https://playwright.dev/docs/cli#install-system-dependencies). @@ -69,14 +69,14 @@ Note that the installed browsers are tied to the version of Playwright being use All integration tests can be run using: ```bash -yarn test:integration +pnpm test:integration ``` To run a suite of tests you can use: ```bash -yarn playwright test specs/TEST.spec.ts -yarn playwright test tests/specs --shard=3/8 +pnpm playwright test specs/TEST.spec.ts +pnpm playwright test tests/specs --shard=3/8 ``` ### Unit tests @@ -84,7 +84,7 @@ yarn playwright test tests/specs --shard=3/8 Unit tests can be run with vitest using: ```bash -yarn test:unit +pnpm test:unit ``` ## Production @@ -98,7 +98,7 @@ Alternatively, the following steps can be taken by _technical_ users with the la Run the following from within this repository's root directory if you've pulled it with Git: ```bash -yarn && yarn prepare && yarn build +pnpm && pnpm prepare && pnpm build ``` The extension is now built in the `./dist` folder. @@ -108,7 +108,7 @@ The extension is now built in the `./dist` folder. To build the extension in Firefox mode, the `TARGET_BROWSER=firefox` variable needs to be set. ```bash -yarn && yarn prepare && TARGET_BROWSER=firefox yarn build +pnpm && pnpm prepare && TARGET_BROWSER=firefox pnpm build ``` Note that when building in a clean environment, some code may vary between this and the submitted build. This is because some variables are set within the scope of the production build's CI. diff --git a/package.json b/package.json index cd31e9b6881..3d0c88ee537 100644 --- a/package.json +++ b/package.json @@ -130,6 +130,7 @@ }, "dependencies": { "@bitcoinerlab/secp256k1": "1.0.2", + "@blockstack/stacks-transactions": "0.7.0", "@coinbase/cbpay-js": "1.0.2", "@dlc-link/dlc-tools": "1.1.1", "@fungible-systems/zone-file": "2.0.0", @@ -193,6 +194,7 @@ "chroma-js": "2.4.2", "coinselect": "3.1.13", "compare-versions": "4.1.3", + "cross-fetch": "4.0.0", "css-loader": "6.9.0", "dayjs": "1.11.8", "dompurify": "3.0.6", diff --git a/playwright.config.ts b/playwright.config.ts index e72139ada1e..f576628892c 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -28,7 +28,7 @@ export default defineConfig({ }, ], webServer: { - command: 'yarn dev:test-app', + command: 'pnpm dev:test-app', port: 3000, timeout: 15000, }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4aece3d298a..27eb95f6005 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -13,6 +13,9 @@ dependencies: '@bitcoinerlab/secp256k1': specifier: 1.0.2 version: 1.0.2 + '@blockstack/stacks-transactions': + specifier: 0.7.0 + version: 0.7.0 '@coinbase/cbpay-js': specifier: 1.0.2 version: 1.0.2 @@ -202,6 +205,9 @@ dependencies: compare-versions: specifier: 4.1.3 version: 4.1.3 + cross-fetch: + specifier: 4.0.0 + version: 4.0.0 css-loader: specifier: 6.9.0 version: 6.9.0(webpack@5.90.3) @@ -12862,6 +12868,14 @@ packages: transitivePeerDependencies: - encoding + /cross-fetch@4.0.0: + resolution: {integrity: sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==} + dependencies: + node-fetch: 2.7.0 + transitivePeerDependencies: + - encoding + dev: false + /cross-sha256@1.2.0: resolution: {integrity: sha512-KViLNMDZKV7jwFqjFx+rNhG26amnFYYQ0S+VaFlVvpk8tM+2XbFia/don/SjGHg9WQxnFVi6z64CGPuF3T+nNw==} dependencies: diff --git a/test-app/webpack/webpack.config.base.cjs b/test-app/webpack/webpack.config.base.cjs index 48f71680da3..66df3c17a59 100755 --- a/test-app/webpack/webpack.config.base.cjs +++ b/test-app/webpack/webpack.config.base.cjs @@ -102,6 +102,7 @@ const config = { crypto: require.resolve('crypto-browserify'), stream: require.resolve('stream-browserify'), vm: require.resolve('vm-browserify'), + buffer: require.resolve('buffer/'), }, }, optimization: { diff --git a/webpack/webpack.config.base.js b/webpack/webpack.config.base.js index 820ba10003b..2a89b3ed952 100755 --- a/webpack/webpack.config.base.js +++ b/webpack/webpack.config.base.js @@ -85,7 +85,6 @@ const aliases = { '@stacks/storage': '@stacks/storage/dist/esm', '@stacks/transactions': '@stacks/transactions/dist/esm', '@stacks/wallet-sdk': '@stacks/wallet-sdk/dist/esm', - 'leather-styles': path.resolve('leather-styles'), };