Skip to content

Merge pull request #100 from filecoin-project/feature/powervoting-grpc #8

Merge pull request #100 from filecoin-project/feature/powervoting-grpc

Merge pull request #100 from filecoin-project/feature/powervoting-grpc #8

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Powervoting-backend-test
on:
push:
branches: [ "main" ]
paths:
- 'powervoting-backend/*'
pull_request:
branches: [ "main" ]
paths:
- 'powervoting-backend/*'
jobs:
test:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:latest
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: root
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Install dependencies
run: |
cd ./powervoting-backend
go mod tidy
- name: Initialize MySQL database
run: |
echo $(docker ps -q --filter ancestor=mysql:latest)
docker exec -i $(docker ps -q --filter ancestor=mysql:latest) mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS \`power-voting-filecoin\`;"
- name: Copy config file to test dir
run: |
cd ./powervoting-backend
cp ./abi/* ./contract
cp ./abi/* ./task
cp ./abi/* ./utils
- name: Test
run: |
cd ./powervoting-backend
go test -v ./...