Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into solana-sync-fork
Browse files Browse the repository at this point in the history
  • Loading branch information
eloylp committed Mar 6, 2024
2 parents 010d752 + 0be4b7d commit e16b55a
Show file tree
Hide file tree
Showing 192 changed files with 19,997 additions and 5,112 deletions.
1 change: 0 additions & 1 deletion .cargo/config
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[alias]
wasm = "build --release --lib --target wasm32-unknown-unknown --locked --workspace --exclude ampd"
unit-test = "test --lib"
schema = "run --bin schema"

[build]
rustflags = ["--cfg", "tracing_unstable"]
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
# Each line is a file pattern followed by one or more owners.

* @axelarnetwork/core
.github/workflows/* @axelarnetwork/devops @axelarnetwork/core
.github/actions/* @axelarnetwork/devops @axelarnetwork/core
**/Dockerfile @axelarnetwork/devops @axelarnetwork/core
164 changes: 164 additions & 0 deletions .github/actions/release/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
---
name: 'Release'
description: 'Wrapper around the Semver library to create releases'
inputs:
binary-to-release:
description: "Name of binary to release"
required: true
default: 'ampd'
dry-run:
description: "When true, just output plan"
required: true
default: 'true'
major-pattern:
description: "major pattern match string"
minor-pattern:
description: "minor pattern match string"
change-path:
description: "paths to observe for changes"

runs:
using: "composite"
steps:
- name: Print inputs
id: print-inputs
shell: bash
run: |
echo "binary-to-release:
${{ inputs.binary-to-release }}"
echo "dry-run:
${{ inputs.dry-run }}"
echo "major-pattern:
${{ inputs.major-pattern }}"
echo "minor-pattern:
${{ inputs.minor-pattern }}"
echo "change-path:
${{ inputs.change-path }}"
- name: Determine next semantic version
id: semantic-version
uses: paulhatch/[email protected]
with:
major_pattern: ${{ inputs.major-pattern }}
minor_pattern: ${{ inputs.minor-pattern }}
change_path: ${{ inputs.change-path }}
tag_prefix: ${{ inputs.binary-to-release }}-v
version_from_branch: false

- name: Print determined semantic version
id: print-semantic-version
shell: bash
run: |
echo "MAJOR:
${{ steps.semantic-version.outputs.major }}"
echo "MINOR:
${{ steps.semantic-version.outputs.minor }}"
echo "PATCH:
${{ steps.semantic-version.outputs.patch }}"
echo "VERSION:
${{ steps.semantic-version.outputs.version }}"
echo "VERSION-TAG:
${{ steps.semantic-version.outputs.version_tag }}"
echo "VERSION-TYPE:
${{ steps.semantic-version.outputs.version_type }}"
echo "IS-TAGGED:
${{ steps.semantic-version.outputs.is_tagged }}"
echo "CHANGED:
${{ steps.semantic-version.outputs.changed }}"
echo "PREVIOUS-VERSION:
${{ steps.semantic-version.outputs.previous_version }}"
- name: Check if tag already exists (possible collision with an orphaned
commit tagged as patch)
id: validate-tag
shell: bash
if: ${{ steps.semantic-version.outputs.changed == 'true' }}
run: |
if [[
! -z "$(git tag -l ${{ steps.semantic-version.outputs.version_tag }})"
]]; then
cat << EOF
Tag already exists: ${{ steps.semantic-version.outputs.version_tag }}
This means that there is a commit tagged as patch that is not part of
the main branch. Under these circumstances the preferred way to
release is to create a new minor release from the main branch
However, if you must release a patch, please follow the steps below
Please check the tags and use the patch commit as the base for the
new release.
Retrieve the latest patch commit from the tag:
git tag --list ${{inputs.binary-to-release}}-v*
Checkout the tag:
git checkout <latest-existing-patch>
Create a new branch from the commit:
git checkout -b patch/${{inputs.binary-to-release}}/<new-patch>
Cherry pick current changes to the new branch:
git cherry-pick ${{ github.sha }}
Push the new branch:
git push origin <branch-name>
Create a PR from the new branch to the previous patch tag
hub pull-request -b <previous-latest-patch-tag>
Once the PR is approved, run the release workflow and choose the
branch created above as the base branch. Note that this patch will not
be part of the main branch unless explicitly merged into it. And none
of the commits from the main branch since the last patch will be part
of this release.
EOF
exit 1
else
echo "Tag is unique. OK to proceed"
fi
- name: Check major and minor releases are from main branch only
id: validate-branch
shell: bash
if:
steps.semantic-version.outputs.changed == 'true' &&
(steps.semantic-version.outputs.version_type == 'major' ||
steps.semantic-version.outputs.version_type == 'minor')
run: |
if [[ "${{ github.ref }}" != "refs/heads/main" ]]; then
echo "Major and Minor releases are only allowed from main branch"
exit 1
else
echo "Release from main branch. OK to proceed"
fi
- name: Install cargo-release
shell: bash
working-directory: ${{ runner.temp }}
run: |
wget -q https://github.com/crate-ci/cargo-release/releases/download/v0.25.4/cargo-release-v0.25.4-x86_64-unknown-linux-gnu.tar.gz
tar -zxf cargo-release-v0.25.4-x86_64-unknown-linux-gnu.tar.gz
mv cargo-release /home/runner/.cargo/bin/cargo-release
- name: Release cargo crate (dry run)
shell: bash
if:
inputs.dry-run == 'true' &&
steps.semantic-version.outputs.changed == 'true'
run: |
cargo release -p ${{ inputs.binary-to-release }} \
${{ steps.semantic-version.outputs.version_type }} \
-v
- name: Release cargo crate
shell: bash
if:
inputs.dry-run == 'false' &&
steps.semantic-version.outputs.changed == 'true'
run: |
git config --global user.email "[email protected]"
git config --global user.name "Axelar DevOps"
cargo release -x \
--no-confirm \
-p ${{ inputs.binary-to-release }} \
${{ steps.semantic-version.outputs.version_type }}
20 changes: 11 additions & 9 deletions .github/workflows/basic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,24 @@ name: Basic
jobs:
test:
name: Test Suite
runs-on: ubuntu-8-core-32-gb
runs-on: blacksmith-32vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v4

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.71.1
toolchain: 1.73.0
override: true

- name: Install protoc
uses: arduino/setup-protoc@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Cache build artifacts
uses: Swatinem/rust-cache@v2
uses: useblacksmith/rust-cache@v3
with:
shared-key: "cache"

Expand All @@ -42,20 +44,20 @@ jobs:

cosmwasm-compilation:
name: Cosmwasm Compilation
runs-on: ubuntu-8-core-32-gb
runs-on: blacksmith-32vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v4

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.71.1
toolchain: 1.73.0
target: wasm32-unknown-unknown
override: true

- name: Cache build artifacts
uses: Swatinem/rust-cache@v2
uses: useblacksmith/rust-cache@v3
with:
shared-key: "cache"

Expand All @@ -78,15 +80,15 @@ jobs:

lints:
name: Lints
runs-on: ubuntu-8-core-32-gb
runs-on: blacksmith-16vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v4

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.71.1
toolchain: 1.73.0
override: true
components: rustfmt, clippy

Expand All @@ -96,7 +98,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Cache build artifacts
uses: Swatinem/rust-cache@v2
uses: useblacksmith/rust-cache@v3
with:
shared-key: "cache"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
name: Build and push latest docker image
name: Amplifier - Build main branch

on:
push:
branches:
- main
workflow_dispatch:

jobs:
build-and-push-latest-docker-image:
strategy:
matrix:
os:
- ubuntu-20.04
runs-on: ${{ matrix.os }}
runs-on: ubuntu-22.04
permissions:
id-token: write
contents: read
env:
REPOSITORY: axelar-amplifier
IMAGE_TAG: ${{ github.sha }}
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand All @@ -33,12 +33,19 @@ jobs:
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: check if an image already build on same commit hash
id: image-tag-check
run: |
image_tag_exists=$(aws ecr batch-get-image --repository-name ${REPOSITORY} --image-ids "imageTag=${IMAGE_TAG}" | jq '.images | length')
echo "image_tag_exists=${image_tag_exists}" >> $GITHUB_OUTPUT
- uses: docker/setup-buildx-action@v3
if: steps.image-tag-check.outputs.image_tag_exists == 0

- uses: docker/build-push-action@v5
if: steps.image-tag-check.outputs.image_tag_exists == 0
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: axelar-amplifier
IMAGE_TAG: ${{ github.sha }}
with:
context: .
push: true
Expand Down
Loading

0 comments on commit e16b55a

Please sign in to comment.