Skip to content

Commit 6d38fee

Browse files
committed
add cicd pipeline
1 parent e54473a commit 6d38fee

File tree

65 files changed

+4858
-1319
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+4858
-1319
lines changed

.github/dependabot.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: 'npm'
4+
directory: '/'
5+
schedule:
6+
interval: 'daily'
7+
open-pull-requests-limit: 10

.github/workflows/CODEOWNERS

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# all
2+
* @susumutomita

.github/workflows/ci.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
branches: ['main']
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
build-and-test:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Set up Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '20'
23+
24+
- name: Cache Node modules
25+
uses: actions/cache@v4
26+
with:
27+
path: node_modules
28+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
29+
restore-keys: |
30+
${{ runner.os }}-node-
31+
32+
- name: Install dependencies
33+
run: make install
34+
35+
- name: Lint
36+
run: make lint
37+
38+
- name: TextLint
39+
run: make lint_text
40+
41+
- name: Check format
42+
run: make format_check
43+
44+
- name: Build
45+
run: make build
46+
47+
- name: Test
48+
run: make test
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Delete workflow history
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
workflow:
7+
description: workflow-id, workflow-name or filename
8+
required: true
9+
type: string
10+
11+
jobs:
12+
delete-history:
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 10
15+
env:
16+
GH_TOKEN: ${{ github.token }}
17+
GH_REPO: ${{ github.repository }}
18+
WORKFLOW: ${{ github.event.inputs.workflow }}
19+
20+
steps:
21+
- run: gh workflow view "${WORKFLOW}"
22+
- run: |
23+
gh run list --workflow "${WORKFLOW}" --limit 1000 --json databaseId,status --jq '.[] | select(.status == "completed") | .databaseId' \
24+
| xargs -n 1 -I {} gh api -X DELETE repos/${REPOSITORY}/actions/runs/{}
25+
env:
26+
REPOSITORY: ${{ github.repository }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Dependabot auto-merge
2+
on: pull_request_target
3+
4+
permissions:
5+
pull-requests: write
6+
contents: write
7+
8+
jobs:
9+
dependabot:
10+
runs-on: ubuntu-latest
11+
if: ${{ github.actor == 'dependabot[bot]' }}
12+
steps:
13+
- name: Dependabot metadata
14+
id: metadata
15+
uses: dependabot/fetch-metadata@v1.1.1
16+
with:
17+
github-token: "${{ secrets.GITHUB_TOKEN }}"
18+
- name: Enable auto-merge for Dependabot PRs
19+
if: ${{ steps.metadata.outputs.update-type == 'version-update:semver-minor' }}
20+
run: gh pr merge --auto --merge "$PR_URL"
21+
env:
22+
PR_URL: ${{github.event.pull_request.html_url}}
23+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

.husky/pre-commit

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npm test

.huskyrc.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"hooks": {
3+
"pre-commit": "lint-staged"
4+
}
5+
}

.prettierrc

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"semi": true,
3+
"singleQuote": true,
4+
"printWidth": 80,
5+
"tabWidth": 2,
6+
"useTabs": false,
7+
"trailingComma": "es5",
8+
"bracketSpacing": true
9+
}

.textlintrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"filters": {},
3+
"rules": {
4+
"no-mixed-zenkaku-and-hankaku-alphabet": true,
5+
"no-mixed-zenkaku-and-hankaku-number": true
6+
}
7+
}

Makefile

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
.PHONY: install
2+
install:
3+
yarn install
4+
5+
.PHONY: build
6+
build:
7+
yarn build
8+
9+
.PHONY: clean
10+
clean:
11+
yarn clean
12+
13+
.PHONY: test
14+
test:
15+
yarn test
16+
17+
.PHONY: test_coverage
18+
test_coverage:
19+
yarn test:coverage
20+
21+
.PHONY: lint
22+
lint:
23+
yarn lint
24+
25+
.PHONY: lint_text
26+
lint_text:
27+
yarn lint:text
28+
29+
.PHONY: format
30+
format:
31+
yarn format
32+
33+
.PHONY: format_check
34+
format_check:
35+
yarn format:check
36+
37+
.PHONY: before_commit
38+
before_commit: test format lint lint_text

app/debug.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
const DEFAULT_DEBUGGER_URL =
2-
process.env.DEBUGGER_URL ?? "http://localhost:3010/";
2+
process.env.DEBUGGER_URL ?? 'http://localhost:3010/';
33

44
export const DEFAULT_DEBUGGER_HUB_URL =
5-
process.env.NODE_ENV === "development"
6-
? new URL("/hub", DEFAULT_DEBUGGER_URL).toString()
5+
process.env.NODE_ENV === 'development'
6+
? new URL('/hub', DEFAULT_DEBUGGER_URL).toString()
77
: undefined;
88

99
export function createDebugUrl(frameURL: string | URL): string {
1010
try {
11-
const url = new URL("/", DEFAULT_DEBUGGER_URL);
11+
const url = new URL('/', DEFAULT_DEBUGGER_URL);
1212

13-
url.searchParams.set("url", frameURL.toString());
13+
url.searchParams.set('url', frameURL.toString());
1414

1515
return url.toString();
1616
} catch (error) {
17-
return "#";
17+
return '#';
1818
}
1919
}
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { POST } from "frames.js/next/server";
1+
export { POST } from 'frames.js/next/server';

app/examples/custom-hub/page.tsx

+18-18
Original file line numberDiff line numberDiff line change
@@ -8,40 +8,40 @@ import {
88
getPreviousFrame,
99
useFramesReducer,
1010
getFrameMessage,
11-
} from "frames.js/next/server";
12-
import Link from "next/link";
13-
import { getTokenUrl } from "frames.js";
14-
import { createDebugUrl } from "../../debug";
15-
import { currentURL } from "../../utils";
11+
} from 'frames.js/next/server';
12+
import Link from 'next/link';
13+
import { getTokenUrl } from 'frames.js';
14+
import { createDebugUrl } from '../../debug';
15+
import { currentURL } from '../../utils';
1616

1717
type State = {
1818
active: string;
1919
total_button_presses: number;
2020
};
2121

22-
const initialState = { active: "1", total_button_presses: 0 };
22+
const initialState = { active: '1', total_button_presses: 0 };
2323

2424
const reducer: FrameReducer<State> = (state, action) => {
2525
return {
2626
total_button_presses: state.total_button_presses + 1,
2727
active: action.postBody?.untrustedData.buttonIndex
2828
? String(action.postBody?.untrustedData.buttonIndex)
29-
: "1",
29+
: '1',
3030
};
3131
};
3232

3333
// This is a react server component only
3434
export default async function Home({ searchParams }: NextServerPageProps) {
35-
const url = currentURL("/examples/custom-hub");
35+
const url = currentURL('/examples/custom-hub');
3636
const previousFrame = getPreviousFrame<State>(searchParams);
3737

3838
const frameMessage = await getFrameMessage(previousFrame.postBody, {
39-
hubHttpUrl: "https://hub.freefarcasterhub.com:3281",
39+
hubHttpUrl: 'https://hub.freefarcasterhub.com:3281',
4040
fetchHubContext: true,
4141
});
4242

4343
if (frameMessage && !frameMessage?.isValid) {
44-
throw new Error("Invalid frame payload");
44+
throw new Error('Invalid frame payload');
4545
}
4646

4747
const [state, dispatch] = useFramesReducer<State>(
@@ -53,7 +53,7 @@ export default async function Home({ searchParams }: NextServerPageProps) {
5353
// Here: do a server side side effect either sync or async (using await), such as minting an NFT if you want.
5454
// example: load the users credentials & check they have an NFT
5555

56-
console.log("info: state is:", state);
56+
console.log('info: state is:', state);
5757

5858
if (frameMessage) {
5959
const {
@@ -70,13 +70,13 @@ export default async function Home({ searchParams }: NextServerPageProps) {
7070
requesterUserData,
7171
} = frameMessage;
7272

73-
console.log("info: frameMessage is:", frameMessage);
73+
console.log('info: frameMessage is:', frameMessage);
7474
}
7575

7676
// then, when done, return next frame
7777
return (
7878
<div className="p-4">
79-
frames.js starter kit.{" "}
79+
frames.js starter kit.{' '}
8080
<Link href={createDebugUrl(url)} className="underline">
8181
Debug
8282
</Link>
@@ -88,21 +88,21 @@ export default async function Home({ searchParams }: NextServerPageProps) {
8888
{/* <FrameImage src="https://framesjs.org/og.png" /> */}
8989
<FrameImage>
9090
<div tw="w-full h-full bg-slate-700 text-white justify-center items-center">
91-
{frameMessage?.inputText ? frameMessage.inputText : "Hello world"}
91+
{frameMessage?.inputText ? frameMessage.inputText : 'Hello world'}
9292
</div>
9393
</FrameImage>
9494
<FrameInput text="put some text here" />
9595
<FrameButton>
96-
{state?.active === "1" ? "Active" : "Inactive"}
96+
{state?.active === '1' ? 'Active' : 'Inactive'}
9797
</FrameButton>
9898
<FrameButton>
99-
{state?.active === "2" ? "Active" : "Inactive"}
99+
{state?.active === '2' ? 'Active' : 'Inactive'}
100100
</FrameButton>
101101
<FrameButton
102102
action="mint"
103103
target={getTokenUrl({
104-
address: "0x060f3edd18c47f59bd23d063bbeb9aa4a8fec6df",
105-
tokenId: "123",
104+
address: '0x060f3edd18c47f59bd23d063bbeb9aa4a8fec6df',
105+
tokenId: '123',
106106
chainId: 7777777,
107107
})}
108108
>
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { POST } from "frames.js/next/server";
1+
export { POST } from 'frames.js/next/server';

app/examples/mint-button/page.tsx

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getTokenUrl } from "frames.js";
1+
import { getTokenUrl } from 'frames.js';
22
import {
33
FrameButton,
44
FrameContainer,
@@ -7,11 +7,11 @@ import {
77
NextServerPageProps,
88
getPreviousFrame,
99
useFramesReducer,
10-
} from "frames.js/next/server";
11-
import Link from "next/link";
12-
import { zora } from "viem/chains";
13-
import { currentURL } from "../../utils";
14-
import { createDebugUrl } from "../../debug";
10+
} from 'frames.js/next/server';
11+
import Link from 'next/link';
12+
import { zora } from 'viem/chains';
13+
import { currentURL } from '../../utils';
14+
import { createDebugUrl } from '../../debug';
1515

1616
type State = {
1717
pageIndex: number;
@@ -22,27 +22,27 @@ const nfts: {
2222
tokenUrl: string;
2323
}[] = [
2424
{
25-
src: "https://ipfs.decentralized-content.com/ipfs/bafybeifs7vasy5zbmnpixt7tb6efi35kcrmpoz53d3vg5pwjz52q7fl6pq/cook.png",
25+
src: 'https://ipfs.decentralized-content.com/ipfs/bafybeifs7vasy5zbmnpixt7tb6efi35kcrmpoz53d3vg5pwjz52q7fl6pq/cook.png',
2626
tokenUrl: getTokenUrl({
27-
address: "0x99de131ff1223c4f47316c0bb50e42f356dafdaa",
27+
address: '0x99de131ff1223c4f47316c0bb50e42f356dafdaa',
2828
chain: zora,
29-
tokenId: "2",
29+
tokenId: '2',
3030
}),
3131
},
3232
{
33-
src: "https://remote-image.decentralized-content.com/image?url=https%3A%2F%2Fipfs.decentralized-content.com%2Fipfs%2Fbafybeiegrnialwu66u3nwzkn4gik4i2x2h4ip7y3w2dlymzlpxb5lrqbom&w=1920&q=75",
33+
src: 'https://remote-image.decentralized-content.com/image?url=https%3A%2F%2Fipfs.decentralized-content.com%2Fipfs%2Fbafybeiegrnialwu66u3nwzkn4gik4i2x2h4ip7y3w2dlymzlpxb5lrqbom&w=1920&q=75',
3434
tokenUrl: getTokenUrl({
35-
address: "0x060f3edd18c47f59bd23d063bbeb9aa4a8fec6df",
35+
address: '0x060f3edd18c47f59bd23d063bbeb9aa4a8fec6df',
3636
chain: zora,
37-
tokenId: "1",
37+
tokenId: '1',
3838
}),
3939
},
4040
{
41-
src: "https://remote-image.decentralized-content.com/image?url=https%3A%2F%2Fipfs.decentralized-content.com%2Fipfs%2Fbafybeidc6e5t3qmyckqh4fr2ewrov5asmeuv4djycopvo3ro366nd3bfpu&w=1920&q=75",
41+
src: 'https://remote-image.decentralized-content.com/image?url=https%3A%2F%2Fipfs.decentralized-content.com%2Fipfs%2Fbafybeidc6e5t3qmyckqh4fr2ewrov5asmeuv4djycopvo3ro366nd3bfpu&w=1920&q=75',
4242
tokenUrl: getTokenUrl({
43-
address: "0x8f5ed2503b71e8492badd21d5aaef75d65ac0042",
43+
address: '0x8f5ed2503b71e8492badd21d5aaef75d65ac0042',
4444
chain: zora,
45-
tokenId: "3",
45+
tokenId: '3',
4646
}),
4747
},
4848
];
@@ -60,7 +60,7 @@ const reducer: FrameReducer<State> = (state, action) => {
6060

6161
// This is a react server component only
6262
export default async function Home({ searchParams }: NextServerPageProps) {
63-
const url = currentURL("/examples/mint-button");
63+
const url = currentURL('/examples/mint-button');
6464
const previousFrame = getPreviousFrame<State>(searchParams);
6565
const [state] = useFramesReducer<State>(reducer, initialState, previousFrame);
6666

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { POST } from "frames.js/next/server";
1+
export { POST } from 'frames.js/next/server';

0 commit comments

Comments
 (0)