Skip to content

Commit

Permalink
feat: Add goreleaser
Browse files Browse the repository at this point in the history
Added goreleaser for main go project only (gno, gnoland, gnoweb,
gnokey). To add other Go projects like faucet we need goreleaser-pro.

Also added the creation of nightly builds that can be used for anyone to
test latest features.

Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
  • Loading branch information
ajnavarro committed May 14, 2024
1 parent d7c04be commit 08ec0d9
Show file tree
Hide file tree
Showing 11 changed files with 560 additions and 147 deletions.
445 changes: 445 additions & 0 deletions .github/goreleaser.yaml

Large diffs are not rendered by default.

78 changes: 0 additions & 78 deletions .github/workflows/DELETEdocker.yml

This file was deleted.

50 changes: 50 additions & 0 deletions .github/workflows/nightlies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Trigger nightly build

on:
schedule:
- cron: '0 0 * * 2-6'
workflow_dispatch:

jobs:
trigger-nightly:
name: Push tag for nightly build
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: 'Push new tag'
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
# A previous release was created using a lightweight tag
# git describe by default includes only annotated tags
# git describe --tags includes lightweight tags as well
DESCRIBE=`git tag -l --sort=-v:refname | grep -v nightly | head -n 1`
MAJOR_VERSION=`echo $DESCRIBE | awk '{split($0,a,"."); print a[1]}'`
MINOR_VERSION=`echo $DESCRIBE | awk '{split($0,a,"."); print a[2]}'`
MINOR_VERSION="$((${MINOR_VERSION} + 1))"
TAG="${MAJOR_VERSION}.${MINOR_VERSION}.0-nightly.$(date +'%Y%m%d')"
git tag -a $TAG -m "$TAG: nightly build"
git push origin $TAG
- name: 'Clean up nightly releases'
uses: dev-drprasad/delete-older-releases@v0.3.3
with:
keep_latest: 5
delete_tags: true
delete_tag_pattern: nightly
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 'Delete nightly containers older than a week'
uses: snok/container-retention-policy@v2.1.2
with:
image-names: gnolang/gno*
cut-off: 1 week ago UTC
account-type: org
org-name: gnolang
keep-at-least: 5
token: ${{ secrets.GITHUB_TOKEN }}
filter-tags: '*-nightly*'
43 changes: 43 additions & 0 deletions .github/workflows/releaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Go Releaser

on:
push:
tags:
- "v*"

permissions:
contents: write # needed to write releases
id-token: write # needed for keyless signing
packages: write # needed for ghcr access

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-go@v5
with:
go-version: "1.22.x"
cache: true

- uses: sigstore/cosign-installer@v3.5.0
- uses: anchore/sbom-action/download-syft@v0.15.10

- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --clean --config ./.github/goreleaser.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ genesis.json

# Build leftovers
build
dist

# Legacy .gitignore
data/*
Expand Down
66 changes: 0 additions & 66 deletions Dockerfile

This file was deleted.

4 changes: 4 additions & 0 deletions Dockerfile.gno.release
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM scratch
COPY . /
ENTRYPOINT [ "/gno" ]
CMD [ "" ]
4 changes: 4 additions & 0 deletions Dockerfile.gnokey.release
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM scratch
COPY . /
ENTRYPOINT [ "/gnokey" ]
CMD [ "" ]
5 changes: 5 additions & 0 deletions Dockerfile.gnoland.release
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM scratch
COPY . /
EXPOSE 26657 36657
ENTRYPOINT [ "/gnoland" ]
CMD [ "" ]
5 changes: 5 additions & 0 deletions Dockerfile.gnoweb.release
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM scratch
COPY . /
EXPOSE 8888
ENTRYPOINT [ "/gnoweb" ]
CMD [ "" ]
6 changes: 3 additions & 3 deletions gnovm/tests/imports.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,16 +258,16 @@ func TestStore(rootDir, filesPath string, stdin io.Reader, stdout, stderr io.Wri
pkg.DefineGoNativeValue("Pi", math.Pi)
pkg.DefineGoNativeValue("MaxFloat32", math.MaxFloat32)
pkg.DefineGoNativeValue("MaxFloat64", math.MaxFloat64)
pkg.DefineGoNativeValue("MaxUint32", math.MaxUint32)
pkg.DefineGoNativeValue("MaxUint32", uint32(math.MaxUint32))
pkg.DefineGoNativeValue("MaxUint64", uint64(math.MaxUint64))
pkg.DefineGoNativeValue("MinInt8", math.MinInt8)
pkg.DefineGoNativeValue("MinInt16", math.MinInt16)
pkg.DefineGoNativeValue("MinInt32", math.MinInt32)
pkg.DefineGoNativeValue("MinInt64", math.MinInt64)
pkg.DefineGoNativeValue("MinInt64", int64(math.MinInt64))
pkg.DefineGoNativeValue("MaxInt8", math.MaxInt8)
pkg.DefineGoNativeValue("MaxInt16", math.MaxInt16)
pkg.DefineGoNativeValue("MaxInt32", math.MaxInt32)
pkg.DefineGoNativeValue("MaxInt64", math.MaxInt64)
pkg.DefineGoNativeValue("MaxInt64", int64(math.MaxInt64))
return pkg, pkg.NewPackage()
case "math/rand":
// XXX only expose for tests.
Expand Down

0 comments on commit 08ec0d9

Please sign in to comment.