Skip to content

Commit

Permalink
yarn 3 cicd
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-yangy committed Jul 27, 2024
1 parent a520627 commit 95268f3
Show file tree
Hide file tree
Showing 15 changed files with 3,179 additions and 23,871 deletions.
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 }}
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

0 comments on commit 95268f3

Please sign in to comment.