Skip to content

Commit

Permalink
Merge branch 'near:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Longarithm authored May 7, 2024
2 parents 41d3ea7 + f31e309 commit c1e6a19
Show file tree
Hide file tree
Showing 116 changed files with 2,309 additions and 1,661 deletions.
101 changes: 101 additions & 0 deletions .github/workflows/neard_custom_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Neard binary image - custom build

on:
# Run when a new release or rc is created

workflow_dispatch:
inputs:
release:
default: 'neard-release'
description: "Nearcore release type to do"
type: string
required: true
branch:
default: 'master'
description: "Nearcore branch to build and publish"
type: string
required: true

jobs:
binary-release:
name: "Build and publish neard binary"
runs-on: "ubuntu-20.04-16core"
environment: deploy
permissions:
id-token: write # required to use OIDC authentication

steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::754641474505:role/GitHubActionsRunner
aws-region: us-west-1

- name: Checkout ${{ github.event.inputs.branch }} branch
if: ${{ github.event_name == 'workflow_dispatch'}}
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}

- name: Checkout nearcore repository
if: ${{ github.event_name != 'workflow_dispatch'}}
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Neard binary build and upload to S3
run: ./scripts/binary_release.sh ${{ github.event.inputs.release }}

- name: Update latest version metadata in S3
run: |
echo $(git rev-parse HEAD) > latest
BRANCH=$(git branch --show-current)
# in case of Release triggered run, branch is empty
if [ -z "$BRANCH" ]; then
BRANCH=$(git branch -r --contains=${{ github.ref_name }} | head -n1 | cut -c3- | cut -d / -f 2)
fi
aws s3 cp --acl public-read latest s3://build.nearprotocol.com/nearcore/$(uname)/${BRANCH}/latest
docker-release:
name: "Build and publish nearcore Docker image"
runs-on: "ubuntu-20.04-16core"
environment: deploy
steps:
- name: Checkout ${{ github.event.inputs.branch }} branch
if: ${{ github.event_name == 'workflow_dispatch'}}
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}

- name: Checkout nearcore repository
if: ${{ github.event_name != 'workflow_dispatch'}}
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKER_PAT_TOKEN }}

- name: Build and push Docker image to Dockerhub
run: |
COMMIT=$(git rev-parse HEAD)
BRANCH=$(git branch --show-current)
# in case of Release triggered run, branch is empty
if [ -z "$BRANCH" ]; then
BRANCH=$(git branch -r --contains=${{ github.ref_name }} | head -n1 | cut -c3- | cut -d / -f 2)
fi
make docker-nearcore
docker tag nearcore nearprotocol/nearcore:${BRANCH}-${COMMIT}
docker tag nearcore nearprotocol/nearcore:${BRANCH}
docker push nearprotocol/nearcore:${BRANCH}-${COMMIT}
docker push nearprotocol/nearcore:${BRANCH}
if [[ ${BRANCH} == "master" ]];
then
docker tag nearcore nearprotocol/nearcore:latest
docker push nearprotocol/nearcore:latest
fi
108 changes: 16 additions & 92 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
version = "0.0.0" # managed by cargo-workspaces, see below
authors = ["Near Inc <hello@nearprotocol.com>"]
edition = "2021"
rust-version = "1.77.0"
rust-version = "1.78.0"
repository = "https://github.com/near/nearcore"
license = "MIT OR Apache-2.0"

Expand Down
2 changes: 1 addition & 1 deletion chain/chain/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ impl Chain {
}

fn get_genesis_congestion_info(protocol_version: ProtocolVersion) -> Option<CongestionInfo> {
if protocol_version >= ProtocolFeature::CongestionControl.protocol_version() {
if ProtocolFeature::CongestionControl.enabled(protocol_version) {
// TODO(congestion_control) - properly initialize
Some(CongestionInfo::default())
} else {
Expand Down
Loading

0 comments on commit c1e6a19

Please sign in to comment.