Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing the github workflow. #341

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 110 additions & 6 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,29 +49,130 @@ jobs:
cd $GOPATH/src/github.com/${{ github.repository }}/cmd/utreexoclient
go build -v

- name: Run unit tests

run-unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
needs: Build
timeout-minutes: 5
steps:
- name: setup directory
shell: bash
run: |
mkdir -p "${{ github.workspace }}/testdatapath"

# set GOPATH
- name: setup env
shell: bash
run: |
echo "${{ github.workspace }}/go/bin:" >> $GITHUB_PATH
echo "GOPATH=${{ github.workspace }}/go" >> $GITHUB_ENV

- name: Install Go
if: success()
uses: actions/setup-go@v1
with:
go-version: 1.13
id: go

- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 1
path: go/src/github.com/${{ github.repository }}

- name: Get dependencies
run: |
cd $GOPATH/src/github.com/${{ github.repository }}
go get -v -d ./...

- name: Build
shell: bash
run: |
cd $GOPATH/src/github.com/${{ github.repository }}/cmd/utreexoserver
go build -v

- name: Build
shell: bash
run: |
cd $GOPATH/src/github.com/${{ github.repository }}/cmd/utreexoclient
go build -v
- name: tests
shell: bash
run: |
cd $GOPATH/src/github.com/${{ github.repository }}
go test -v ./accumulator

- name: Run integration tests
- name: Upload testdata
uses: actions/upload-artifact@v2
with:
name: testdatapath
path: "${{ github.workspace }}/testdatapath"

run-integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
needs: Build
timeout-minutes: 5
steps:
- name: setup directory
shell: bash
run: |
mkdir -p "${{ github.workspace }}/testdatapath"

# set GOPATH
- name: setup env
shell: bash
run: |
echo "${{ github.workspace }}/go/bin:" >> $GITHUB_PATH
echo "GOPATH=${{ github.workspace }}/go" >> $GITHUB_ENV

- name: Install Go
if: success()
uses: actions/setup-go@v1
with:
go-version: 1.13
id: go

- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 1
path: go/src/github.com/${{ github.repository }}

- name: Get dependencies
run: |
cd $GOPATH/src/github.com/${{ github.repository }}
go get -v -d ./...

- name: Build
shell: bash
run: |
cd $GOPATH/src/github.com/${{ github.repository }}/cmd/utreexoserver
go build -v

- name: Build
shell: bash
run: |
cd $GOPATH/src/github.com/${{ github.repository }}/cmd/utreexoclient
go build -v
- name: integration tests
shell: bash
run: |
cd $GOPATH/src/github.com/${{ github.repository }}
./test/install_bitcoind.sh
./test/csn_bridge.sh "./cmd/utreexoserver/utreexoserver" "./cmd/utreexoclient/utreexoclient" "${{ github.workspace }}/testdatapath"

- name: Upload testdata
uses: actions/upload-artifact@v2
with:
name: testdatapath
path: "${{ github.workspace }}/testdatapath"

check-proof-backwards:
name: Check proof backwards compatibility
runs-on: ubuntu-latest
needs: Build
needs: run-unit-tests
timeout-minutes: 5
steps:
# set GOPATH
Expand All @@ -80,10 +181,13 @@ jobs:
run: |
echo "${{ github.workspace }}/go/bin:" >> $GITHUB_PATH
echo "GOPATH=${{ github.workspace }}/go" >> $GITHUB_ENV


- uses: actions/download-artifact@v2
- name: Get TestDataPath
uses: actions/download-artifact@v2
with:
name: testdatapath
path: "${{ github.workspace }}/testdatapath"

- name: Install Go
if: success()
Expand Down
16 changes: 10 additions & 6 deletions accumulator/fuzz.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ import (
func undoOnceFuzzy(data *bytes.Buffer) error {
f := NewForest(RamForest, nil, "", 0)

seed0, err := data.ReadByte();
if err != nil { return nil }
seed1, err := data.ReadByte();
if err != nil { return nil }
seed0, err := data.ReadByte()
if err != nil {
return nil
}
seed1, err := data.ReadByte()
if err != nil {
return nil
}
seed := (int64(seed1) << 8) | int64(seed0)
sc := newSimChainWithSeed(0x07, seed)
if sc == nil {
Expand All @@ -35,7 +39,7 @@ func undoOnceFuzzy(data *bytes.Buffer) error {
if err != nil {
return err
}
beforeRoot := f.getRoots()
beforeRoot := f.GetRoots()
ub, err := f.Modify(adds, bp.Targets)
if err != nil {
return err
Expand All @@ -52,7 +56,7 @@ func undoOnceFuzzy(data *bytes.Buffer) error {
return err
}
sc.BackOne(adds, durations, delHashes)
afterRoot := f.getRoots()
afterRoot := f.GetRoots()
if !reflect.DeepEqual(beforeRoot, afterRoot) {
return fmt.Errorf("undo mismatch")
}
Expand Down