-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f05f73c
commit 5522f24
Showing
11 changed files
with
809 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
|
||
name: e2e tests | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
e2e-tests: | ||
runs-on: ubuntu-latest | ||
env: | ||
NETWORK: "localhost" | ||
ORACLE_ADDRESS: "0x5FbDB2315678afecb367f032d93F642f64180aa3" | ||
TEST_CONTRACT_ADDRESS: "0x8A791620dd6260079BF849Dc5567aDC3F2FdC318" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: 'npm' | ||
cache-dependency-path: contracts/package-lock.json | ||
- name: "Install Dependencies" | ||
id: install | ||
run: cd contracts && npm ci | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
- name: Cache pip | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache/pip | ||
!~/.cache/pip/log | ||
key: ${{ runner.os }}-pip-${{ hashFiles('oracles/requirements.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Install Python Dependencies | ||
run: pip install -r oracles/requirements.txt | ||
- name: Run Hardhat Node | ||
run: cd contracts && npx hardhat node & | ||
- name: "Deploy Contracts" | ||
run: | ||
cd contracts && npm run deployAll:localhost | ||
env: | ||
PRIVATE_KEY_LOCALHOST: ${{ secrets.PRIVATE_KEY }} | ||
- name: "Whitelist the address" | ||
run: | ||
cd contracts && npx hardhat whitelist --oracle-address ${{ env.ORACLE_ADDRESS }} --whitelist-address 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --network localhost | ||
env: | ||
PRIVATE_KEY_LOCALHOST: ${{ secrets.PRIVATE_KEY }} | ||
- name: "Deploy Test Contract" | ||
run: | ||
cd contracts && npm run deployTest:localhost | ||
env: | ||
PRIVATE_KEY_LOCALHOST: ${{ secrets.PRIVATE_KEY }} | ||
ORACLE_ADDRESS: ${{ env.ORACLE_ADDRESS }} | ||
- name: Run Python Oracle | ||
run: | | ||
cd oracles && python oracle.py > oracle_output.txt 2>&1 & | ||
echo $! > python_oracle.pid | ||
env: | ||
CHAIN_ID: 1337 | ||
WEB3_RPC_URL: "http://127.0.0.1:8545/" | ||
ORACLE_ADDRESS: ${{ env.ORACLE_ADDRESS }} | ||
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} | ||
OPEN_AI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }} | ||
SERPER_API_KEY: ${{ secrets.SERPER_API_KEY }} | ||
BEARLY_API_KEY: ${{ secrets.BEARLY_API_KEY }} | ||
PINATA_GATEWAY_TOKEN: ${{ secrets.PINATA_GATEWAY_TOKEN }} | ||
PINATA_API_JWT: ${{ secrets.PINATA_API_JWT }} | ||
- name: "Test 1 - OpenAI gpt-4-turbo-preview" | ||
run: | ||
cd contracts && npx hardhat openai --contract-address ${{ env.TEST_CONTRACT_ADDRESS }} --model gpt-4-turbo-preview --message "Who is the president of USA?" --network ${{ env.NETWORK }} | ||
env: | ||
PRIVATE_KEY_LOCALHOST: ${{ secrets.PRIVATE_KEY }} | ||
- name: "Test 2 - OpenAI gpt-3.5-turbo-1106" | ||
run: | ||
cd contracts && npx hardhat openai --contract-address ${{ env.TEST_CONTRACT_ADDRESS }} --model gpt-3.5-turbo-1106 --message "Who is the president of USA?" --network ${{ env.NETWORK }} | ||
env: | ||
PRIVATE_KEY_LOCALHOST: ${{ secrets.PRIVATE_KEY }} | ||
- name: "Test 3 - Groq llama2-70b-4096" | ||
run: | ||
cd contracts && npx hardhat groq --contract-address ${{ env.TEST_CONTRACT_ADDRESS }} --model llama2-70b-4096 --message "Who is the president of USA?" --network ${{ env.NETWORK }} | ||
env: | ||
PRIVATE_KEY_LOCALHOST: ${{ secrets.PRIVATE_KEY }} | ||
- name: "Test 4 - Groq mixtral-8x7b-32768" | ||
run: | ||
cd contracts && npx hardhat groq --contract-address ${{ env.TEST_CONTRACT_ADDRESS }} --model mixtral-8x7b-32768 --message "Who is the president of USA?" --network ${{ env.NETWORK }} | ||
env: | ||
PRIVATE_KEY_LOCALHOST: ${{ secrets.PRIVATE_KEY }} | ||
- name: "Test 5 - gemma-7b-it" | ||
run: | ||
cd contracts && npx hardhat groq --contract-address ${{ env.TEST_CONTRACT_ADDRESS }} --model gemma-7b-it --message "Who is the president of USA?" --network ${{ env.NETWORK }} | ||
env: | ||
PRIVATE_KEY_LOCALHOST: ${{ secrets.PRIVATE_KEY }} | ||
- name: "Test 6 - Image Generation" | ||
run: | ||
cd contracts && npx hardhat image_generation --contract-address ${{ env.TEST_CONTRACT_ADDRESS }} --query "Red rose" --network ${{ env.NETWORK }} | ||
env: | ||
PRIVATE_KEY_LOCALHOST: ${{ secrets.PRIVATE_KEY }} | ||
- name: "Test 7 - Web search" | ||
run: | ||
cd contracts && npx hardhat web_search --contract-address ${{ env.TEST_CONTRACT_ADDRESS }} --query "Capital of Germany" --network ${{ env.NETWORK }} | ||
env: | ||
PRIVATE_KEY_LOCALHOST: ${{ secrets.PRIVATE_KEY }} | ||
- name: "Test 8 - Code interpreter" | ||
run: | ||
cd contracts && npx hardhat code_interpreter --contract-address ${{ env.TEST_CONTRACT_ADDRESS }} --query "print(2+2)" --network ${{ env.NETWORK }} | ||
env: | ||
PRIVATE_KEY_LOCALHOST: ${{ secrets.PRIVATE_KEY }} | ||
- name: "Test 9 - Add knowledge base" | ||
run: | ||
cd contracts && npx hardhat add_knowledge_base --oracle-address ${{ env.ORACLE_ADDRESS }} --cid QmdCgbMawRVE6Kc1joZmhgDo2mSZFgRgWvBCqUvJV9JwkF --network ${{ env.NETWORK }} | ||
env: | ||
PRIVATE_KEY_LOCALHOST: ${{ secrets.PRIVATE_KEY }} | ||
- name: "Test 10 - Query knowledge base" | ||
run: | ||
cd contracts && npx hardhat query_knowledge_base --contract-address ${{ env.TEST_CONTRACT_ADDRESS }} --cid QmdCgbMawRVE6Kc1joZmhgDo2mSZFgRgWvBCqUvJV9JwkF --query "What is the oracle smart contract address?" --network ${{ env.NETWORK }} | ||
env: | ||
PRIVATE_KEY_LOCALHOST: ${{ secrets.PRIVATE_KEY }} | ||
- name: Display Oracle Output | ||
if: always() # Ensures this step runs even if a previous step fails | ||
run: cat oracles/oracle_output.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM node:20-alpine | ||
|
||
# Set the working directory in the container | ||
WORKDIR /app | ||
|
||
COPY . . | ||
|
||
# Install any dependencies | ||
RUN npm ci | ||
|
||
CMD ["npx", "ts-node", "tasks/e2eCron.ts"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: '3' | ||
services: | ||
app: | ||
build: | ||
context: .. | ||
dockerfile: docker/Dockerfile | ||
volumes: | ||
- ..:/app | ||
restart: "unless-stopped" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.