Skip to content

Commit

Permalink
feat: add PR test for coprocessor
Browse files Browse the repository at this point in the history
  • Loading branch information
david-zk committed Oct 2, 2024
1 parent fad8404 commit 234a0d8
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 2 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/coprocessor-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Run PR test

on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
coprocessor_test:
permissions:
contents: read
runs-on: "large_ubuntu_32"
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
steps:
- name: Check out repo
uses: actions/checkout@v4

- name: Install protobuf compiler
run: sudo apt-get install -y protobuf-compiler

- name: Install sqlx-cli from crates.io
uses: baptiste0928/cargo-install@v3
with:
crate: sqlx-cli
version: '^0.8'

- name: Setup database
working-directory: ./fhevm-engine/coprocessor
run: |
make init_db
# build with --release flag for faster tests
cargo build --release
cargo build --tests --release
COPROCESSOR_TEST_LOCAL_DB=true cargo test --release -- --nocapture
4 changes: 2 additions & 2 deletions fhevm-engine/coprocessor/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ build:

.PHONY: cleanup
cleanup:
docker compose down -v
docker compose -f docker-compose.test.yml down -v

.PHONY: init_db
init_db:
docker compose up -d
docker compose -f docker-compose.test.yml up -d
sleep 3
$(DB_URL) sqlx db create
$(DB_URL) sqlx migrate run
Expand Down
15 changes: 15 additions & 0 deletions fhevm-engine/coprocessor/docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: '3.8'
services:
db:
image: postgres:15.7
restart: always
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
ports:
- '5432:5432'
volumes:
- db:/var/lib/postgresql/data
volumes:
db:
driver: local

0 comments on commit 234a0d8

Please sign in to comment.