[wip] CI tests
This commit is contained in:
parent
aa3d1aecf5
commit
af452b174c
45
.gitea/workflows/test.yml
Normal file
45
.gitea/workflows/test.yml
Normal file
@ -0,0 +1,45 @@
|
||||
name: Test
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: '*'
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
unit-tests:
|
||||
name: Run unit tests
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
check-latest: true
|
||||
- name: Run tests
|
||||
run: make test
|
||||
|
||||
integration-tests:
|
||||
name: Run integration tests
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GO111MODULE: on
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
check-latest: true
|
||||
- name: Run DB container
|
||||
run: docker compose -f test/compose.yml up --wait
|
||||
# Run a sanity test against the fixture data
|
||||
# Complete integration tests are TODO
|
||||
- name: Run tests
|
||||
run: |
|
||||
cp ./environments/example.toml config.toml
|
||||
go run . --config config.toml \
|
||||
--snapshot-mode postgres \
|
||||
--leveldb-path ./fixture/chain2data \
|
||||
--ancient-path ./fixture/chain2data/ancient \
|
||||
stateSnapshot
|
30
.github/workflows/on-pr.yaml
vendored
30
.github/workflows/on-pr.yaml
vendored
@ -1,30 +0,0 @@
|
||||
name: Docker Build
|
||||
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Run unit tests
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GOPATH: /tmp/go
|
||||
GO111MODULE: on
|
||||
steps:
|
||||
- name: Create GOPATH
|
||||
run: mkdir -p /tmp/go
|
||||
|
||||
- uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: ">=1.19.0"
|
||||
check-latest: true
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Run database
|
||||
run: docker-compose up -d
|
||||
|
||||
- name: Run unit tests
|
||||
run: |
|
||||
sleep 45
|
||||
make dbtest
|
10
Makefile
10
Makefile
@ -9,15 +9,5 @@ $(MOCKS_DIR)/gen_indexer.go:
|
||||
--mock_names Indexer=MockgenIndexer \
|
||||
github.com/cerc-io/plugeth-statediff/indexer Indexer
|
||||
|
||||
clean:
|
||||
rm -f mocks/snapshot/publisher.go
|
||||
|
||||
build:
|
||||
go fmt ./...
|
||||
go build
|
||||
|
||||
test: mocks
|
||||
go clean -testcache && go test -p 1 -v ./...
|
||||
|
||||
dbtest: mocks
|
||||
go clean -testcache && TEST_WITH_DB=true go test -p 1 -v ./...
|
||||
|
@ -1,5 +1,3 @@
|
||||
version: '3.2'
|
||||
|
||||
services:
|
||||
migrations:
|
||||
restart: on-failure
|
||||
@ -22,6 +20,6 @@ services:
|
||||
POSTGRES_DB: "cerc_testing"
|
||||
POSTGRES_PASSWORD: "password"
|
||||
ports:
|
||||
- "127.0.0.1:8077:5432"
|
||||
- 127.0.0.1:8077:5432
|
||||
volumes:
|
||||
- /tmp:/tmp
|
||||
|
Loading…
Reference in New Issue
Block a user