-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (48 loc) · 1.46 KB
/
powervoting-backend.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# 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 ./...