Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yarn 3 cicd #2026

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"error",
{ "code": 120, "ignoreComments": true, "ignoreTrailingComments": true }
],
"react/button-has-type": ["off"],
"no-restricted-syntax": [
"error",
"ForInStatement",
Expand Down
104 changes: 104 additions & 0 deletions .github/workflows/check-examples.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Check examples

on:
pull_request:
branches:
- main

jobs:
build:
name: Build examples
runs-on: ubuntu-latest-4-cores
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
registry-url: https://registry.npmjs.org/
cache: "yarn"

- name: install dependencies
run: yarn install --immutable

- name: Build
run: yarn workspaces foreach -Apt --include='@examples/**' run build

lint:
name: Lint examples
runs-on: ubuntu-latest-4-cores
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
registry-url: https://registry.npmjs.org/
cache: "yarn"

- name: install dependencies
run: yarn install --immutable

- name: Lint
run: yarn workspaces foreach -Apt --include='@examples/**' run lint

test:
name: Test examples
runs-on: ubuntu-latest-4-cores
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
registry-url: https://registry.npmjs.org/
cache: "yarn"

- name: install dependencies
run: yarn install --immutable

- name: Test
run: yarn workspaces foreach -Apt --include='@examples/**' run test
e2e:
name: E2E examples
runs-on: ubuntu-latest-4-cores
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
registry-url: https://registry.npmjs.org/
cache: "yarn"

- name: install dependencies
run: yarn install --immutable

- name: Cache Playwright browsers
uses: actions/cache@v3
id: cache-playwright-browsers
with:
path: ~/.cache/ms-playwright/
key: ${{ runner.OS }}-playwright-browsers-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-playwright-browsers-
- name: Install Playwright Browsers
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true'
run: npx playwright install --with-deps

- name: E2E
run: yarn workspaces foreach -Apt --include='@examples/**' run e2e
env:
NEXT_PUBLIC_PUBLISHABLE_KEY: "pk_imapik-test-5ss4GpFy-n@$$Ye3LSox"
NEXT_PUBLIC_CLIENT_ID: "K846H940Uxokhz1aDb034QwBclYnAH24"
# add to github secrets, I don't have access
# NEXT_PUBLIC_PUBLISHABLE_KEY: ${{ secrets.PUBLISHABLE_KEY }}
# NEXT_PUBLIC_CLIENT_ID: ${{ secrets.CLIENT_ID }}
1 change: 1 addition & 0 deletions .nxignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
examples
28 changes: 28 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"

yarnPath: .yarn/releases/yarn-3.6.1.cjs
2 changes: 1 addition & 1 deletion examples/passport/identity-with-nextjs/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "identity-with-nextjs",
"name": "@examples/identity-with-nextjs",
"version": "0.1.0",
"private": true,
"scripts": {
Expand Down
30 changes: 16 additions & 14 deletions examples/passport/identity-with-nextjs/src/context/passport.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';

import {
createContext, ReactNode, useCallback, useContext,
createContext, ReactNode, useCallback, useContext, useMemo,
} from 'react';
import { config, passport } from '@imtbl/sdk';
import { ethers } from 'ethers';
Expand Down Expand Up @@ -134,21 +134,23 @@ export function PassportProvider({ children }: { children: ReactNode }) {
window.alert(`userProfile: ${JSON.stringify(userProfile)}`);
}, [passportInstance]);

const methods = useMemo(() => ({
passportInstance,
passportSilentInstance,
login,
logout,
logoutSilent,
loginWithoutWallet,
loginWithEthersjs,
getIdToken,
getAccessToken,
getLinkedAddresses,
getUserInfo,
}), []);

return (
<PassportContext.Provider
value={{
passportInstance,
passportSilentInstance,
login,
logout,
logoutSilent,
loginWithoutWallet,
loginWithEthersjs,
getIdToken,
getAccessToken,
getLinkedAddresses,
getUserInfo,
}}
value={methods}
>
{children}
</PassportContext.Provider>
Expand Down
Loading
Loading