Skip to content

Commit

Permalink
Fix CI / builds
Browse files Browse the repository at this point in the history
  • Loading branch information
peak3d committed Dec 31, 2022
1 parent 05dee65 commit fcbc50e
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 26 deletions.
22 changes: 13 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,25 @@ name: build-check

on:
push:
branches: [chain4travel]
branches: [chain4travel, dev]
pull_request:
branches: [chain4travel]
branches: [chain4travel, dev]
jobs:
lint:
name: lint
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
strategy:
matrix:
go:
- '1.19.1'
- '1.18'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Submodules
run: git submodule update --init --recursive
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.41.1
version: v1.47.0
args: --timeout 5m
skip-go-installation: true
test-and-build:
Expand All @@ -27,7 +29,7 @@ jobs:
strategy:
matrix:
go:
- '1.19.1'
- '1.18'
services:
mysql:
image: mysql:8.0.26
Expand All @@ -38,8 +40,10 @@ jobs:
MYSQL_DATABASE: magellan_test
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
- uses: actions/checkout@v3
- name: Submodules
run: git submodule update --init --recursive
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}

Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Submodules
run: git submodule update --init --recursive
- name: Set output
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: Log in to Docker Hub
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASS }}
- name: Push to Docker Hub
uses: docker/build-push-action@v2
uses: docker/build-push-action@v3
with:
push: true
tags: c4tplatform/magellan:${{ steps.vars.outputs.tag }}
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ linters:
- goconst
- gocritic
- gocyclo
- godox
# - godox
- gofmt
- goimports
- golint
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Create base builder image
FROM golang:1.19.1-alpine3.16 AS builder
FROM golang:1.18.8-alpine3.16 AS builder
WORKDIR /go/src/github.com/chain4travel/magellan
RUN apk add --no-cache alpine-sdk bash git make gcc musl-dev linux-headers git ca-certificates g++ libstdc++


# Build app
COPY . .
RUN if [ -d "./vendor" ];then export MOD=vendor; else export MOD=mod; fi && \
GOOS=linux GOARCH=amd64 CGO_CFLAGS="-O -D__BLST_PORTABLE__" go build -mod=$MOD -o /opt/magelland ./cmds/magelland/*.go
GOOS=linux GOARCH=amd64 go build -mod=$MOD -o /opt/magelland ./cmds/magelland/*.go

# Create final image
FROM alpine:3.16 as execution
Expand Down
1 change: 1 addition & 0 deletions models/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ var (
TransactionTypeAddDaoVote TransactionType = 0x20

// Camino Custom Datatypes

RegisterTransactionTypeCustom TransactionType = 8192
RegisterOutputTypeCustom OutputType = 8192

Expand Down
4 changes: 3 additions & 1 deletion scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ fi

TARGET="./..."

go install -v github.com/golangci/golangci-lint/cmd/[email protected]
if ! [ -x "$(command -v golangci-lint)" ]; then
go install -v github.com/golangci/golangci-lint/cmd/[email protected]
fi
golangci-lint run --config .golangci.yml

echo "ALL SUCCESS!"
5 changes: 3 additions & 2 deletions services/indexes/pvm/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ func (w *Writer) Consume(ctx context.Context, conns *utils.Connections, c servic
}

func (w *Writer) Bootstrap(ctx context.Context, conns *utils.Connections, persist db.Persist, gc *utils.GenesisContainer) error {

txDupCheck := set.NewSet[ids.ID](2*len(gc.Genesis.Camino.AddressStates) +
2*len(gc.Genesis.Camino.ConsortiumMembersNodeIDs))

Expand Down Expand Up @@ -225,7 +224,8 @@ func (w *Writer) Bootstrap(ctx context.Context, conns *utils.Connections, persis
}
}

platformTx := append(gc.Genesis.Validators, gc.Genesis.Chains...)
platformTx := gc.Genesis.Validators
platformTx = append(platformTx, gc.Genesis.Chains...)
platformTx = append(platformTx, gc.Genesis.Camino.Deposits...)

for _, tx := range platformTx {
Expand Down Expand Up @@ -381,6 +381,7 @@ func (w *Writer) indexCommonBlock(
return ctx.Persist().InsertPvmBlocks(ctx.Ctx(), ctx.DB(), pvmBlocks, cfg.PerformUpdates)
}

//nolint:gocyclo
func (w *Writer) indexTransaction(ctx services.ConsumerCtx, blkID ids.ID, tx *txs.Tx, genesis bool) error {
var (
txID = tx.ID()
Expand Down
10 changes: 2 additions & 8 deletions stream/producer_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,15 +448,9 @@ func IndexNotReady(err error) bool {
}

func ChainNotReady(err error) bool {
if strings.HasPrefix(err.Error(), "received status code '404'") {
return true
}
return false
return strings.HasPrefix(err.Error(), "received status code '404'")
}

func ZeroAcceptedContainers(err error) bool {
if strings.Contains(err.Error(), "no containers have been accepted") {
return true
}
return false
return strings.Contains(err.Error(), "no containers have been accepted")
}

0 comments on commit fcbc50e

Please sign in to comment.