Skip to content

Commit

Permalink
Merge pull request #16028 from MinaProtocol/dkijania/port_testnet_and…
Browse files Browse the repository at this point in the history
…_version_lint_dev

Port 3 version linters to develop
  • Loading branch information
dkijania authored Sep 10, 2024
2 parents 21f0cca + 6d9954a commit 4d7d7d2
Show file tree
Hide file tree
Showing 14 changed files with 58 additions and 352 deletions.
4 changes: 2 additions & 2 deletions buildkite/scripts/dump-mina-type-shapes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ source buildkite/scripts/export-git-env-vars.sh

source buildkite/scripts/debian/install.sh "mina-${TESTNET_NAME}" 1

MINA_COMMIT_SHA1=$(git log -n 1 --format=%h --abbrev=7 --no-merges)
MINA_COMMIT_SHA1=$(git log -n 1 --format=%h --abbrev=7)
export TYPE_SHAPE_FILE=${MINA_COMMIT_SHA1}-type_shape.txt

echo "--- Create type shapes git note for commit: ${MINA_COMMIT_SHA1}"
mina internal dump-type-shapes > ${TYPE_SHAPE_FILE}
mina internal dump-type-shapes > ${TYPE_SHAPE_FILE}
2 changes: 1 addition & 1 deletion buildkite/scripts/version-linter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pip3 install sexpdata==1.0.0

base_branch=${REMOTE}/${BUILDKITE_PULL_REQUEST_BASE_BRANCH:-compatible}
pr_branch=origin/${BUILDKITE_BRANCH}
release_branch=${REMOTE}/$1
release_branch=origin/$1

echo "--- Run Python version linter with branches: ${pr_branch} ${base_branch} ${release_branch}"
./scripts/version-linter.py ${pr_branch} ${base_branch} ${release_branch}
Expand Down
24 changes: 19 additions & 5 deletions buildkite/src/Jobs/Test/VersionLint.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ let Cmd = ../../Lib/Cmds.dhall

let S = ../../Lib/SelectFiles.dhall

let B = ../../External/Buildkite.dhall

let B/SoftFail = B.definitions/commandStep/properties/soft_fail/Type

let Pipeline = ../../Pipeline/Dsl.dhall

let PipelineTag = ../../Pipeline/Tag.dhall
Expand Down Expand Up @@ -29,24 +33,26 @@ let dependsOn =
Profiles.Type.Standard

let buildTestCmd
: Text -> Size -> List Command.TaggedKey.Type -> Command.Type
: Text -> Size -> List Command.TaggedKey.Type -> B/SoftFail -> Command.Type
= \(release_branch : Text)
-> \(cmd_target : Size)
-> \(dependsOn : List Command.TaggedKey.Type)
-> \(soft_fail : B/SoftFail)
-> Command.build
Command.Config::{
, commands =
RunInToolchain.runInToolchain
([] : List Text)
"buildkite/scripts/dump-mina-type-shapes.sh"
# [ Cmd.run
"gsutil cp \$(git log -n 1 --format=%h --abbrev=7 --no-merges)-type_shape.txt \$MINA_TYPE_SHAPE gs://mina-type-shapes"
"gsutil cp \$(git log -n 1 --format=%h --abbrev=7)-type_shape.txt \$MINA_TYPE_SHAPE gs://mina-type-shapes"
]
# RunInToolchain.runInToolchain
([] : List Text)
"buildkite/scripts/version-linter.sh ${release_branch}"
, label = "Versioned type linter"
, key = "version-linter"
, label = "Versioned type linter for ${release_branch}"
, key = "version-linter-${release_branch}"
, soft_fail = Some soft_fail
, target = cmd_target
, docker = None Docker.Type
, depends_on = dependsOn
Expand All @@ -72,5 +78,13 @@ in Pipeline.build
, PipelineTag.Type.Stable
]
}
, steps = [ buildTestCmd "compatible" Size.Small dependsOn ]
, steps =
[ buildTestCmd
"compatible"
Size.Small
dependsOn
(B/SoftFail.Boolean True)
, buildTestCmd "develop" Size.Small dependsOn (B/SoftFail.Boolean True)
, buildTestCmd "master" Size.Small dependsOn (B/SoftFail.Boolean True)
]
}
6 changes: 3 additions & 3 deletions scripts/version-linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def set_error():

def branch_commit(branch):
print ('Retrieving', branch, 'head commit...')
result=subprocess.run(['git','log','-n','1','--format="%h"','--abbrev=7','--no-merges',f'{branch}'],
result=subprocess.run(['git','log','-n','1','--format="%h"','--abbrev=7',f'{branch}'],
capture_output=True)
output=result.stdout.decode('ascii')
print ('command stdout:', output)
Expand All @@ -55,7 +55,7 @@ def download_type_shapes(role,branch,sha1) :
print ("gsutil cp gs://mina-type-shapes ${sha1}-type_shape.txt ")

sys.exit(1)

result=subprocess.run(['wget','--no-clobber',url])

def type_shape_file(sha1) :
Expand Down Expand Up @@ -236,7 +236,7 @@ def check_type_shapes(pr_branch_dict,base_branch,base_type_dict,release_branch,r
# not an error if the type was introduced in the base branch, and the type changed in PR branch

def assert_commit(commit, desc):
if not commit:
if not commit:
f"Empty commit detected when evaluating commit of {desc}"

if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion src/lib/ledger_catchup/ledger_catchup.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ end
let run ~context:(module Context : CONTEXT) ~trust_system ~verifier ~network
~frontier ~catchup_job_reader ~catchup_breadcrumbs_writer
~unprocessed_transition_cache : unit =
match Transition_frontier.catchup_tree frontier with
match Transition_frontier.catchup_state frontier with
| Hash _ ->
Normal_catchup.run
~context:(module Context)
Expand Down
2 changes: 1 addition & 1 deletion src/lib/ledger_catchup/normal_catchup.ml
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ let run ~context:(module Context : CONTEXT) ~trust_system ~verifier ~network
~unprocessed_transition_cache : unit =
let open Context in
let hash_tree =
match Transition_frontier.catchup_tree frontier with
match Transition_frontier.catchup_state frontier with
| Hash t ->
t
| Full _ ->
Expand Down
Loading

0 comments on commit 4d7d7d2

Please sign in to comment.