Skip to content
This repository has been archived by the owner on Jun 9, 2024. It is now read-only.

chore(ci): Releaser #713

Closed
wants to merge 11 commits into from
Closed
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
49 changes: 49 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: release

on:
push:
workflow_dispatch:

permissions:
contents: write
packages: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.20.4
check-latest: true
- name: release dry run
run: make release-dry-run



# .github/workflows/nightly.yml
name: goreleaser-nightly

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-go@v2
with:
go-version: 1.19
- uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser-pro
version: latest
args: release --clean --nightly
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Your GoReleaser Pro key:
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,7 @@ node_modules
next-env.d.ts
.env
out

dist/

dist/
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ help:

# Rule to setup the project. This is a special case because it's not a Mage target.
setup:
@go run magefiles/setup/setup.go
@go run magefiles/setup/setup.go
2 changes: 1 addition & 1 deletion contracts/lib/forge-std
36 changes: 29 additions & 7 deletions cosmos/docker/base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,18 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#######################################################
### Stage 0 - Build Arguments ###
#######################################################

ARG GO_VERSION=1.20.4
ARG GOARCH=arm64
ARG GOOS=darwin
ARG GOOS=linux
ARG NAME=polaris-cosmos
ARG APP_NAME=polard
ARG DB_BACKEND=pebbledb
ARG CMD_PATH=./cosmos/cmd/polard
ARG FOUNDRY_DIR=./contracts

#######################################################
### Stage 1 - Build Solidity Bindings ###
Expand Down Expand Up @@ -53,31 +62,44 @@ COPY . .
ARG FOUNDRY_DIR
COPY --from=foundry /workdir/${FOUNDRY_DIR}/out /workdir/${FOUNDRY_DIR}/out

# Build berad binary
# Build args
ARG NAME
ARG GOARCH
ARG GOOS
ARG APP_NAME
ARG DB_BACKEND
ARG CMD_PATH

# Build Executable
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/root/go/pkg/mod \
VERSION=$(echo $(git describe --tags) | sed 's/^v//') && \
COMMIT=$(git log -1 --format='%H') && \
env GOOS=${GOOS} GOARCH=${GOARCH} && \
env NAME=${NAME} DB_BACKEND=${DB_BACKEND} && \
env APP_NAME=${APP_NAME} && \
go build \
-mod=readonly \
-tags "netgo,ledger,muslc" \
-ldflags "-X github.com/cosmos/cosmos-sdk/version.Name="polaris-cosmos" \
-X github.com/cosmos/cosmos-sdk/version.AppName="polard" \
-ldflags "-X github.com/cosmos/cosmos-sdk/version.Name=$NAME \
-X github.com/cosmos/cosmos-sdk/version.AppName=$APP_NAME \
-X github.com/cosmos/cosmos-sdk/version.Version=$VERSION \
-X github.com/cosmos/cosmos-sdk/version.Commit=$COMMIT \
-X github.com/cosmos/cosmos-sdk/version.BuildTags='netgo,ledger,muslc' \
-X github.com/cosmos/cosmos-sdk/types.DBBackend="pebbledb" \
-X github.com/cosmos/cosmos-sdk/types.DBBackend=$DB_BACKEND \
-w -s -linkmode=external -extldflags '-Wl,-z,muldefs -static'" \
-trimpath \
-o /workdir/bin/ \
./cosmos/cmd/polard
${CMD_PATH}

#######################################################
### Stage 3 - Prepare the Final Image ###
#######################################################

FROM golang:${GO_VERSION}-alpine

# Build args
ARG APP_NAME

# Copy over built executable into a fresh container.
COPY --from=builder /workdir/bin/polard /bin/
COPY --from=builder /workdir/bin/${APP_NAME} /bin/
2 changes: 1 addition & 1 deletion cosmos/docker/local/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ARG POLARD_VERSION=v0.0.0
#######################################################

# Use the latest foundry image
FROM polard:${POLARD_VERSION} as localpolard
FROM polard-base:${POLARD_VERSION} as localpolard

RUN apk add --no-cache bash jq

Expand Down
20 changes: 0 additions & 20 deletions cosmos/docker/local/docker-compose.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion cosmos/docker/rpc/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ ARG GOOS=darwin
ARG POLARD_VERSION=v0.0.0

# Use the latest foundry image
FROM polard:${POLARD_VERSION} as rpcpolard
FROM polard-base:${POLARD_VERSION} as rpcpolard
2 changes: 1 addition & 1 deletion cosmos/docker/sentry/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ ARG GOOS=darwin
ARG POLARD_VERSION=v0.0.0

# Use the latest foundry image
FROM polard:${POLARD_VERSION} as sentrypolard
FROM polard-base:${POLARD_VERSION} as sentrypolard
2 changes: 1 addition & 1 deletion cosmos/docker/validator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ ARG GOOS=darwin
ARG POLARD_VERSION=v0.0.0

# Use the latest foundry image
FROM polard:${POLARD_VERSION} as valpolard
FROM polard-base:${POLARD_VERSION} as valpolard
20 changes: 11 additions & 9 deletions cosmos/testing/integration/fixture.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ import (
)

// defaultTimeout is the default timeout for the test fixture.
const defaultTimeout = 10 * time.Second

const defaultNumberOfAccounts = 3
const (
fiveHundredError = 500
defaultTimeout = 10 * time.Second
defaultNumberOfAccounts = 3
)

var defaultAccountNames = []string{"alice", "bob", "charlie"}

Expand Down Expand Up @@ -146,25 +148,25 @@ func (tf *TestFixture) SendGraphQLRequest(query string) (string, int, error) {
"query": query,
})
if err != nil {
return "", 500, err
return "", fiveHundredError, err
}

req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(requestBody))
req, err := http.NewRequestWithContext(context.Background(), http.MethodPost, url, bytes.NewBuffer(requestBody))
if err != nil {
return "", 500, err
return "", fiveHundredError, err
}
req.Header.Set("Content-Type", "application/json")

resp, err := tf.EthGraphQLClient.Do(req)
if err != nil {
return "", 500, err
return "", fiveHundredError, err
}
defer resp.Body.Close()
defer resp.Body.Close() //#nosec:G307 // only used in testing.

responseBody, err := io.ReadAll(resp.Body)
responseStatusCode := resp.StatusCode
if err != nil {
return "", 500, err
return "", fiveHundredError, err
}

return string(responseBody), responseStatusCode, nil
Expand Down
1 change: 1 addition & 0 deletions cosmos/testing/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ type (
Config = network.Config
)

//nolint:gochecknoinits // i hate cosmos.
func init() {
config.SetupCosmosConfig()
}
Expand Down
Loading