Skip to content

Commit

Permalink
chore: add go-cache
Browse files Browse the repository at this point in the history
  • Loading branch information
albttx committed May 9, 2024
1 parent 2a92e72 commit 84acee8
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 7 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Go Build Cache for Docker
uses: actions/cache@v3
with:
path: go-build-cache
key: ${{ runner.os }}-go-build-cache-${{ hashFiles('**/go.sum') }}

- name: inject go-build-cache into docker
# v1 was composed of two actions: "inject" and "extract".
# v2 is unified to a single action.
uses: reproducible-containers/buildkit-cache-dance@v2.1.2
with:
cache-source: go-build-cache

- name: Build and push
uses: docker/build-push-action@v5
with:
Expand Down Expand Up @@ -76,6 +89,19 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Go Build Cache for Docker
uses: actions/cache@v3
with:
path: go-build-cache
key: ${{ runner.os }}-go-build-cache-${{ hashFiles('**/go.sum') }}

- name: inject go-build-cache into docker
# v1 was composed of two actions: "inject" and "extract".
# v2 is unified to a single action.
uses: reproducible-containers/buildkit-cache-dance@v2.1.2
with:
cache-source: go-build-cache

- name: Build and push
uses: docker/build-push-action@v5
with:
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/portal-loop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,10 @@ jobs:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

build-gno:
uses: ./.github/workflows/docker.yml

test-portal-loop:
runs-on: ubuntu-latest
needs: build-gno
19 changes: 12 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
# build gno
FROM golang:1.22 AS build-gno
RUN go env -w GOMODCACHE=/root/.cache/go-build
RUN mkdir -p /opt/gno/src /opt/build
WORKDIR /opt/build
ADD go.mod go.sum .
RUN go mod download
RUN --mount=type=cache,target=/root/.cache/go-build go mod download
ADD . ./
RUN go build -o ./build/gnoland ./gno.land/cmd/gnoland
RUN go build -o ./build/gnokey ./gno.land/cmd/gnokey
RUN go build -o ./build/gnoweb ./gno.land/cmd/gnoweb
RUN go build -o ./build/gno ./gnovm/cmd/gno
RUN --mount=type=cache,target=/root/.cache/go-build go build -o ./build/gnoland ./gno.land/cmd/gnoland
RUN --mount=type=cache,target=/root/.cache/go-build go build -o ./build/gnokey ./gno.land/cmd/gnokey
RUN --mount=type=cache,target=/root/.cache/go-build go build -o ./build/gnoweb ./gno.land/cmd/gnoweb
RUN --mount=type=cache,target=/root/.cache/go-build go build -o ./build/gno ./gnovm/cmd/gno
RUN ls -la ./build
ADD . /opt/gno/src/
RUN rm -rf /opt/gno/src/.git

# build faucet
FROM golang:1.22 AS build-faucet
RUN go env -w GOMODCACHE=/root/.cache/go-build
RUN mkdir -p /opt/gno/src /opt/build
RUN mkdir -p /opt/gno/src /opt/build
WORKDIR /opt/build
ADD contribs/gnofaucet/go.mod contribs/gnofaucet/go.sum .
RUN go mod download
# RUN go mod download
RUN --mount=type=cache,target=/root/.cache/go-build go mod download
ADD contribs/gnofaucet ./
RUN go build -o ./build/gnofaucet .
# RUN go build -o ./build/gnofaucet .
RUN --mount=type=cache,target=/root/.cache/go-build go build -o ./build/gnofaucet .


# runtime-base + runtime-tls
Expand Down

0 comments on commit 84acee8

Please sign in to comment.