Skip to content

Commit

Permalink
Merge branch 'main' into PRT-split-payment-for-very-big-payment-trans…
Browse files Browse the repository at this point in the history
…actions
  • Loading branch information
ranlavanet committed Mar 24, 2024
2 parents f4db5a2 + 91958bd commit 804fc2f
Show file tree
Hide file tree
Showing 12 changed files with 529 additions and 140 deletions.
4 changes: 3 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ ecosystem/**/package-lock.json
.git/
.idea/
.vscode/
.storage/
.storage/

Dockerfile
41 changes: 41 additions & 0 deletions .github/scripts/create-release.sh
Original file line number Diff line number Diff line change
@@ -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."
32 changes: 32 additions & 0 deletions .github/workflows/create_release.yaml
Original file line number Diff line number Diff line change
@@ -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 "[email protected]"
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 }}
71 changes: 71 additions & 0 deletions .github/workflows/lava.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
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
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 }}

10 changes: 6 additions & 4 deletions .github/workflows/main.yml → .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,22 @@ on:
branches:
- main
pull_request:
branches:
- main

jobs:
lint:
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
args: --print-issued-lines --config .golangci.yml -v
Loading

0 comments on commit 804fc2f

Please sign in to comment.