Skip to content

Commit

Permalink
ci(chaosnet): avoid building on cache injected directories
Browse files Browse the repository at this point in the history
  • Loading branch information
helder-moreira committed Feb 13, 2025
1 parent b3c8d07 commit b6eba18
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 25 deletions.
4 changes: 3 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
temp/
build/
*.md
*.md
go-pkg
**/go-pkg
14 changes: 7 additions & 7 deletions .github/workflows/chaosnet-docker.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Chaosnet Docker Image

on:
push:
branches:
- main
tags:
- v*
on: ["push"]
# push:
# branches:
# - main
# tags:
# - v*

jobs:
chaosnet:
Expand Down Expand Up @@ -39,7 +39,7 @@ jobs:
go-build
go-pkg
nibiru-temp
key: ${{ runner.os }}-build-cache-${{ hashFiles('go.sum') }}
key: ${{ runner.os }}-chaosnet-build-cache-${{ hashFiles('go.sum') }}

- name: Inject cache
uses: reproducible-containers/buildkit-cache-dance@v3.1.0
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#2207](https://github.com/NibiruChain/nibiru/pull/2207) - chore(ci): add cache for chaosnet builds
- [#2209](https://github.com/NibiruChain/nibiru/pull/2209) - refator(ci):
Simplify GitHub actions based on conditional paths, removing the need for files like ".github/workflows/skip-unit-tests.yml".
- [#2211](https://github.com/NibiruChain/nibiru/pull/2211) - ci(chaosnet): avoid building on cache injected directories

## [v2.0.0-p1](https://github.com/NibiruChain/nibiru/releases/tag/v2.0.0-p1) - 2025-02-10

Expand Down
9 changes: 3 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@ FROM golang:1.21 AS builder
WORKDIR /nibiru

# install OS dependencies
COPY Makefile ./
COPY contrib/ ./contrib
RUN make packages
RUN apt-get update && apt-get install -y --no-install-recommends \
liblz4-dev libsnappy-dev zlib1g-dev libbz2-dev libzstd-dev

# install Go dependencies
COPY go.sum go.mod ./
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
go mod download
RUN go mod download

# build nibid
COPY . .
Expand Down
11 changes: 4 additions & 7 deletions contrib/docker/chaosnet.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@ FROM golang:1.21 AS builder
WORKDIR /nibiru

# install OS dependencies
COPY Makefile ./
COPY contrib/ ./contrib
RUN make packages
RUN apt-get update && apt-get install -y --no-install-recommends \
liblz4-dev libsnappy-dev zlib1g-dev libbz2-dev libzstd-dev

# install Go dependencies
COPY go.sum go.mod ./
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
go mod download
COPY go.sum go.mod ./
RUN go mod download

# build nibid
COPY . .
Expand Down
2 changes: 1 addition & 1 deletion contrib/make/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ packages:
# command for make build and make install
build: BUILDARGS=-o $(BUILDDIR)/
build install: go.sum $(BUILDDIR)/ rocksdblib wasmvmlib packages
CGO_ENABLED=1 CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" go $@ -mod=readonly -trimpath $(BUILD_FLAGS) $(BUILDARGS) ./...
CGO_ENABLED=1 CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" go $@ -mod=readonly -trimpath $(BUILD_FLAGS) $(BUILDARGS) ./cmd/...

# ensure build directory exists
$(BUILDDIR)/:
Expand Down
6 changes: 3 additions & 3 deletions contrib/make/release.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

PACKAGE_NAME := github.com/NibiruChain/nibiru
GOLANG_CROSS_VERSION ?= v1.21.5
CMT_VERSION := $(shell go list -m github.com/cometbft/cometbft | sed 's:.* ::')
CMT_VERSION = $(shell go list -m github.com/cometbft/cometbft | sed 's:.* ::')

DOCKER_YQ = docker run --rm -v $(PWD):/work -w /work mikefarah/yq:4

DARWIN_TAGS := $(shell $(DOCKER_YQ) e \
DARWIN_TAGS = $(shell $(DOCKER_YQ) e \
'.builds | map(select(.id == "darwin")) | .[0].tags | join(",")' \
.goreleaser.yml)

LINUX_TAGS := $(shell $(DOCKER_YQ) e \
LINUX_TAGS = $(shell $(DOCKER_YQ) e \
'.builds | map(select(.id == "linux")) | .[0].tags | join(",")' \
.goreleaser.yml)

Expand Down

0 comments on commit b6eba18

Please sign in to comment.