Skip to content

Commit

Permalink
Merge branch 'develop' into zeta-supply-checks
Browse files Browse the repository at this point in the history
  • Loading branch information
lumtis authored Nov 10, 2023
2 parents 961c762 + 4841dfd commit a06bb9f
Show file tree
Hide file tree
Showing 38 changed files with 1,914 additions and 570 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:

smoke-test:
runs-on: ["zeta-runners"] # 25 minutes
timeout-minutes: 25
timeout-minutes: 30
steps:
- uses: actions/checkout@v3

Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/change-log-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Changelog Check

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
check-changelog:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Check for CHANGELOG.md changes
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-changelog') }}
run: |
git fetch origin ${{ github.base_ref }}
CHANGELOG_DIFF=$(git diff origin/${{ github.base_ref }} origin/${{ github.head_ref }} -- changelog.md)
echo "${CHANGELOG_DIFF}"
if [ -z "$CHANGELOG_DIFF" ]; then
echo "ERROR: No changes detected in CHANGELOG.md. Please update the changelog."
exit 1
else
echo "CHANGELOG.md has been updated."
fi
141 changes: 28 additions & 113 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ concurrency:

jobs:
pre-release-checks:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
Expand All @@ -32,16 +31,12 @@ jobs:
run: |
echo "GITHUB_TAG_MAJOR_VERSION=${{ github.event.pull_request.title }}" >> ${GITHUB_ENV}
- name: Set Version for Hotfix Release from Input.
if: github.event_name != 'pull_request'
run: |
echo "GITHUB_TAG_MAJOR_VERSION=${{ github.event.inputs.version }}" >> ${GITHUB_ENV}
- name: Major Version in Upgrade Handler Must Match Tag
if: github.event_name == 'pull_request'
run: |
UPGRADE_HANDLER_MAJOR_VERSION=$(cat app/setup_handlers.go | grep "const releaseVersion" | cut -d ' ' -f4 | tr -d '"' | cut -d '.' -f1)
UPGRADE_HANDLER_MAJOR_VERSION=$(cat app/setup_handlers.go | grep "const releaseVersion" | cut -d ' ' -f4 | tr -d '"')
echo $UPGRADE_HANDLER_MAJOR_VERSION
GITHUB_TAG_MAJOR_VERSION=$(echo ${{ github.ref_name }} | cut -d '.' -f1)
echo $GITHUB_TAG_MAJOR_VERSION
if [ $GITHUB_TAG_MAJOR_VERSION != $UPGRADE_HANDLER_MAJOR_VERSION ]; then
echo "ERROR: The major version of this release (${{ github.ref_name }}) does not match the major version in the releaseVersion constant ($UPGRADE_HANDLER_MAJOR_VERSION) found in app/setup_handlers.go"
echo "Did you forget to update the 'releaseVersion' in app/setup_handlers.go?"
Expand All @@ -50,7 +45,6 @@ jobs:
echo "The major version found in 'releaseVersion' in app/setup_handlers.go matches this tagged release - Moving Forward!"
publish-release:
if: github.event.pull_request.merged == true
runs-on: buildjet-4vcpu-ubuntu-2004
timeout-minutes: 60
needs:
Expand All @@ -60,8 +54,10 @@ jobs:

- name: Echo Release Notes from PR Message.
if: github.event_name == 'pull_request'
id: release_notes
run: |
echo -e "${{ github.event.head_commit.message }}" > Release.txt
cat changelog.md > ${{ github.workspace }}-CHANGELOG.txt
cat ${{ github.workspace }}-CHANGELOG.txt
- name: Set Version from the PR title.
if: github.event_name == 'pull_request'
Expand Down Expand Up @@ -94,133 +90,52 @@ jobs:
skip_aws_cli: "true"
skip_docker_compose: "true"

- name: Create Release Tag
shell: bash
run: |
git tag ${GITHUB_TAG_MAJOR_VERSION}
create_tag=$(git push --tags || echo "tag exists")
if [[ $create_tag == "tag exists" ]]; then
echo "Delete existing tag to re-create"
git tag -d ${GITHUB_TAG_MAJOR_VERSION}
git push --delete origin ${GITHUB_TAG_MAJOR_VERSION}
echo "sleep for 5 seconds to let github catch up."
sleep 5
echo "Re-Create Tag."
git tag ${GITHUB_TAG_MAJOR_VERSION}
git push --tags
fi
- name: Create GitHub Release on Pull Request
if: github.event_name == 'pull_request'
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.PAT_GITHUB_SERVICE_ACCT }}
files: Release.txt
body_path: ${{ github.workspace }}-CHANGELOG.txt
tag_name: ${{ env.GITHUB_TAG_MAJOR_VERSION }}

- name: Create GitHub Release Hot Fix
if: github.event_name != 'pull_request'
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.PAT_GITHUB_SERVICE_ACCT }}
generate_release_notes: true
tag_name: ${{ env.GITHUB_TAG_MAJOR_VERSION }}

- name: Publish Release Files
env:
GITHUB_TOKEN: ${{ secrets.PAT_GITHUB_SERVICE_ACCT }}
GORELEASER_CURRENT_TAG: ${{ env.GITHUB_TAG_MAJOR_VERSION }}
run: |
touch .release-env
make release
- name: Build, tag, and push docker images
uses: ./.github/actions/build-docker-images
with:
DOCKER_FILENAME: Dockerfile-relese
REPOSITORY_NAME: zeta-node
IMAGE_TAG: ${{ env.GITHUB_TAG_MAJOR_VERSION }}
GHCR_USERNAME: ${{ secrets.PAT_GITHUB_SERVICE_ACCT_USERNAME }}
GHCR_TOKEN: ${{ secrets.PAT_GITHUB_SERVICE_ACCT }}

build-alpine:
if: github.event.pull_request.merged == true
runs-on: ["ubuntu-latest"]
timeout-minutes: 30
concurrency:
group: "alpine-build-test"
needs:
- pre-release-checks
steps:
- uses: actions/checkout@v3

- name: Set CPU Architecture
shell: bash
run: |
if [ "$(uname -m)" == "aarch64" ]; then
echo "CPU_ARCH=arm64" >> $GITHUB_ENV
elif [ "$(uname -m)" == "x86_64" ]; then
echo "CPU_ARCH=amd64" >> $GITHUB_ENV
else
echo "Unsupported architecture" >&2
exit 1
fi
- name: Install Pipeline Dependencies
uses: ./.github/actions/install-dependencies
timeout-minutes: 8
with:
cpu_architecture: ${{ env.CPU_ARCH }}
skip_python: "true"
skip_aws_cli: "true"
skip_docker_compose: "false"

- uses: jirutka/setup-alpine@v1
with:
branch: v3.17
arch: x86_64
packages: >
build-base
pkgconf
lld
go
gcc
g++
libusb-dev
linux-headers
git
shell-name: alpine.sh

- name: Build zetacored and zetaclientd
env:
CGO_ENABLED: 1
GOOS: linux
GOARCH: ${{ env.CPU_ARCH }}
shell: alpine.sh --root {0}
run: |
git config --global --add safe.directory '*'
make install-testnet
cp "$HOME"/go/bin/* ./
- name: Binary Docker Test
env:
CPU_ARCH: ${{ env.CPU_ARCH }}
shell: alpine.sh --root {0}
run: |
chmod a+x ./zetacored
./zetacored version
mv zetacored zetacored-testnet-alpine-$CPU_ARCH
mv zetaclientd zetaclientd-testnet-alpine-$CPU_ARCH
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.PAT_GITHUB_SERVICE_ACCT }}
generate_release_notes: true
files: |
zetacored-*
zetaclientd-*
- name: Clean Up Alpine Workspace
if: always()
shell: alpine.sh --root {0}
run: |
set -e # fail on error
rm -rf *
- name: Clean Up Workspace
if: always()
shell: bash
run: rm -rf *

announce-release:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
timeout-minutes: 10
needs:
- publish-release
- build-alpine
steps:
- uses: actions/checkout@v3
- name: Get Version
Expand All @@ -246,9 +161,9 @@ jobs:
discord_token: "${{ secrets.DISCORD_TOKEN }}"
discord_channel_id: "${{ secrets.DISCORD_CHANNEL_ID }}"
discord_message: |
Hey <@&1122981184255840306>! A new version of the ZetaChain software has been released.
Hey <@&1122981184255840306>! A new version of the ZetaChain software has been released.
Major Version Upgrade (e.g. v5.x.x to V6.x.x) must be completed through a governance proposal.
Major Version Upgrade (e.g. v5.x.x to V6.x.x) must be completed through a governance proposal.
We will submit a governance proposal in the next few days.
More specific information including block height will be shared as part of the governance proposal.
Expand Down
108 changes: 8 additions & 100 deletions .github/workflows/rc-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ jobs:
exit 1
fi
- name: Echo Release Notes from PR Message.
id: release_notes
run: |
cat changelog.md > ${{ github.workspace }}-CHANGELOG.txt
cat ${{ github.workspace }}-CHANGELOG.txt
- name: Install Pipeline Dependencies
uses: ./.github/actions/install-dependencies
timeout-minutes: 8
Expand All @@ -66,6 +72,7 @@ jobs:
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.PAT_GITHUB_SERVICE_ACCT }}
body_path: ${{ github.workspace }}-CHANGELOG.txt
generate_release_notes: true

- name: Publish Release Files
Expand All @@ -75,110 +82,11 @@ jobs:
touch .release-env
make release
- name: Build, tag, and push docker images
uses: ./.github/actions/build-docker-images
with:
DOCKER_FILENAME: Dockerfile-relese
REPOSITORY_NAME: zeta-node
IMAGE_TAG: ${{ env.GITHUB_TAG_MAJOR_VERSION }}
GHCR_USERNAME: ${{ secrets.PAT_GITHUB_SERVICE_ACCT_USERNAME }}
GHCR_TOKEN: ${{ secrets.PAT_GITHUB_SERVICE_ACCT }}

build-alpine:
runs-on: ["ubuntu-latest"]
timeout-minutes: 30
concurrency:
group: "alpine-build-test"
needs:
- pre-release-checks
steps:
- uses: actions/checkout@v3

- name: Set CPU Architecture
shell: bash
run: |
if [ "$(uname -m)" == "aarch64" ]; then
echo "CPU_ARCH=arm64" >> $GITHUB_ENV
elif [ "$(uname -m)" == "x86_64" ]; then
echo "CPU_ARCH=amd64" >> $GITHUB_ENV
else
echo "Unsupported architecture" >&2
exit 1
fi
- name: Install Pipeline Dependencies
uses: ./.github/actions/install-dependencies
timeout-minutes: 8
with:
cpu_architecture: ${{ env.CPU_ARCH }}
skip_python: "true"
skip_aws_cli: "true"
skip_docker_compose: "false"

- uses: jirutka/setup-alpine@v1
with:
branch: v3.17
arch: x86_64
packages: >
build-base
pkgconf
lld
go
gcc
g++
libusb-dev
linux-headers
git
shell-name: alpine.sh

- name: Build zetacored and zetaclientd
env:
CGO_ENABLED: 1
GOOS: linux
GOARCH: ${{ env.CPU_ARCH }}
shell: alpine.sh --root {0}
run: |
git config --global --add safe.directory '*'
make install-testnet
cp "$HOME"/go/bin/* ./
- name: Binary Docker Test
env:
CPU_ARCH: ${{ env.CPU_ARCH }}
shell: alpine.sh --root {0}
run: |
chmod a+x ./zetacored
./zetacored version
mv zetacored zetacored-testnet-alpine-$CPU_ARCH
mv zetaclientd zetaclientd-testnet-alpine-$CPU_ARCH
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.PAT_GITHUB_SERVICE_ACCT }}
generate_release_notes: true
files: |
zetacored-*
zetaclientd-*
- name: Clean Up Alpine Workspace
if: always()
shell: alpine.sh --root {0}
run: |
set -e # fail on error
rm -rf *
- name: Clean Up Workspace
if: always()
shell: bash
run: rm -rf *

announce-release:
runs-on: ubuntu-latest
timeout-minutes: 10
needs:
- publish-release
- build-alpine
steps:
- uses: actions/checkout@v3
- name: Get Version
Expand Down Expand Up @@ -215,4 +123,4 @@ jobs:
- name: Clean Up Workspace
if: always()
shell: bash
run: rm -rf *
run: rm -rf *
Loading

0 comments on commit a06bb9f

Please sign in to comment.