From 49746c89153ff2ead3b14ab2af171156a602329b Mon Sep 17 00:00:00 2001 From: Jacqueline Zhang Date: Wed, 29 May 2024 16:08:19 +0800 Subject: [PATCH] add workflow --- .github/workflows/run-e2e-test.yml | 63 ++++++++++++++++++ .../workflows/run-full-regression-test.yml | 65 +++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 .github/workflows/run-e2e-test.yml create mode 100644 .github/workflows/run-full-regression-test.yml diff --git a/.github/workflows/run-e2e-test.yml b/.github/workflows/run-e2e-test.yml new file mode 100644 index 0000000..97db124 --- /dev/null +++ b/.github/workflows/run-e2e-test.yml @@ -0,0 +1,63 @@ +name: Run E2E Test + +on: + push: + branches: [ "main" ] + + pull_request: + branches: [ "main" ] + + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.x] + + steps: + - name: Check Out Repository Code + uses: actions/checkout@v4 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + + - name: Fork Sepolia + run: | + anvil --fork-url https://sepolia.infura.io/v3/2f7bda55539a457686c696e9b3be21f1 & + + - name: Install Dependencies + run: | + npm install + + - name: 'Create env file' + run: | + touch .env + echo WALLET_PRIVATE_KEY_A = ${{ secrets.WALLET_PRIVATE_KEY_A }} >> .env + echo WALLET_PRIVATE_KEY_B = ${{ secrets.WALLET_PRIVATE_KEY_B }} >> .env + echo WALLET_PRIVATE_KEY_C = ${{ secrets.WALLET_PRIVATE_KEY_C }} >> .env + echo SEPOLIA_MINTING_FEE_TOKEN = ${{ secrets.SEPOLIA_MINTING_FEE_TOKEN }} >> .env + echo SEPOLIA_RPC_PROVIDER_URL = http://localhost:8545 >> .env + echo SEPOLIA_MOCK_ERC721_ADDRESS = ${{ vars.SEPOLIA_NFT_CONTRACT_ADDRESS }} >> .env + echo SEPOLIA_LICENSING_MODULE_ADDRESS = ${{ vars.SEPOLIA_LICENSING_MODULE_ADDRESS }} >> .env + echo SEPOLIA_ROYALTY_POLICY_LAP_ADDRESS = ${{ vars.SEPOLIA_ROYALTY_POLICY_LAP_ADDRESS }} >> .env + echo SEPOLIA_DISPUTE_MODULE_ADDRESS = ${{ vars.SEPOLIA_DISPUTE_MODULE_ADDRESS }} >> .env + echo SEPOLIA_IPASSET_REGISTRY_ADDRESS = ${{ vars.SEPOLIA_IPASSET_REGISTRY_ADDRESS }} >> .env + cat .env + + - name: Run E2E Test in Sepolia + run: | + npm run test:sepolia:e2e + - name: Upload Test Report + uses: actions/upload-artifact@v4 + with: + name: sdk-sepolia-test-report + path: | + ./mochawesome-report diff --git a/.github/workflows/run-full-regression-test.yml b/.github/workflows/run-full-regression-test.yml new file mode 100644 index 0000000..4db2b7c --- /dev/null +++ b/.github/workflows/run-full-regression-test.yml @@ -0,0 +1,65 @@ +name: Run Full Regression Test + +on: + push: + branches: [ "add-workflow" ] + + pull_request: + branches: [ "main" ] + + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.x] + + steps: + - name: Check Out Repository Code + uses: actions/checkout@v4 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + + - name: Fork Sepolia + run: | + anvil --fork-url https://sepolia.infura.io/v3/2f7bda55539a457686c696e9b3be21f1 & + + - name: Install Dependencies + run: | + npm install + + - name: 'Create env file' + run: | + touch .env + echo WALLET_PRIVATE_KEY_A = ${{ secrets.WALLET_PRIVATE_KEY_A }} >> .env + echo WALLET_PRIVATE_KEY_B = ${{ secrets.WALLET_PRIVATE_KEY_B }} >> .env + echo WALLET_PRIVATE_KEY_C = ${{ secrets.WALLET_PRIVATE_KEY_C }} >> .env + echo SEPOLIA_MINTING_FEE_TOKEN = ${{ secrets.SEPOLIA_MINTING_FEE_TOKEN }} >> .env + echo SEPOLIA_RPC_PROVIDER_URL = http://localhost:8545 >> .env + echo SEPOLIA_MOCK_ERC721_ADDRESS = ${{ vars.SEPOLIA_NFT_CONTRACT_ADDRESS }} >> .env + echo SEPOLIA_LICENSING_MODULE_ADDRESS = ${{ vars.SEPOLIA_LICENSING_MODULE_ADDRESS }} >> .env + echo SEPOLIA_ROYALTY_POLICY_LAP_ADDRESS = ${{ vars.SEPOLIA_ROYALTY_POLICY_LAP_ADDRESS }} >> .env + echo SEPOLIA_DISPUTE_MODULE_ADDRESS = ${{ vars.SEPOLIA_DISPUTE_MODULE_ADDRESS }} >> .env + echo SEPOLIA_IPASSET_REGISTRY_ADDRESS = ${{ vars.SEPOLIA_IPASSET_REGISTRY_ADDRESS }} >> .env + cat .env + + - name: Run E2E Test in Sepolia + run: | + npm run test:sepolia + + - name: Upload Test Report + uses: actions/upload-artifact@v4 + with: + name: sdk-sepolia-test-report + path: | + ./mochawesome-report + if: always()