From d1ca7f1f5ea2103bc3e51be34c07087a6c28a09d Mon Sep 17 00:00:00 2001 From: amitz Date: Sun, 17 Mar 2024 00:28:34 +0200 Subject: [PATCH 01/43] only run for PRs to main --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index abf10f1967..a544c607d0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,6 +5,8 @@ on: branches: - main pull_request: + branches: + - main jobs: lint: From c35264586a92f4af7da151aa46219814ef13d090 Mon Sep 17 00:00:00 2001 From: amitz Date: Sun, 17 Mar 2024 00:30:11 +0200 Subject: [PATCH 02/43] using goreleaser --- .github/workflows/main.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a544c607d0..e22cd594c8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,3 +24,12 @@ jobs: uses: golangci/golangci-lint-action@v3 with: args: --print-issued-lines --config .golangci.yml -v + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v5 + with: + version: latest + args: release --clean + workdir: out + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 8bafa5c4d8d123117218239188485354bf9d26dd Mon Sep 17 00:00:00 2001 From: amitz Date: Sun, 17 Mar 2024 11:01:08 +0200 Subject: [PATCH 03/43] updated main to use go releaser --- .github/workflows/main.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e22cd594c8..eabcc5be2a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,15 +13,15 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: go-version: 1.20.5 - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v4 with: args: --print-issued-lines --config .golangci.yml -v @@ -33,3 +33,9 @@ jobs: workdir: out env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload Artifacts + uses: actions/upload-artifact@v4 + with: + name: lava + path: out/* From c6f4d166cd8c967d2452170b7f880470e7e79a86 Mon Sep 17 00:00:00 2001 From: amitz Date: Sun, 17 Mar 2024 11:08:39 +0200 Subject: [PATCH 04/43] remove working dir --- .github/workflows/main.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index eabcc5be2a..9d61badd21 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -30,12 +30,11 @@ jobs: with: version: latest args: release --clean - workdir: out env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Upload Artifacts - uses: actions/upload-artifact@v4 - with: - name: lava - path: out/* + # - name: Upload Artifacts + # uses: actions/upload-artifact@v4 + # with: + # name: lava + # path: out/* From ce1e4ee2a77280276773f77f5ca1ff1d390b33a0 Mon Sep 17 00:00:00 2001 From: amitz Date: Sun, 17 Mar 2024 11:12:00 +0200 Subject: [PATCH 05/43] fetch-depth: 0 --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9d61badd21..f980040fe3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,6 +19,8 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Lint uses: golangci/golangci-lint-action@v4 From 4455d4fb6314af4ab65a802fcc863873bbe46bd5 Mon Sep 17 00:00:00 2001 From: amitz Date: Sun, 17 Mar 2024 22:30:46 +0200 Subject: [PATCH 06/43] adding goreleaser config files --- .github/workflows/main.yml | 11 +++++----- .gitignore | 2 ++ cmd/lavad/.goreleaser.yaml | 44 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 cmd/lavad/.goreleaser.yaml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f980040fe3..7fbf707b60 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,11 +32,12 @@ jobs: with: version: latest args: release --clean + workdir: cmd/lavad env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # - name: Upload Artifacts - # uses: actions/upload-artifact@v4 - # with: - # name: lava - # path: out/* + - name: Upload Artifacts + uses: actions/upload-artifact@v4 + with: + name: lavad + path: cmd/lavad/dist/* diff --git a/.gitignore b/.gitignore index 2719be8dfd..701735eb0f 100644 --- a/.gitignore +++ b/.gitignore @@ -91,3 +91,5 @@ testutil/e2e/sdk/tests/node_modules.json config/health_examples/health_template_gen.yml # Yarn .yarn/ + +**/dist/ \ No newline at end of file diff --git a/cmd/lavad/.goreleaser.yaml b/cmd/lavad/.goreleaser.yaml new file mode 100644 index 0000000000..d3fb70f3b1 --- /dev/null +++ b/cmd/lavad/.goreleaser.yaml @@ -0,0 +1,44 @@ +# This is an example .goreleaser.yml file with some sensible defaults. +# Make sure to check the documentation at https://goreleaser.com + +# The lines bellow are called `modelines`. See `:help modeline` +# Feel free to remove those if you don't want/need to use them. +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj + +before: + hooks: + # You may remove this if you don't use go modules. + - go mod tidy + # you may remove this if you don't need go generate + - go generate ./... + +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + +archives: + - format: tar.gz + # this name template makes the OS and Arch compatible with the results of `uname`. + name_template: >- + {{ .ProjectName }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} + # use zip for windows archives + format_overrides: + - goos: windows + format: zip + +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:" From 34d3cc0f1bffcd576240e58c34b8384d48095f43 Mon Sep 17 00:00:00 2001 From: amitz Date: Sun, 17 Mar 2024 22:37:32 +0200 Subject: [PATCH 07/43] added docker --- cmd/lavad/.goreleaser.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cmd/lavad/.goreleaser.yaml b/cmd/lavad/.goreleaser.yaml index d3fb70f3b1..03e6460933 100644 --- a/cmd/lavad/.goreleaser.yaml +++ b/cmd/lavad/.goreleaser.yaml @@ -20,6 +20,22 @@ builds: - linux - windows - darwin + goarch: + - amd64 + - arm64 + +dockers: + - image_templates: ["us-central1-docker.pkg.dev/lavanet/lavad:{{ .Version }}"] + dockerfile: Dockerfile + build_flag_templates: + - --label=org.opencontainers.image.title={{ .ProjectName }} + - --label=org.opencontainers.image.description={{ .ProjectName }} + - --label=org.opencontainers.image.url=https://github.com/lavanet/lava + - --label=org.opencontainers.image.source=https://github.com/lavanet/lava + - --label=org.opencontainers.image.version={{ .Version }} + - --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} + - --label=org.opencontainers.image.revision={{ .FullCommit }} + - --label=org.opencontainers.image.licenses=Apache archives: - format: tar.gz From 4412a7e861cd5fc75979aad73197578da2bd6c09 Mon Sep 17 00:00:00 2001 From: amitz Date: Sun, 17 Mar 2024 22:42:41 +0200 Subject: [PATCH 08/43] added config to lavap and visor --- cmd/lavap/.goreleaser.yaml | 60 ++++++++++++++++++++++++++++++++++ cmd/lavavisor/.goreleaser.yaml | 60 ++++++++++++++++++++++++++++++++++ 2 files changed, 120 insertions(+) create mode 100644 cmd/lavap/.goreleaser.yaml create mode 100644 cmd/lavavisor/.goreleaser.yaml diff --git a/cmd/lavap/.goreleaser.yaml b/cmd/lavap/.goreleaser.yaml new file mode 100644 index 0000000000..56f1663c30 --- /dev/null +++ b/cmd/lavap/.goreleaser.yaml @@ -0,0 +1,60 @@ +# This is an example .goreleaser.yml file with some sensible defaults. +# Make sure to check the documentation at https://goreleaser.com + +# The lines bellow are called `modelines`. See `:help modeline` +# Feel free to remove those if you don't want/need to use them. +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj + +before: + hooks: + # You may remove this if you don't use go modules. + - go mod tidy + # you may remove this if you don't need go generate + - go generate ./... + +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + goarch: + - amd64 + - arm64 + +dockers: + - image_templates: ["us-central1-docker.pkg.dev/lavanet/lavap:{{ .Version }}"] + dockerfile: Dockerfile + build_flag_templates: + - --label=org.opencontainers.image.title={{ .ProjectName }} + - --label=org.opencontainers.image.description={{ .ProjectName }} + - --label=org.opencontainers.image.url=https://github.com/lavanet/lava + - --label=org.opencontainers.image.source=https://github.com/lavanet/lava + - --label=org.opencontainers.image.version={{ .Version }} + - --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} + - --label=org.opencontainers.image.revision={{ .FullCommit }} + - --label=org.opencontainers.image.licenses=Apache + +archives: + - format: tar.gz + # this name template makes the OS and Arch compatible with the results of `uname`. + name_template: >- + {{ .ProjectName }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} + # use zip for windows archives + format_overrides: + - goos: windows + format: zip + +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:" diff --git a/cmd/lavavisor/.goreleaser.yaml b/cmd/lavavisor/.goreleaser.yaml new file mode 100644 index 0000000000..bcf5b43ddf --- /dev/null +++ b/cmd/lavavisor/.goreleaser.yaml @@ -0,0 +1,60 @@ +# This is an example .goreleaser.yml file with some sensible defaults. +# Make sure to check the documentation at https://goreleaser.com + +# The lines bellow are called `modelines`. See `:help modeline` +# Feel free to remove those if you don't want/need to use them. +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj + +before: + hooks: + # You may remove this if you don't use go modules. + - go mod tidy + # you may remove this if you don't need go generate + - go generate ./... + +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + goarch: + - amd64 + - arm64 + +dockers: + - image_templates: ["us-central1-docker.pkg.dev/lavanet/lavavisor:{{ .Version }}"] + dockerfile: Dockerfile + build_flag_templates: + - --label=org.opencontainers.image.title={{ .ProjectName }} + - --label=org.opencontainers.image.description={{ .ProjectName }} + - --label=org.opencontainers.image.url=https://github.com/lavanet/lava + - --label=org.opencontainers.image.source=https://github.com/lavanet/lava + - --label=org.opencontainers.image.version={{ .Version }} + - --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} + - --label=org.opencontainers.image.revision={{ .FullCommit }} + - --label=org.opencontainers.image.licenses=Apache + +archives: + - format: tar.gz + # this name template makes the OS and Arch compatible with the results of `uname`. + name_template: >- + {{ .ProjectName }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} + # use zip for windows archives + format_overrides: + - goos: windows + format: zip + +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:" From 98cf147f70be6b5239dcf4c6a5b7ce370cf7da0b Mon Sep 17 00:00:00 2001 From: amitz Date: Sun, 17 Mar 2024 23:01:50 +0200 Subject: [PATCH 09/43] added nfpms --- cmd/lavad/.goreleaser.yaml | 6 +++++- cmd/lavap/.goreleaser.yaml | 6 +++++- cmd/lavavisor/.goreleaser.yaml | 9 ++++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/cmd/lavad/.goreleaser.yaml b/cmd/lavad/.goreleaser.yaml index 03e6460933..3d1e6ad51d 100644 --- a/cmd/lavad/.goreleaser.yaml +++ b/cmd/lavad/.goreleaser.yaml @@ -33,9 +33,13 @@ dockers: - --label=org.opencontainers.image.url=https://github.com/lavanet/lava - --label=org.opencontainers.image.source=https://github.com/lavanet/lava - --label=org.opencontainers.image.version={{ .Version }} - - --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} + - --label=org.opencontainers.image.created={{ .Date }} - --label=org.opencontainers.image.revision={{ .FullCommit }} - --label=org.opencontainers.image.licenses=Apache + - "--build-arg=LAVA_BINARY=lavad" + +nfpms: + - id: lavad archives: - format: tar.gz diff --git a/cmd/lavap/.goreleaser.yaml b/cmd/lavap/.goreleaser.yaml index 56f1663c30..04442f9780 100644 --- a/cmd/lavap/.goreleaser.yaml +++ b/cmd/lavap/.goreleaser.yaml @@ -33,9 +33,13 @@ dockers: - --label=org.opencontainers.image.url=https://github.com/lavanet/lava - --label=org.opencontainers.image.source=https://github.com/lavanet/lava - --label=org.opencontainers.image.version={{ .Version }} - - --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} + - --label=org.opencontainers.image.created={{ .Date }} - --label=org.opencontainers.image.revision={{ .FullCommit }} - --label=org.opencontainers.image.licenses=Apache + - "--build-arg=LAVA_BINARY=lavap" + +nfpms: + - id: lavap archives: - format: tar.gz diff --git a/cmd/lavavisor/.goreleaser.yaml b/cmd/lavavisor/.goreleaser.yaml index bcf5b43ddf..92ed2f3b9a 100644 --- a/cmd/lavavisor/.goreleaser.yaml +++ b/cmd/lavavisor/.goreleaser.yaml @@ -33,10 +33,13 @@ dockers: - --label=org.opencontainers.image.url=https://github.com/lavanet/lava - --label=org.opencontainers.image.source=https://github.com/lavanet/lava - --label=org.opencontainers.image.version={{ .Version }} - - --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} + - --label=org.opencontainers.image.created={{ .Date }} - --label=org.opencontainers.image.revision={{ .FullCommit }} - --label=org.opencontainers.image.licenses=Apache +nfpms: + - id: lavavisor + archives: - format: tar.gz # this name template makes the OS and Arch compatible with the results of `uname`. @@ -52,6 +55,10 @@ archives: - goos: windows format: zip +checksum: + name_template: '{{ .ProjectName }}_{{ .Version }}_checksums.txt' + algorithm: sha256 + changelog: sort: asc filters: From e73568ded6a261eb847be938e5aa5370822be40f Mon Sep 17 00:00:00 2001 From: amitz Date: Sun, 17 Mar 2024 23:08:11 +0200 Subject: [PATCH 10/43] added id and binary --- cmd/lavad/.goreleaser.yaml | 8 +++++--- cmd/lavap/.goreleaser.yaml | 8 +++++--- cmd/lavavisor/.goreleaser.yaml | 8 +++++--- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/cmd/lavad/.goreleaser.yaml b/cmd/lavad/.goreleaser.yaml index 3d1e6ad51d..44c50685b7 100644 --- a/cmd/lavad/.goreleaser.yaml +++ b/cmd/lavad/.goreleaser.yaml @@ -14,7 +14,9 @@ before: - go generate ./... builds: - - env: + - id: lavad + binary: lavad + env: - CGO_ENABLED=0 goos: - linux @@ -38,8 +40,8 @@ dockers: - --label=org.opencontainers.image.licenses=Apache - "--build-arg=LAVA_BINARY=lavad" -nfpms: - - id: lavad +# nfpms: +# - id: lavad archives: - format: tar.gz diff --git a/cmd/lavap/.goreleaser.yaml b/cmd/lavap/.goreleaser.yaml index 04442f9780..27d1d6281c 100644 --- a/cmd/lavap/.goreleaser.yaml +++ b/cmd/lavap/.goreleaser.yaml @@ -14,7 +14,9 @@ before: - go generate ./... builds: - - env: + - id: lavap + binary: lavap + env: - CGO_ENABLED=0 goos: - linux @@ -38,8 +40,8 @@ dockers: - --label=org.opencontainers.image.licenses=Apache - "--build-arg=LAVA_BINARY=lavap" -nfpms: - - id: lavap +# nfpms: +# - id: lavap archives: - format: tar.gz diff --git a/cmd/lavavisor/.goreleaser.yaml b/cmd/lavavisor/.goreleaser.yaml index 92ed2f3b9a..fc632e4cf0 100644 --- a/cmd/lavavisor/.goreleaser.yaml +++ b/cmd/lavavisor/.goreleaser.yaml @@ -14,7 +14,9 @@ before: - go generate ./... builds: - - env: + - id: lavavisor + binary: lavavisor + env: - CGO_ENABLED=0 goos: - linux @@ -37,8 +39,8 @@ dockers: - --label=org.opencontainers.image.revision={{ .FullCommit }} - --label=org.opencontainers.image.licenses=Apache -nfpms: - - id: lavavisor +# nfpms: +# - id: lavavisor archives: - format: tar.gz From 9615e764aa935b4dbcccb8b7c0494cdae0d1343e Mon Sep 17 00:00:00 2001 From: amitz Date: Sun, 17 Mar 2024 23:08:42 +0200 Subject: [PATCH 11/43] update pipeline --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7fbf707b60..6221da160e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,7 +31,7 @@ jobs: uses: goreleaser/goreleaser-action@v5 with: version: latest - args: release --clean + args: build --single-target --skip-validate --snapshot --clean workdir: cmd/lavad env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From f1471b699187246bebe75e5426fe724ee182d3a8 Mon Sep 17 00:00:00 2001 From: amitz Date: Sun, 17 Mar 2024 23:14:20 +0200 Subject: [PATCH 12/43] --skip=validate --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6221da160e..89f463b4a1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,7 +31,7 @@ jobs: uses: goreleaser/goreleaser-action@v5 with: version: latest - args: build --single-target --skip-validate --snapshot --clean + args: build --single-target --skip=validate --snapshot --clean workdir: cmd/lavad env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 11a72622158178c201384a7934376b5a30590308 Mon Sep 17 00:00:00 2001 From: amitz Date: Sun, 17 Mar 2024 23:17:19 +0200 Subject: [PATCH 13/43] no need for both snapshot and skip --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 89f463b4a1..1aa382eb16 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,7 +31,7 @@ jobs: uses: goreleaser/goreleaser-action@v5 with: version: latest - args: build --single-target --skip=validate --snapshot --clean + args: build --single-target --snapshot --clean workdir: cmd/lavad env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From c7849ab0b519a2c6ad06afeb26b795594766f36e Mon Sep 17 00:00:00 2001 From: amitz Date: Sun, 17 Mar 2024 23:19:14 +0200 Subject: [PATCH 14/43] use: buildx --- cmd/lavad/.goreleaser.yaml | 7 +++++-- cmd/lavap/.goreleaser.yaml | 1 + cmd/lavavisor/.goreleaser.yaml | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cmd/lavad/.goreleaser.yaml b/cmd/lavad/.goreleaser.yaml index 44c50685b7..30d3796d50 100644 --- a/cmd/lavad/.goreleaser.yaml +++ b/cmd/lavad/.goreleaser.yaml @@ -29,6 +29,7 @@ builds: dockers: - image_templates: ["us-central1-docker.pkg.dev/lavanet/lavad:{{ .Version }}"] dockerfile: Dockerfile + use: buildx build_flag_templates: - --label=org.opencontainers.image.title={{ .ProjectName }} - --label=org.opencontainers.image.description={{ .ProjectName }} @@ -40,8 +41,10 @@ dockers: - --label=org.opencontainers.image.licenses=Apache - "--build-arg=LAVA_BINARY=lavad" -# nfpms: -# - id: lavad +nfpms: + - id: lavad + maintainer: Amit + archives: - format: tar.gz diff --git a/cmd/lavap/.goreleaser.yaml b/cmd/lavap/.goreleaser.yaml index 27d1d6281c..43544e2c1e 100644 --- a/cmd/lavap/.goreleaser.yaml +++ b/cmd/lavap/.goreleaser.yaml @@ -29,6 +29,7 @@ builds: dockers: - image_templates: ["us-central1-docker.pkg.dev/lavanet/lavap:{{ .Version }}"] dockerfile: Dockerfile + use: buildx build_flag_templates: - --label=org.opencontainers.image.title={{ .ProjectName }} - --label=org.opencontainers.image.description={{ .ProjectName }} diff --git a/cmd/lavavisor/.goreleaser.yaml b/cmd/lavavisor/.goreleaser.yaml index fc632e4cf0..658f7b3c96 100644 --- a/cmd/lavavisor/.goreleaser.yaml +++ b/cmd/lavavisor/.goreleaser.yaml @@ -29,6 +29,7 @@ builds: dockers: - image_templates: ["us-central1-docker.pkg.dev/lavanet/lavavisor:{{ .Version }}"] dockerfile: Dockerfile + use: buildx build_flag_templates: - --label=org.opencontainers.image.title={{ .ProjectName }} - --label=org.opencontainers.image.description={{ .ProjectName }} From eaa9f79c705d80e4fe5a6a3d379f0488a4f26329 Mon Sep 17 00:00:00 2001 From: amitz Date: Sun, 17 Mar 2024 23:25:48 +0200 Subject: [PATCH 15/43] update config --- cmd/lavad/.goreleaser.yaml | 7 +++++++ cmd/lavap/.goreleaser.yaml | 12 ++++++++++-- cmd/lavavisor/.goreleaser.yaml | 8 ++++++-- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/cmd/lavad/.goreleaser.yaml b/cmd/lavad/.goreleaser.yaml index 30d3796d50..e5be770fe1 100644 --- a/cmd/lavad/.goreleaser.yaml +++ b/cmd/lavad/.goreleaser.yaml @@ -61,6 +61,13 @@ archives: - goos: windows format: zip +checksum: + name_template: '{{ .ProjectName }}_{{ .Version }}_checksums.txt' + algorithm: sha256 + +sboms: + - artifacts: archive + changelog: sort: asc filters: diff --git a/cmd/lavap/.goreleaser.yaml b/cmd/lavap/.goreleaser.yaml index 43544e2c1e..f08dc96fc9 100644 --- a/cmd/lavap/.goreleaser.yaml +++ b/cmd/lavap/.goreleaser.yaml @@ -41,8 +41,9 @@ dockers: - --label=org.opencontainers.image.licenses=Apache - "--build-arg=LAVA_BINARY=lavap" -# nfpms: -# - id: lavap +nfpms: + - id: lavap + maintainer: Amit archives: - format: tar.gz @@ -59,6 +60,13 @@ archives: - goos: windows format: zip +checksum: + name_template: '{{ .ProjectName }}_{{ .Version }}_checksums.txt' + algorithm: sha256 + +sboms: + - artifacts: archive + changelog: sort: asc filters: diff --git a/cmd/lavavisor/.goreleaser.yaml b/cmd/lavavisor/.goreleaser.yaml index 658f7b3c96..1571c2eda6 100644 --- a/cmd/lavavisor/.goreleaser.yaml +++ b/cmd/lavavisor/.goreleaser.yaml @@ -40,8 +40,9 @@ dockers: - --label=org.opencontainers.image.revision={{ .FullCommit }} - --label=org.opencontainers.image.licenses=Apache -# nfpms: -# - id: lavavisor +nfpms: + - id: lavavisor + maintainer: Amit archives: - format: tar.gz @@ -62,6 +63,9 @@ checksum: name_template: '{{ .ProjectName }}_{{ .Version }}_checksums.txt' algorithm: sha256 +sboms: + - artifacts: archive + changelog: sort: asc filters: From 6427be2214f6d34e70e3ab778ae1a4d904986910 Mon Sep 17 00:00:00 2001 From: amitz Date: Sun, 17 Mar 2024 23:47:22 +0200 Subject: [PATCH 16/43] rename workflow files --- .github/workflows/{main.yml => ci.yml} | 7 +------ .github/workflows/lint.yml | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 6 deletions(-) rename .github/workflows/{main.yml => ci.yml} (82%) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/main.yml b/.github/workflows/ci.yml similarity index 82% rename from .github/workflows/main.yml rename to .github/workflows/ci.yml index 1aa382eb16..de5fcc2978 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Lint +name: CI on: push: @@ -22,11 +22,6 @@ jobs: with: fetch-depth: 0 - - name: Lint - uses: golangci/golangci-lint-action@v4 - with: - args: --print-issued-lines --config .golangci.yml -v - - name: Run GoReleaser uses: goreleaser/goreleaser-action@v5 with: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000000..932e04cecb --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,26 @@ +name: Lint + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version: 1.20.5 + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Lint + uses: golangci/golangci-lint-action@v4 + with: + args: --print-issued-lines --config .golangci.yml -v \ No newline at end of file From 1bff9b313a658917a8937a2ad843be3e46f35c7b Mon Sep 17 00:00:00 2001 From: amitz Date: Sun, 17 Mar 2024 23:47:45 +0200 Subject: [PATCH 17/43] update job name --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index de5fcc2978..12249880d4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ on: - main jobs: - lint: + ci: runs-on: ubuntu-latest steps: - name: Install Go From 7eccc0a0b87415b73c89a3fb71661292abf1931f Mon Sep 17 00:00:00 2001 From: amitz Date: Sun, 17 Mar 2024 23:49:13 +0200 Subject: [PATCH 18/43] matrix strategy --- .github/workflows/ci.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 12249880d4..6dae1116e7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,9 @@ on: jobs: ci: runs-on: ubuntu-latest + strategy: + matrix: + binary: [lavad, lavap, lavavisor] steps: - name: Install Go uses: actions/setup-go@v5 @@ -27,12 +30,12 @@ jobs: with: version: latest args: build --single-target --snapshot --clean - workdir: cmd/lavad + workdir: cmd/${{ matrix.binary }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Upload Artifacts uses: actions/upload-artifact@v4 with: - name: lavad - path: cmd/lavad/dist/* + name: ${{ matrix.binary }} + path: cmd/${{ matrix.binary }}/dist/* From 75707fcdf47058d5f748c0c38abb8525fdfd214f Mon Sep 17 00:00:00 2001 From: amitz Date: Mon, 18 Mar 2024 14:00:30 +0200 Subject: [PATCH 19/43] running on macos as well --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6dae1116e7..b4f4fd3abf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,10 +10,11 @@ on: jobs: ci: - runs-on: ubuntu-latest strategy: matrix: binary: [lavad, lavap, lavavisor] + os: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.os }} steps: - name: Install Go uses: actions/setup-go@v5 From fbea05241dfc33e09f82bebe7e8ff83ceb2c4fc7 Mon Sep 17 00:00:00 2001 From: amitz Date: Mon, 18 Mar 2024 15:44:45 +0200 Subject: [PATCH 20/43] artifact names --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4f4fd3abf..dcf9d177c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,6 +27,7 @@ jobs: fetch-depth: 0 - name: Run GoReleaser + id: releaser uses: goreleaser/goreleaser-action@v5 with: version: latest @@ -38,5 +39,5 @@ jobs: - name: Upload Artifacts uses: actions/upload-artifact@v4 with: - name: ${{ matrix.binary }} + name: ${{ steps.releaser.outputs.metadata.runtime.goos }}-${{ steps.releaser.outputs.metadata.tag }}-${{ steps.releaser.outputs.metadata.runtime.goarch }} path: cmd/${{ matrix.binary }}/dist/* From 0495e69ae3f4a62f0136bd123fb9cf2e30ab8132 Mon Sep 17 00:00:00 2001 From: amitz Date: Mon, 18 Mar 2024 15:51:31 +0200 Subject: [PATCH 21/43] fronJson --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dcf9d177c7..7c1d7593b1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,5 +39,5 @@ jobs: - name: Upload Artifacts uses: actions/upload-artifact@v4 with: - name: ${{ steps.releaser.outputs.metadata.runtime.goos }}-${{ steps.releaser.outputs.metadata.tag }}-${{ steps.releaser.outputs.metadata.runtime.goarch }} + name: ${{ fromJson(steps.releaser.outputs.metadata).runtime.goos }}-${{ fromJson(steps.releaser.outputs.metadata).tag }}-${{ fromJson(steps.releaser.outputs.metadata).runtime.goarch }} path: cmd/${{ matrix.binary }}/dist/* From 400d54c22afb10213185e63bbb23692b90624800 Mon Sep 17 00:00:00 2001 From: amitz Date: Mon, 18 Mar 2024 15:58:08 +0200 Subject: [PATCH 22/43] naming --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c1d7593b1..718b6601fd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,5 +39,5 @@ jobs: - name: Upload Artifacts uses: actions/upload-artifact@v4 with: - name: ${{ fromJson(steps.releaser.outputs.metadata).runtime.goos }}-${{ fromJson(steps.releaser.outputs.metadata).tag }}-${{ fromJson(steps.releaser.outputs.metadata).runtime.goarch }} + name: ${{ matrix.binary }}-${{ fromJson(steps.releaser.outputs.metadata).tag }}-${{ fromJson(steps.releaser.outputs.metadata).runtime.goos }}-${{ fromJson(steps.releaser.outputs.metadata).runtime.goarch }} path: cmd/${{ matrix.binary }}/dist/* From 5f27d011fbc3b4ad7c1dda5af923572880dd4518 Mon Sep 17 00:00:00 2001 From: amitz Date: Mon, 18 Mar 2024 16:11:48 +0200 Subject: [PATCH 23/43] windows-latest --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 718b6601fd..23198b2eee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: binary: [lavad, lavap, lavavisor] - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: - name: Install Go From f358c7f37049c482ecaf8716aceea36e42d99ac6 Mon Sep 17 00:00:00 2001 From: amitz Date: Mon, 18 Mar 2024 23:19:39 +0200 Subject: [PATCH 24/43] update goreleasr files --- cmd/lavad/.goreleaser.yaml | 30 ++++++++++++------------------ cmd/lavap/.goreleaser.yaml | 29 ++++++++++++----------------- cmd/lavavisor/.goreleaser.yaml | 28 ++++++++++++---------------- 3 files changed, 36 insertions(+), 51 deletions(-) diff --git a/cmd/lavad/.goreleaser.yaml b/cmd/lavad/.goreleaser.yaml index e5be770fe1..da108ff1b1 100644 --- a/cmd/lavad/.goreleaser.yaml +++ b/cmd/lavad/.goreleaser.yaml @@ -5,7 +5,7 @@ # Feel free to remove those if you don't want/need to use them. # yaml-language-server: $schema=https://goreleaser.com/static/schema.json # vim: set ts=2 sw=2 tw=0 fo=cnqoj - +project_name: lavad before: hooks: # You may remove this if you don't use go modules. @@ -15,7 +15,6 @@ before: builds: - id: lavad - binary: lavad env: - CGO_ENABLED=0 goos: @@ -25,27 +24,22 @@ builds: goarch: - amd64 - arm64 - -dockers: - - image_templates: ["us-central1-docker.pkg.dev/lavanet/lavad:{{ .Version }}"] - dockerfile: Dockerfile - use: buildx - build_flag_templates: - - --label=org.opencontainers.image.title={{ .ProjectName }} - - --label=org.opencontainers.image.description={{ .ProjectName }} - - --label=org.opencontainers.image.url=https://github.com/lavanet/lava - - --label=org.opencontainers.image.source=https://github.com/lavanet/lava - - --label=org.opencontainers.image.version={{ .Version }} - - --label=org.opencontainers.image.created={{ .Date }} - - --label=org.opencontainers.image.revision={{ .FullCommit }} - - --label=org.opencontainers.image.licenses=Apache - - "--build-arg=LAVA_BINARY=lavad" + ignore: + - goos: darwin + goarch: s390x + - goos: darwin + goarch: ppc64le + - goos: windows + goarch: s390x + - goos: windows + goarch: ppc64le + - goos: windows + goarch: arm64 nfpms: - id: lavad maintainer: Amit - archives: - format: tar.gz # this name template makes the OS and Arch compatible with the results of `uname`. diff --git a/cmd/lavap/.goreleaser.yaml b/cmd/lavap/.goreleaser.yaml index f08dc96fc9..613def554c 100644 --- a/cmd/lavap/.goreleaser.yaml +++ b/cmd/lavap/.goreleaser.yaml @@ -5,7 +5,7 @@ # Feel free to remove those if you don't want/need to use them. # yaml-language-server: $schema=https://goreleaser.com/static/schema.json # vim: set ts=2 sw=2 tw=0 fo=cnqoj - +project_name: lavap before: hooks: # You may remove this if you don't use go modules. @@ -15,7 +15,6 @@ before: builds: - id: lavap - binary: lavap env: - CGO_ENABLED=0 goos: @@ -25,21 +24,17 @@ builds: goarch: - amd64 - arm64 - -dockers: - - image_templates: ["us-central1-docker.pkg.dev/lavanet/lavap:{{ .Version }}"] - dockerfile: Dockerfile - use: buildx - build_flag_templates: - - --label=org.opencontainers.image.title={{ .ProjectName }} - - --label=org.opencontainers.image.description={{ .ProjectName }} - - --label=org.opencontainers.image.url=https://github.com/lavanet/lava - - --label=org.opencontainers.image.source=https://github.com/lavanet/lava - - --label=org.opencontainers.image.version={{ .Version }} - - --label=org.opencontainers.image.created={{ .Date }} - - --label=org.opencontainers.image.revision={{ .FullCommit }} - - --label=org.opencontainers.image.licenses=Apache - - "--build-arg=LAVA_BINARY=lavap" + ignore: + - goos: darwin + goarch: s390x + - goos: darwin + goarch: ppc64le + - goos: windows + goarch: s390x + - goos: windows + goarch: ppc64le + - goos: windows + goarch: arm64 nfpms: - id: lavap diff --git a/cmd/lavavisor/.goreleaser.yaml b/cmd/lavavisor/.goreleaser.yaml index 1571c2eda6..170a59fa6c 100644 --- a/cmd/lavavisor/.goreleaser.yaml +++ b/cmd/lavavisor/.goreleaser.yaml @@ -5,7 +5,7 @@ # Feel free to remove those if you don't want/need to use them. # yaml-language-server: $schema=https://goreleaser.com/static/schema.json # vim: set ts=2 sw=2 tw=0 fo=cnqoj - +project_name: lavavisor before: hooks: # You may remove this if you don't use go modules. @@ -15,7 +15,6 @@ before: builds: - id: lavavisor - binary: lavavisor env: - CGO_ENABLED=0 goos: @@ -25,20 +24,17 @@ builds: goarch: - amd64 - arm64 - -dockers: - - image_templates: ["us-central1-docker.pkg.dev/lavanet/lavavisor:{{ .Version }}"] - dockerfile: Dockerfile - use: buildx - build_flag_templates: - - --label=org.opencontainers.image.title={{ .ProjectName }} - - --label=org.opencontainers.image.description={{ .ProjectName }} - - --label=org.opencontainers.image.url=https://github.com/lavanet/lava - - --label=org.opencontainers.image.source=https://github.com/lavanet/lava - - --label=org.opencontainers.image.version={{ .Version }} - - --label=org.opencontainers.image.created={{ .Date }} - - --label=org.opencontainers.image.revision={{ .FullCommit }} - - --label=org.opencontainers.image.licenses=Apache + ignore: + - goos: darwin + goarch: s390x + - goos: darwin + goarch: ppc64le + - goos: windows + goarch: s390x + - goos: windows + goarch: ppc64le + - goos: windows + goarch: arm64 nfpms: - id: lavavisor From 3f116184de5b85059a112a2ef2608de56ede2975 Mon Sep 17 00:00:00 2001 From: amitz Date: Mon, 18 Mar 2024 23:23:41 +0200 Subject: [PATCH 25/43] update releaser files --- cmd/lavad/.goreleaser.yaml | 26 +++++++++++++++++++++----- cmd/lavap/.goreleaser.yaml | 26 +++++++++++++++++++++----- cmd/lavavisor/.goreleaser.yaml | 26 +++++++++++++++++++++----- 3 files changed, 63 insertions(+), 15 deletions(-) diff --git a/cmd/lavad/.goreleaser.yaml b/cmd/lavad/.goreleaser.yaml index da108ff1b1..e9cf45cdba 100644 --- a/cmd/lavad/.goreleaser.yaml +++ b/cmd/lavad/.goreleaser.yaml @@ -59,12 +59,28 @@ checksum: name_template: '{{ .ProjectName }}_{{ .Version }}_checksums.txt' algorithm: sha256 -sboms: - - artifacts: archive - changelog: + use: + github sort: asc + abbrev: 0 + groups: # Regex use RE2 syntax as defined here: https://github.com/google/re2/wiki/Syntax. + - title: 'Features' + regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$' + order: 100 + - title: 'Bug fixes' + regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$' + order: 200 + - title: 'Documentation' + regexp: '^.*?docs(\([[:word:]]+\))??!?:.+$' + order: 300 + - title: 'Dependency updates' + regexp: '^.*?(feat|fix|chore)\(deps?.+\)!?:.+$' + order: 400 + - title: 'Other work' + order: 999 filters: exclude: - - "^docs:" - - "^test:" + - '^test:' + - '^.*?Bump(\([[:word:]]+\))?.+$' + - '^.*?[Bot](\([[:word:]]+\))?.+$' diff --git a/cmd/lavap/.goreleaser.yaml b/cmd/lavap/.goreleaser.yaml index 613def554c..a6f589969b 100644 --- a/cmd/lavap/.goreleaser.yaml +++ b/cmd/lavap/.goreleaser.yaml @@ -59,12 +59,28 @@ checksum: name_template: '{{ .ProjectName }}_{{ .Version }}_checksums.txt' algorithm: sha256 -sboms: - - artifacts: archive - changelog: + use: + github sort: asc + abbrev: 0 + groups: # Regex use RE2 syntax as defined here: https://github.com/google/re2/wiki/Syntax. + - title: 'Features' + regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$' + order: 100 + - title: 'Bug fixes' + regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$' + order: 200 + - title: 'Documentation' + regexp: '^.*?docs(\([[:word:]]+\))??!?:.+$' + order: 300 + - title: 'Dependency updates' + regexp: '^.*?(feat|fix|chore)\(deps?.+\)!?:.+$' + order: 400 + - title: 'Other work' + order: 999 filters: exclude: - - "^docs:" - - "^test:" + - '^test:' + - '^.*?Bump(\([[:word:]]+\))?.+$' + - '^.*?[Bot](\([[:word:]]+\))?.+$' diff --git a/cmd/lavavisor/.goreleaser.yaml b/cmd/lavavisor/.goreleaser.yaml index 170a59fa6c..9ec13b5980 100644 --- a/cmd/lavavisor/.goreleaser.yaml +++ b/cmd/lavavisor/.goreleaser.yaml @@ -59,12 +59,28 @@ checksum: name_template: '{{ .ProjectName }}_{{ .Version }}_checksums.txt' algorithm: sha256 -sboms: - - artifacts: archive - changelog: + use: + github sort: asc + abbrev: 0 + groups: # Regex use RE2 syntax as defined here: https://github.com/google/re2/wiki/Syntax. + - title: 'Features' + regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$' + order: 100 + - title: 'Bug fixes' + regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$' + order: 200 + - title: 'Documentation' + regexp: '^.*?docs(\([[:word:]]+\))??!?:.+$' + order: 300 + - title: 'Dependency updates' + regexp: '^.*?(feat|fix|chore)\(deps?.+\)!?:.+$' + order: 400 + - title: 'Other work' + order: 999 filters: exclude: - - "^docs:" - - "^test:" + - '^test:' + - '^.*?Bump(\([[:word:]]+\))?.+$' + - '^.*?[Bot](\([[:word:]]+\))?.+$' \ No newline at end of file From 4237e516ac0c5aac826f738491754a8385b7b5ed Mon Sep 17 00:00:00 2001 From: amitz Date: Thu, 21 Mar 2024 15:12:22 +0200 Subject: [PATCH 26/43] remove packages --- cmd/lavad/.goreleaser.yaml | 4 ---- cmd/lavap/.goreleaser.yaml | 4 ---- cmd/lavavisor/.goreleaser.yaml | 4 ---- 3 files changed, 12 deletions(-) diff --git a/cmd/lavad/.goreleaser.yaml b/cmd/lavad/.goreleaser.yaml index e9cf45cdba..a15276f706 100644 --- a/cmd/lavad/.goreleaser.yaml +++ b/cmd/lavad/.goreleaser.yaml @@ -36,10 +36,6 @@ builds: - goos: windows goarch: arm64 -nfpms: - - id: lavad - maintainer: Amit - archives: - format: tar.gz # this name template makes the OS and Arch compatible with the results of `uname`. diff --git a/cmd/lavap/.goreleaser.yaml b/cmd/lavap/.goreleaser.yaml index a6f589969b..bda7397982 100644 --- a/cmd/lavap/.goreleaser.yaml +++ b/cmd/lavap/.goreleaser.yaml @@ -36,10 +36,6 @@ builds: - goos: windows goarch: arm64 -nfpms: - - id: lavap - maintainer: Amit - archives: - format: tar.gz # this name template makes the OS and Arch compatible with the results of `uname`. diff --git a/cmd/lavavisor/.goreleaser.yaml b/cmd/lavavisor/.goreleaser.yaml index 9ec13b5980..64e4bbdd72 100644 --- a/cmd/lavavisor/.goreleaser.yaml +++ b/cmd/lavavisor/.goreleaser.yaml @@ -36,10 +36,6 @@ builds: - goos: windows goarch: arm64 -nfpms: - - id: lavavisor - maintainer: Amit - archives: - format: tar.gz # this name template makes the OS and Arch compatible with the results of `uname`. From 05c91dc5f5414adbd4e32edf55f9f892ecca4514 Mon Sep 17 00:00:00 2001 From: amitz Date: Thu, 21 Mar 2024 16:52:37 +0200 Subject: [PATCH 27/43] test releaser path --- .github/workflows/ci.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 23198b2eee..7817402b7f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,6 +36,19 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Test build + continue-on-error: true + if: ${{ matrix.binary }} == "lavad" + run: | + response=$(${{ fromJson(steps.releaser.outputs.artifacts)[0].path }} status --node http://public-rpc.lavanet.xyz:80/rpc/ | jq '.NodeInfo') + if [ -z "${response}" ]; then + echo "The binary fails to connect to a node." + exit 1 + else + echo $response + echo "The binary is working as expected." + fi + - name: Upload Artifacts uses: actions/upload-artifact@v4 with: From 04db8b9ed2f3e4da1504f67f9200592f1d203e1a Mon Sep 17 00:00:00 2001 From: amitz Date: Thu, 21 Mar 2024 16:56:47 +0200 Subject: [PATCH 28/43] relative --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7817402b7f..fb661d1a80 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: continue-on-error: true if: ${{ matrix.binary }} == "lavad" run: | - response=$(${{ fromJson(steps.releaser.outputs.artifacts)[0].path }} status --node http://public-rpc.lavanet.xyz:80/rpc/ | jq '.NodeInfo') + response=$(./${{ fromJson(steps.releaser.outputs.artifacts)[0].path }} status --node http://public-rpc.lavanet.xyz:80/rpc/ | jq '.NodeInfo') if [ -z "${response}" ]; then echo "The binary fails to connect to a node." exit 1 From 14c7fb6ecfe96a13603958dfa303c5dc043a3fef Mon Sep 17 00:00:00 2001 From: amitz Date: Thu, 21 Mar 2024 17:00:24 +0200 Subject: [PATCH 29/43] cmd/lavad --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb661d1a80..bbbc93b246 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: continue-on-error: true if: ${{ matrix.binary }} == "lavad" run: | - response=$(./${{ fromJson(steps.releaser.outputs.artifacts)[0].path }} status --node http://public-rpc.lavanet.xyz:80/rpc/ | jq '.NodeInfo') + response=$(cmd/lavad/${{ fromJson(steps.releaser.outputs.artifacts)[0].path }} status --node http://public-rpc.lavanet.xyz:80/rpc/ | jq '.NodeInfo') if [ -z "${response}" ]; then echo "The binary fails to connect to a node." exit 1 From 537a3041e1d5f4d95752217b851f051ba009b406 Mon Sep 17 00:00:00 2001 From: amitz Date: Thu, 21 Mar 2024 17:26:05 +0200 Subject: [PATCH 30/43] remove checkout 0 and upload --- .github/workflows/ci.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bbbc93b246..d3a83a620d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,8 +23,6 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Run GoReleaser id: releaser @@ -48,9 +46,3 @@ jobs: echo $response echo "The binary is working as expected." fi - - - name: Upload Artifacts - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.binary }}-${{ fromJson(steps.releaser.outputs.metadata).tag }}-${{ fromJson(steps.releaser.outputs.metadata).runtime.goos }}-${{ fromJson(steps.releaser.outputs.metadata).runtime.goarch }} - path: cmd/${{ matrix.binary }}/dist/* From 0ab860d018e1ebe52a490e3e9e2df9646adfc6c4 Mon Sep 17 00:00:00 2001 From: amitz Date: Thu, 21 Mar 2024 18:07:34 +0200 Subject: [PATCH 31/43] remove redundant test --- .github/workflows/ci.yml | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d3a83a620d..f0aab469b1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,17 +32,4 @@ jobs: args: build --single-target --snapshot --clean workdir: cmd/${{ matrix.binary }} env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Test build - continue-on-error: true - if: ${{ matrix.binary }} == "lavad" - run: | - response=$(cmd/lavad/${{ fromJson(steps.releaser.outputs.artifacts)[0].path }} status --node http://public-rpc.lavanet.xyz:80/rpc/ | jq '.NodeInfo') - if [ -z "${response}" ]; then - echo "The binary fails to connect to a node." - exit 1 - else - echo $response - echo "The binary is working as expected." - fi + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 3386538785ff597aa606446c566ef8065ac7c2bc Mon Sep 17 00:00:00 2001 From: amitz Date: Thu, 21 Mar 2024 18:13:00 +0200 Subject: [PATCH 32/43] remove test --- .github/workflows/release.yml | 240 ++++++++++++++++------------------ 1 file changed, 115 insertions(+), 125 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3999fb985a..8e741aba1e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,9 @@ -name: 'Release' +name: Publish Lava Release on: - release: - types: [created, edited, prereleased] + push: + tags: + - 'v*' permissions: contents: write @@ -10,133 +11,122 @@ permissions: jobs: release: name: 'release' - runs-on: ubuntu-20.04 - timeout-minutes: 10 - environment: default - defaults: - run: - shell: bash + strategy: + matrix: + binary: [lavad, lavap, lavavisor] + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} steps: - - name: Checkout - uses: actions/checkout@v3 + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Configure Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: go-version: 1.20.5 - check-latest: true - cache: true - - - name: Set Environment Variable - run: | - echo "LAVA_BUILD_OPTIONS=\"release\"" >> $GITHUB_ENV - - - name: Build - run: | - make build-all - - - name: Test build - continue-on-error: true - run: | - response=$(build/lavad status --node http://public-rpc.lavanet.xyz:80/rpc/ | jq '.NodeInfo') - if [ -z "${response}" ]; then - echo "The binary fails to connect to a node." - exit 1 - else - echo $response - echo "The binary is working as expected." - fi - - - name: Check for existing assests - id: existing_asset - run: | - if [ "${{ github.event.release.assets[0].name }}" = "lavad" ]; then - echo "URL=${{ github.event.release.assets[0].id }}" >> $GITHUB_OUTPUT - echo "URL=${{ github.event.release.assets[0].url }}" >> $GITHUB_OUTPUT - echo "CHECK=true" >> $GITHUB_OUTPUT - else - echo "CHECK=false" >> $GITHUB_OUTPUT - fi - - - name: Upload build to release - run: | - upload_binary () { - echo "Uploading binary to: $(echo '${{ github.event.release.upload_url }}' | sed 's/{?name,label}/?name=lavad/g')" - curl \ - -X POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ - -H "Content-Type: $(file -b --mime-type build/lavad)" \ - --data-binary @build/lavad \ - $(echo '${{ github.event.release.upload_url }}' | sed 's/{?name,label}/?name=lavad-${{ github.event.release.tag_name }}-linux-amd64/g') - - curl \ - -X POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ - -H "Content-Type: $(file -b --mime-type build/lavap)" \ - --data-binary @build/lavap \ - $(echo '${{ github.event.release.upload_url }}' | sed 's/{?name,label}/?name=lavap-${{ github.event.release.tag_name }}-linux-amd64/g') - curl \ - -X POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ - -H "Content-Type: $(file -b --mime-type build/lavavisor)" \ - --data-binary @build/lavavisor \ - $(echo '${{ github.event.release.upload_url }}' | sed 's/{?name,label}/?name=lavavisor-${{ github.event.release.tag_name }}-linux-amd64/g') - } - - delete_binary(){ - echo "Deleting existing binary" - curl \ - -X DELETE \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ - ${{ steps.existing_asset.outputs.URL }} - } - - if ${{ steps.existing_asset.outputs.CHECK }}; then - delete_binary - upload_binary - else - upload_binary - fi - - - name: Check for existing Checksum - id: existing_checksum - run: | - #Get Checksum of new build - export CHECKSUM=$(sha256sum build/lavad | cut -d " " -f1) - - #Get the existing body - existing_body=$(curl \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ - -H "Content-Type: $(file -b --mime-type build/lavad)" \ - ${{ github.event.release.url }} | jq '.body') - - if [[ $existing_body == *"$CHECKSUM"* ]]; then - echo "CHECK=true" >> $GITHUB_OUTPUT - echo "Checksum hasn't changed." - else - echo "CHECK=false" >> $GITHUB_OUTPUT - cat <> /tmp/body - $(echo $existing_body | sed '$s/.$//')\r\nChecksum $CHECKSUM" - EOF - echo -E "NEW_BODY=$(cat /tmp/body)" >> $GITHUB_OUTPUT - fi - - - name: Append Binary Checksum - uses: actions/github-script@v6 - if: ${{ steps.existing_checksum.outputs.CHECK }} == 'false' + - name: Run GoReleaser + id: releaser + uses: goreleaser/goreleaser-action@v5 with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const { data } = await github.rest.repos.updateRelease({ - owner: context.repo.owner, - repo: context.repo.repo, - release_id: context.payload.release.id, - body: ${{ steps.existing_checksum.outputs.NEW_BODY }} - }); + version: latest + args: release --rm-dist --timeout 60m + workdir: cmd/${{ matrix.binary }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # - name: Check for existing assests + # id: existing_asset + # run: | + # if [ "${{ github.event.release.assets[0].name }}" = "lavad" ]; then + # echo "URL=${{ github.event.release.assets[0].id }}" >> $GITHUB_OUTPUT + # echo "URL=${{ github.event.release.assets[0].url }}" >> $GITHUB_OUTPUT + # echo "CHECK=true" >> $GITHUB_OUTPUT + # else + # echo "CHECK=false" >> $GITHUB_OUTPUT + # fi + + # - name: Upload build to release + # run: | + # upload_binary () { + # echo "Uploading binary to: $(echo '${{ github.event.release.upload_url }}' | sed 's/{?name,label}/?name=lavad/g')" + # curl \ + # -X POST \ + # -H "Accept: application/vnd.github+json" \ + # -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + # -H "Content-Type: $(file -b --mime-type build/lavad)" \ + # --data-binary @build/lavad \ + # $(echo '${{ github.event.release.upload_url }}' | sed 's/{?name,label}/?name=lavad-${{ github.event.release.tag_name }}-linux-amd64/g') + + # curl \ + # -X POST \ + # -H "Accept: application/vnd.github+json" \ + # -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + # -H "Content-Type: $(file -b --mime-type build/lavap)" \ + # --data-binary @build/lavap \ + # $(echo '${{ github.event.release.upload_url }}' | sed 's/{?name,label}/?name=lavap-${{ github.event.release.tag_name }}-linux-amd64/g') + + # curl \ + # -X POST \ + # -H "Accept: application/vnd.github+json" \ + # -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + # -H "Content-Type: $(file -b --mime-type build/lavavisor)" \ + # --data-binary @build/lavavisor \ + # $(echo '${{ github.event.release.upload_url }}' | sed 's/{?name,label}/?name=lavavisor-${{ github.event.release.tag_name }}-linux-amd64/g') + # } + + # delete_binary(){ + # echo "Deleting existing binary" + # curl \ + # -X DELETE \ + # -H "Accept: application/vnd.github+json" \ + # -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + # ${{ steps.existing_asset.outputs.URL }} + # } + + # if ${{ steps.existing_asset.outputs.CHECK }}; then + # delete_binary + # upload_binary + # else + # upload_binary + # fi + + # - name: Check for existing Checksum + # id: existing_checksum + # run: | + # #Get Checksum of new build + # export CHECKSUM=$(sha256sum build/lavad | cut -d " " -f1) + + # #Get the existing body + # existing_body=$(curl \ + # -H "Accept: application/vnd.github+json" \ + # -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + # -H "Content-Type: $(file -b --mime-type build/lavad)" \ + # ${{ github.event.release.url }} | jq '.body') + + # if [[ $existing_body == *"$CHECKSUM"* ]]; then + # echo "CHECK=true" >> $GITHUB_OUTPUT + # echo "Checksum hasn't changed." + # else + # echo "CHECK=false" >> $GITHUB_OUTPUT + # cat <> /tmp/body + # $(echo $existing_body | sed '$s/.$//')\r\nChecksum $CHECKSUM" + # EOF + # echo -E "NEW_BODY=$(cat /tmp/body)" >> $GITHUB_OUTPUT + # fi + + # - name: Append Binary Checksum + # uses: actions/github-script@v6 + # if: ${{ steps.existing_checksum.outputs.CHECK }} == 'false' + # with: + # github-token: ${{ secrets.GITHUB_TOKEN }} + # script: | + # const { data } = await github.rest.repos.updateRelease({ + # owner: context.repo.owner, + # repo: context.repo.repo, + # release_id: context.payload.release.id, + # body: ${{ steps.existing_checksum.outputs.NEW_BODY }} + # }); \ No newline at end of file From ea33101b0b82915657d8b8b81eb284c061a89a8f Mon Sep 17 00:00:00 2001 From: amitz Date: Thu, 21 Mar 2024 18:19:10 +0200 Subject: [PATCH 33/43] using goreleasre --- .github/workflows/release.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8e741aba1e..6f340f036c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,17 +23,24 @@ jobs: with: fetch-depth: 0 + - name: Fetch all tags + run: | + set -e + git fetch --force --tags + - name: Configure Go uses: actions/setup-go@v5 with: go-version: 1.20.5 + go-version-file: go.mod + cache-dependency-path: go.sum - name: Run GoReleaser id: releaser uses: goreleaser/goreleaser-action@v5 with: version: latest - args: release --rm-dist --timeout 60m + args: release --clean --timeout 90m workdir: cmd/${{ matrix.binary }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 1214c3d0e76b76a4432c0ca38aa9baed09b90adc Mon Sep 17 00:00:00 2001 From: amitz Date: Thu, 21 Mar 2024 20:46:07 +0200 Subject: [PATCH 34/43] added bot integ --- .github/scripts/create-release.sh | 41 +++++++++++++++++++++++++++ .github/workflows/create-release.yaml | 32 +++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 .github/scripts/create-release.sh create mode 100644 .github/workflows/create-release.yaml diff --git a/.github/scripts/create-release.sh b/.github/scripts/create-release.sh new file mode 100644 index 0000000000..e7e135e899 --- /dev/null +++ b/.github/scripts/create-release.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +set -ue + +SEMVER_REGEX='^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$' + +REL_VERSION=`echo $1 | sed -r 's/^[vV]?([0-9].+)$/\1/'` + +if [ `echo $REL_VERSION | pcre2grep "$SEMVER_REGEX"` ]; then + echo "$REL_VERSION is a valid semantic version." +else + echo "$REL_VERSION is not a valid semantic version." + exit 1 +fi + +MAJOR_MINOR_VERSION=`echo $REL_VERSION | cut -d. -f1,2` +RELEASE_BRANCH="release-$MAJOR_MINOR_VERSION" +RELEASE_TAG="v$REL_VERSION" + +if [ `git rev-parse --verify origin/$RELEASE_BRANCH 2>/dev/null` ]; then + echo "$RELEASE_BRANCH branch already exists, checking it out ..." + git checkout $RELEASE_BRANCH +else + echo "$RELEASE_BRANCH does not exist, creating ..." + git checkout -b $RELEASE_BRANCH + git push origin $RELEASE_BRANCH +fi +echo "$RELEASE_BRANCH branch is ready." + +if [ `git rev-parse --verify $RELEASE_TAG 2>/dev/null` ]; then + echo "$RELEASE_TAG tag already exists, aborting ..." + exit 2 +fi + +echo "Tagging $RELEASE_TAG ..." +git tag $RELEASE_TAG +echo "$RELEASE_TAG is tagged." + +echo "Pushing $RELEASE_TAG tag ..." +git push origin $RELEASE_TAG +echo "$RELEASE_TAG tag is pushed." \ No newline at end of file diff --git a/.github/workflows/create-release.yaml b/.github/workflows/create-release.yaml new file mode 100644 index 0000000000..5511d9639e --- /dev/null +++ b/.github/workflows/create-release.yaml @@ -0,0 +1,32 @@ +name: Create a release + +on: + workflow_dispatch: + inputs: + rel_version: + description: 'Release version (examples: v1.3.0-rc.1, v1.3.0)' + required: true + type: string + +jobs: + create-release: + name: Creates release branch and tag + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install required packages + run: | + sudo apt-get update + sudo apt-get install pcre2-utils + - name: Create release branch and tag + env: + GITHUB_TOKEN: ${{ secrets.LAVANET_BOT_TOKEN }} + run: | + git config user.email "bot@lavanet.xyz" + git config user.name "LavaNet Bot" + # Update origin with token + git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git + ./.github/scripts/create-release.sh ${{ inputs.rel_version }} \ No newline at end of file From 132a9a75f17fd68279d4e325fd449366436d7077 Mon Sep 17 00:00:00 2001 From: amitz Date: Thu, 21 Mar 2024 20:51:33 +0200 Subject: [PATCH 35/43] put checkout first --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0aab469b1..dd223cb908 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,14 +16,14 @@ jobs: os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Install Go uses: actions/setup-go@v5 with: go-version: 1.20.5 - - name: Checkout code - uses: actions/checkout@v4 - - name: Run GoReleaser id: releaser uses: goreleaser/goreleaser-action@v5 From 3a4a0097daf7337362a387ba6664332d65d3595c Mon Sep 17 00:00:00 2001 From: amitz Date: Thu, 21 Mar 2024 22:43:59 +0200 Subject: [PATCH 36/43] pipeline name change --- .github/workflows/ci.yml | 35 --------------------- .github/workflows/lava.yml | 64 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 35 deletions(-) delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/lava.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index dd223cb908..0000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: CI - -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - ci: - strategy: - matrix: - binary: [lavad, lavap, lavavisor] - os: [ubuntu-latest, macos-latest, windows-latest] - runs-on: ${{ matrix.os }} - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install Go - uses: actions/setup-go@v5 - with: - go-version: 1.20.5 - - - name: Run GoReleaser - id: releaser - uses: goreleaser/goreleaser-action@v5 - with: - version: latest - args: build --single-target --snapshot --clean - workdir: cmd/${{ matrix.binary }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/lava.yml b/.github/workflows/lava.yml new file mode 100644 index 0000000000..b9f621bd7a --- /dev/null +++ b/.github/workflows/lava.yml @@ -0,0 +1,64 @@ +name: Lava + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + ci: + strategy: + matrix: + binary: [lavad, lavap, lavavisor] + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version: 1.20.5 + + - name: Run GoReleaser + id: releaser + uses: goreleaser/goreleaser-action@v5 + with: + version: latest + args: build --single-target --snapshot --clean + workdir: cmd/${{ matrix.binary }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + lava/${{ matrix.binary }} + ghcr.io/lavanet/${{ matrix.binary }} + tags: | + type=raw,value=latest,enable={{is_default_branch}} + type=schedule + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + \ No newline at end of file From acf60f4e199428b554f6ad28555b722894fe8cb8 Mon Sep 17 00:00:00 2001 From: amitz Date: Sat, 23 Mar 2024 22:22:13 +0200 Subject: [PATCH 37/43] dockerilfe --- .dockerignore | 4 +- cmd/lavad/Dockerfile | 89 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 cmd/lavad/Dockerfile diff --git a/.dockerignore b/.dockerignore index 949de17e5b..146e253a30 100644 --- a/.dockerignore +++ b/.dockerignore @@ -16,4 +16,6 @@ ecosystem/**/package-lock.json .git/ .idea/ .vscode/ -.storage/ \ No newline at end of file +.storage/ + +Dockerfile \ No newline at end of file diff --git a/cmd/lavad/Dockerfile b/cmd/lavad/Dockerfile new file mode 100644 index 0000000000..1d6ae76e4b --- /dev/null +++ b/cmd/lavad/Dockerfile @@ -0,0 +1,89 @@ +# syntax = docker/dockerfile:1.2 + +ARG GO_VERSION="1.21" +ARG RUNNER_IMAGE="ubuntu:22.04" + +FROM golang:${GO_VERSION}-alpine3.18 as builder + +RUN apk add --no-cache \ + ca-certificates \ + build-base \ + linux-headers + +WORKDIR /lava +COPY go.mod go.sum ./ +RUN --mount=type=cache,target=/root/.cache/go-build \ + --mount=type=cache,target=/root/go/pkg/mod \ + go mod download + +COPY . . + +RUN --mount=type=cache,target=/root/.cache/go-build \ + --mount=type=cache,target=/root/go/pkg/mod \ + GOWORK=off go build \ + -mod=readonly \ + -ldflags \ + "-X github.com/cosmos/cosmos-sdk/version.Name="lava" \ + -X github.com/cosmos/cosmos-sdk/version.AppName="lavad" \ + -X github.com/cosmos/cosmos-sdk/version.Version=${GIT_VERSION} \ + -X github.com/cosmos/cosmos-sdk/version.Commit=${GIT_COMMIT} \ + -w -s -linkmode=external -extldflags '-Wl,-z,muldefs -static'" \ + -trimpath \ + -o /lava/build/lavad \ + /lava/cmd/lavad/main.go + +FROM ${RUNNER_IMAGE} + +ARG COSMOVISOR_VERSION="v1.5.0" + +RUN set -eux && \ + apt-get update && \ + apt-get install -y curl && \ + curl -sSL https://github.com/cosmos/cosmos-sdk/releases/download/cosmovisor%2F${COSMOVISOR_VERSION}/cosmovisor-${COSMOVISOR_VERSION}-linux-amd64.tar.gz | \ + tar -xz -C /usr/local/bin cosmovisor + +RUN set -eux && \ + chmod +x /usr/local/bin/* && \ + groupadd -g 1000 cosmovisor && \ + useradd -u 1000 -g 1000 -s /bin/bash -Md /lava cosmovisor + +ENV HOME /lava +WORKDIR $HOME + +RUN mkdir -p ~/.lava/cosmovisor && \ + mkdir -p ~/.lava/cosmovisor/genesis && \ + mkdir -p ~/.lava/cosmovisor/genesis/bin && \ + mkdir -p ~/.lava/cosmovisor/upgrades + +ENV LAVA_MONIKER="my-docker-lavad" + +ENV DAEMON_NAME=lavad \ + DAEMON_HOME=/lava/.lava \ + CHAIN_HOME=/lava \ + UNSAFE_SKIP_BACKUP=true \ + DAEMON_RESTART_AFTER_UPGRADE=true \ + DAEMON_ALLOW_DOWNLOAD_BINARIES=true \ + DAEMON_LOG_BUFFER_SIZE=512 \ + LAVA_CHAIN_ID=lava-testnet-2 + +COPY --from=builder /lava/build/lavad /lava/.lava/cosmovisor/genesis/bin/lavad + +RUN /lava/.lava/cosmovisor/genesis/bin/lavad init ${LAVA_MONIKER} \ + --chain-id ${LAVA_CHAIN_ID} \ + --home /lava/.lava \ + --overwrite + +# lava api +EXPOSE 1317 +# rosetta +EXPOSE 8080 +# grpc +EXPOSE 9090 +# grpc-web +EXPOSE 9090 +# tendermint p2p +EXPOSE 26656 +# tendermint rpc +EXPOSE 26657 + +CMD [ "cosmovisor", "run", "start", "--log_level", "warn" ] \ No newline at end of file From 700e96e6e41a27088a330383ced42a2a93a7a584 Mon Sep 17 00:00:00 2001 From: amitz Date: Sun, 24 Mar 2024 17:02:30 +0200 Subject: [PATCH 38/43] comment docker creation --- .github/workflows/lava.yml | 54 +++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/.github/workflows/lava.yml b/.github/workflows/lava.yml index b9f621bd7a..49c2cb8ab6 100644 --- a/.github/workflows/lava.yml +++ b/.github/workflows/lava.yml @@ -34,31 +34,31 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - images: | - lava/${{ matrix.binary }} - ghcr.io/lavanet/${{ matrix.binary }} - tags: | - type=raw,value=latest,enable={{is_default_branch}} - type=schedule - type=ref,event=branch - type=ref,event=pr - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} - type=sha - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Build and push - uses: docker/build-push-action@v5 - with: - context: . - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + # - name: Docker meta + # id: meta + # uses: docker/metadata-action@v5 + # with: + # images: | + # lava/${{ matrix.binary }} + # ghcr.io/lavanet/${{ matrix.binary }} + # tags: | + # type=raw,value=latest,enable={{is_default_branch}} + # type=schedule + # type=ref,event=branch + # type=ref,event=pr + # type=semver,pattern={{version}} + # type=semver,pattern={{major}}.{{minor}} + # type=semver,pattern={{major}} + # type=sha + # - name: Set up QEMU + # uses: docker/setup-qemu-action@v3 + # - name: Set up Docker Buildx + # uses: docker/setup-buildx-action@v3 + # - name: Build and push + # uses: docker/build-push-action@v5 + # with: + # context: . + # push: ${{ github.event_name != 'pull_request' }} + # tags: ${{ steps.meta.outputs.tags }} + # labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file From a5cde1ff243e7550060084d911d97bb24e618c6d Mon Sep 17 00:00:00 2001 From: amitz Date: Sun, 24 Mar 2024 17:18:59 +0200 Subject: [PATCH 39/43] remove wip dockerfile --- cmd/lavad/Dockerfile | 89 -------------------------------------------- 1 file changed, 89 deletions(-) delete mode 100644 cmd/lavad/Dockerfile diff --git a/cmd/lavad/Dockerfile b/cmd/lavad/Dockerfile deleted file mode 100644 index 1d6ae76e4b..0000000000 --- a/cmd/lavad/Dockerfile +++ /dev/null @@ -1,89 +0,0 @@ -# syntax = docker/dockerfile:1.2 - -ARG GO_VERSION="1.21" -ARG RUNNER_IMAGE="ubuntu:22.04" - -FROM golang:${GO_VERSION}-alpine3.18 as builder - -RUN apk add --no-cache \ - ca-certificates \ - build-base \ - linux-headers - -WORKDIR /lava -COPY go.mod go.sum ./ -RUN --mount=type=cache,target=/root/.cache/go-build \ - --mount=type=cache,target=/root/go/pkg/mod \ - go mod download - -COPY . . - -RUN --mount=type=cache,target=/root/.cache/go-build \ - --mount=type=cache,target=/root/go/pkg/mod \ - GOWORK=off go build \ - -mod=readonly \ - -ldflags \ - "-X github.com/cosmos/cosmos-sdk/version.Name="lava" \ - -X github.com/cosmos/cosmos-sdk/version.AppName="lavad" \ - -X github.com/cosmos/cosmos-sdk/version.Version=${GIT_VERSION} \ - -X github.com/cosmos/cosmos-sdk/version.Commit=${GIT_COMMIT} \ - -w -s -linkmode=external -extldflags '-Wl,-z,muldefs -static'" \ - -trimpath \ - -o /lava/build/lavad \ - /lava/cmd/lavad/main.go - -FROM ${RUNNER_IMAGE} - -ARG COSMOVISOR_VERSION="v1.5.0" - -RUN set -eux && \ - apt-get update && \ - apt-get install -y curl && \ - curl -sSL https://github.com/cosmos/cosmos-sdk/releases/download/cosmovisor%2F${COSMOVISOR_VERSION}/cosmovisor-${COSMOVISOR_VERSION}-linux-amd64.tar.gz | \ - tar -xz -C /usr/local/bin cosmovisor - -RUN set -eux && \ - chmod +x /usr/local/bin/* && \ - groupadd -g 1000 cosmovisor && \ - useradd -u 1000 -g 1000 -s /bin/bash -Md /lava cosmovisor - -ENV HOME /lava -WORKDIR $HOME - -RUN mkdir -p ~/.lava/cosmovisor && \ - mkdir -p ~/.lava/cosmovisor/genesis && \ - mkdir -p ~/.lava/cosmovisor/genesis/bin && \ - mkdir -p ~/.lava/cosmovisor/upgrades - -ENV LAVA_MONIKER="my-docker-lavad" - -ENV DAEMON_NAME=lavad \ - DAEMON_HOME=/lava/.lava \ - CHAIN_HOME=/lava \ - UNSAFE_SKIP_BACKUP=true \ - DAEMON_RESTART_AFTER_UPGRADE=true \ - DAEMON_ALLOW_DOWNLOAD_BINARIES=true \ - DAEMON_LOG_BUFFER_SIZE=512 \ - LAVA_CHAIN_ID=lava-testnet-2 - -COPY --from=builder /lava/build/lavad /lava/.lava/cosmovisor/genesis/bin/lavad - -RUN /lava/.lava/cosmovisor/genesis/bin/lavad init ${LAVA_MONIKER} \ - --chain-id ${LAVA_CHAIN_ID} \ - --home /lava/.lava \ - --overwrite - -# lava api -EXPOSE 1317 -# rosetta -EXPOSE 8080 -# grpc -EXPOSE 9090 -# grpc-web -EXPOSE 9090 -# tendermint p2p -EXPOSE 26656 -# tendermint rpc -EXPOSE 26657 - -CMD [ "cosmovisor", "run", "start", "--log_level", "warn" ] \ No newline at end of file From d42f301d190667d159802e80c8b5e37e5e515bdc Mon Sep 17 00:00:00 2001 From: amitz Date: Sun, 24 Mar 2024 17:31:23 +0200 Subject: [PATCH 40/43] upload pr binaries --- .github/workflows/lava.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lava.yml b/.github/workflows/lava.yml index 49c2cb8ab6..e52cb504b4 100644 --- a/.github/workflows/lava.yml +++ b/.github/workflows/lava.yml @@ -23,6 +23,8 @@ jobs: uses: actions/setup-go@v5 with: go-version: 1.20.5 + go-version-file: go.mod + cache-dependency-path: go.sum - name: Run GoReleaser id: releaser @@ -33,7 +35,12 @@ jobs: workdir: cmd/${{ matrix.binary }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - + + - uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.binary }}-${{ fromJson(steps.releaser.outputs.metadata).tag }}-${{ fromJson(steps.releaser.outputs.metadata).goos }}-${{ fromJson(steps.releaser.outputs.metadata).goarch }} + path: cmd/${{ matrix.binary }}/${{ fromJson(steps.releaser.outputs.artifacts)[0].path }} + # - name: Docker meta # id: meta # uses: docker/metadata-action@v5 From fddb87e6c34a0e8effc8bfbc1403f47cbcced3ec Mon Sep 17 00:00:00 2001 From: amitz Date: Sun, 24 Mar 2024 17:32:05 +0200 Subject: [PATCH 41/43] naming --- .github/workflows/{create-release.yaml => create_release.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{create-release.yaml => create_release.yaml} (100%) diff --git a/.github/workflows/create-release.yaml b/.github/workflows/create_release.yaml similarity index 100% rename from .github/workflows/create-release.yaml rename to .github/workflows/create_release.yaml From 3788137aaed106d5205a6487a2aabc0d2a966e35 Mon Sep 17 00:00:00 2001 From: amitz Date: Sun, 24 Mar 2024 17:35:07 +0200 Subject: [PATCH 42/43] artifactgs --- .github/workflows/lava.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lava.yml b/.github/workflows/lava.yml index e52cb504b4..8e60bbe5be 100644 --- a/.github/workflows/lava.yml +++ b/.github/workflows/lava.yml @@ -38,7 +38,7 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: ${{ matrix.binary }}-${{ fromJson(steps.releaser.outputs.metadata).tag }}-${{ fromJson(steps.releaser.outputs.metadata).goos }}-${{ fromJson(steps.releaser.outputs.metadata).goarch }} + name: ${{ matrix.binary }}-${{ fromJson(steps.releaser.outputs.metadata).tag }}-${{ fromJson(steps.releaser.outputs.artifacts).goos }}-${{ fromJson(steps.releaser.outputs.artifacts).goarch }} path: cmd/${{ matrix.binary }}/${{ fromJson(steps.releaser.outputs.artifacts)[0].path }} # - name: Docker meta From 0824d89071128e62f9824c93f535311d14893cae Mon Sep 17 00:00:00 2001 From: amitz Date: Sun, 24 Mar 2024 17:36:44 +0200 Subject: [PATCH 43/43] 0 --- .github/workflows/lava.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lava.yml b/.github/workflows/lava.yml index 8e60bbe5be..e95435cd5d 100644 --- a/.github/workflows/lava.yml +++ b/.github/workflows/lava.yml @@ -38,7 +38,7 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: ${{ matrix.binary }}-${{ fromJson(steps.releaser.outputs.metadata).tag }}-${{ fromJson(steps.releaser.outputs.artifacts).goos }}-${{ fromJson(steps.releaser.outputs.artifacts).goarch }} + name: ${{ matrix.binary }}-${{ fromJson(steps.releaser.outputs.metadata).tag }}-${{ fromJson(steps.releaser.outputs.artifacts)[0].goos }}-${{ fromJson(steps.releaser.outputs.artifacts)[0].goarch }} path: cmd/${{ matrix.binary }}/${{ fromJson(steps.releaser.outputs.artifacts)[0].path }} # - name: Docker meta