-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into DO-2153-pr-artifacts
- Loading branch information
Showing
96 changed files
with
3,395 additions
and
1,166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,6 @@ ecosystem/**/package-lock.json | |
.git/ | ||
.idea/ | ||
.vscode/ | ||
.storage/ | ||
.storage/ | ||
|
||
Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: Lava Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
ci: | ||
strategy: | ||
matrix: | ||
binary: [lavad, lavap, lavavisor] | ||
targetos: [darwin, linux] | ||
arch: [amd64, arm64] | ||
runs-on: ubuntu-latest | ||
env: | ||
GOOS: ${{ matrix.targetos }} | ||
GOARCH: ${{ matrix.arch }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
cache-dependency-path: go.sum | ||
|
||
- 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 }} | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
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 | ||
# 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 }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,142 +1,144 @@ | ||
name: 'Release' | ||
name: Publish Lava Release | ||
|
||
on: | ||
release: | ||
types: [created, edited, prereleased] | ||
push: | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
|
||
permissions: | ||
contents: write | ||
contents: read | ||
|
||
jobs: | ||
release: | ||
name: 'release' | ||
runs-on: ubuntu-20.04 | ||
timeout-minutes: 10 | ||
environment: default | ||
defaults: | ||
run: | ||
shell: bash | ||
|
||
strategy: | ||
matrix: | ||
binary: [lavad, lavap, lavavisor] | ||
targetos: [darwin, linux] | ||
arch: [amd64, arm64] | ||
runs-on: ubuntu-latest | ||
env: | ||
GOOS: ${{ matrix.targetos }} | ||
GOARCH: ${{ matrix.arch }} | ||
|
||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Configure Go | ||
uses: actions/setup-go@v3 | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
go-version: 1.20.5 | ||
check-latest: true | ||
cache: true | ||
fetch-depth: 0 | ||
|
||
- name: Set Environment Variable | ||
- name: Fetch all tags | ||
run: | | ||
echo "LAVA_BUILD_OPTIONS=\"release\"" >> $GITHUB_ENV | ||
git fetch --force --tags | ||
- name: Build | ||
run: | | ||
make build-all | ||
- name: Configure Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
cache-dependency-path: go.sum | ||
|
||
- 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 <<EOF >> /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 --clean --timeout 90m | ||
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 <<EOF >> /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 }} | ||
# }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,10 +35,9 @@ builds: | |
goarch: ppc64le | ||
- goos: windows | ||
goarch: arm64 | ||
|
||
nfpms: | ||
- id: lavad | ||
maintainer: Amit <[email protected]> | ||
flags: | ||
- -mod=readonly | ||
- -trimpath | ||
|
||
archives: | ||
- format: tar.gz | ||
|
@@ -84,3 +83,12 @@ changelog: | |
- '^test:' | ||
- '^.*?Bump(\([[:word:]]+\))?.+$' | ||
- '^.*?[Bot](\([[:word:]]+\))?.+$' | ||
|
||
release: | ||
github: | ||
owner: lavanet | ||
name: lava | ||
replace_existing_draft: true | ||
name_template: "Lava v{{.Version}} 🌋" | ||
mode: replace | ||
draft: true |
Oops, something went wrong.