From eed18b1b3b8395c8356fe7fb615cc43816c25884 Mon Sep 17 00:00:00 2001 From: mashharuki Date: Sun, 9 Jun 2024 10:39:00 +0900 Subject: [PATCH] chore: Update GitHub Actions workflow to fix path for frontend artifact upload --- .github/workflows/ci.yml | 8 ++++---- LICENSE | 21 +++++++++++++++++++++ pkgs/backend/test/HelloWorld.test.ts | 23 +++++++++++++++++++---- pkgs/frontend/src/pages/index.tsx | 2 ++ 4 files changed, 46 insertions(+), 8 deletions(-) create mode 100644 LICENSE diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d3bc48a..007b3e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Build and Deploy to GitHub Pages +name: Build and Test on GitHub Actions on: push: @@ -65,7 +65,7 @@ jobs: - name: Install dependencies run: yarn install - + # テストコマンドを実行 - name: Test Smart Contract run: yarn backend test @@ -96,7 +96,7 @@ jobs: - name: Install dependencies run: yarn install - + # ビルドコマンドを実行 - name: Build run: yarn frontend build env: @@ -121,7 +121,7 @@ jobs: name: github-pages path: ./pkgs/frontend/out retention-days: 5 - + # デプロイ自体はうまく行くもののアプリの挙動がおかしいので一旦はNetlifyにデプロイした方が良い。 - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..049a75d --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Haruki Kondo + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/pkgs/backend/test/HelloWorld.test.ts b/pkgs/backend/test/HelloWorld.test.ts index 17e61d0..cfd9f65 100644 --- a/pkgs/backend/test/HelloWorld.test.ts +++ b/pkgs/backend/test/HelloWorld.test.ts @@ -2,19 +2,25 @@ import {expect} from "chai"; import {ethers} from "hardhat"; /** - * deploy HelloWorld contract method + * deploy HelloWorld & SampleForwarder contract method * @returns */ async function deployHelloWorld() { const [owner] = await ethers.getSigners(); + const SampleForwarder = await ethers.getContractFactory("SampleForwarder"); + const sampleForwarder = await SampleForwarder.deploy(); const HelloWorld = await ethers.getContractFactory("HelloWorld"); - const helloWorld = await HelloWorld.deploy(owner.address); - return helloWorld; + const helloWorld = await HelloWorld.deploy(sampleForwarder.target); + return { + helloWorld, + sampleForwarder, + owner, + }; } describe("HelloWorld contract", function () { it("Deployment should assign the total supply of tokens to the owner", async function () { - const helloWorld = await deployHelloWorld(); + const {helloWorld} = await deployHelloWorld(); const initialText = await helloWorld.text(); expect(initialText).to.equal(""); @@ -25,4 +31,13 @@ describe("HelloWorld contract", function () { const updatedText = await helloWorld.text(); expect(updatedText).to.equal(newText); }); + + it("Check SampleForwarder Address", async function () { + const {helloWorld, sampleForwarder} = await deployHelloWorld(); + + // get SampleForwarder address + const sampleForwarderAddress = await helloWorld.trustedForwarder(); + // chek SampleForwarder address + expect(sampleForwarderAddress).to.equal(sampleForwarder.target); + }); }); diff --git a/pkgs/frontend/src/pages/index.tsx b/pkgs/frontend/src/pages/index.tsx index a8a8493..953978e 100644 --- a/pkgs/frontend/src/pages/index.tsx +++ b/pkgs/frontend/src/pages/index.tsx @@ -67,9 +67,11 @@ export default function Home() {

Your Balance

{intmaxContext.balance} ETH

+ {/* + */}