Skip to content

Commit

Permalink
Removed dependency on the branch name
Browse files Browse the repository at this point in the history
  • Loading branch information
smiasojed committed Nov 3, 2023
1 parent 21aadd5 commit 427f044
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/measurements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,23 @@ jobs:

- name: Measure Contract Sizes
env:
PR_BRANCH: ${{ github.head_ref }}
PR_NUMBER: ${{ github.event.number }}
run: |
# Variables
MEASUREMENTS_DIR="${GITHUB_WORKSPACE}/../ink-ci-measurements"
SCRIPTS_DIR="${GITHUB_WORKSPACE}/scripts"
ARTIFACTS_DIR="${GITHUB_WORKSPACE}/artifacts"
PR_BRANCH_CONTRACT_SIZES="${MEASUREMENTS_DIR}/${PR_BRANCH}_contract_sizes"
PR_CONTRACT_SIZES="${MEASUREMENTS_DIR}/pull_request_contract_sizes"
UPSTREAM_BRANCH="master"
UPSTREAM_CONTRACT_SIZES="${MEASUREMENTS_DIR}/${UPSTREAM_BRANCH}_contract_sizes"
UPSTREAM_REPO="https://github.com/smiasojed/ink.git"
UPSTREAM_DIR="${MEASUREMENTS_DIR}/ink-${UPSTREAM_BRANCH}"
CONTRACT_SIZES_DIFF="${MEASUREMENTS_DIR}/${PR_BRANCH}_contract_sizes_diff.md"
CONTRACT_SIZES_DIFF="${MEASUREMENTS_DIR}/contract_sizes_diff.md"
# Measure contract sizes for the current branch
mkdir ${MEASUREMENTS_DIR}
${SCRIPTS_DIR}/for_all_contracts_exec.sh --path integration-tests --quiet -- ${SCRIPTS_DIR}/contract_size.sh {} > ${PR_BRANCH_CONTRACT_SIZES}
sed -ie 's/^integration-tests\///g' ${PR_BRANCH_CONTRACT_SIZES}
${SCRIPTS_DIR}/for_all_contracts_exec.sh --path integration-tests --quiet -- ${SCRIPTS_DIR}/contract_size.sh {} > ${PR_CONTRACT_SIZES}
sed -ie 's/^integration-tests\///g' ${PR_CONTRACT_SIZES}
# Measure contract sizes for the upstream branch
git clone --verbose --depth 1 --branch ${UPSTREAM_BRANCH} ${UPSTREAM_REPO} ${UPSTREAM_DIR}
pushd ${UPSTREAM_DIR}
Expand All @@ -59,12 +58,12 @@ jobs:
popd
# Build the comparison table
${SCRIPTS_DIR}/contract_sizes_diff.sh ${UPSTREAM_CONTRACT_SIZES} ${PR_BRANCH_CONTRACT_SIZES} > ${CONTRACT_SIZES_DIFF}
${SCRIPTS_DIR}/contract_sizes_diff.sh ${UPSTREAM_CONTRACT_SIZES} ${PR_CONTRACT_SIZES} > ${CONTRACT_SIZES_DIFF}
cat ${CONTRACT_SIZES_DIFF}
# Create job artifact
mkdir ${ARTIFACTS_DIR}
mv ${CONTRACT_SIZES_DIFF} ${ARTIFACTS_DIR}/contract_sizes_diff.md
mv ${CONTRACT_SIZES_DIFF} ${ARTIFACTS_DIR}/
CARGO_CONTRACT_VERSION=$(cargo-contract --version | egrep --only-matching "cargo-contract.* .*-x86" | sed -s 's/-x86//')
echo "CARGO_CONTRACT_VERSION=\"${CARGO_CONTRACT_VERSION}\"" > ${ARTIFACTS_DIR}/context.out
echo "PR_NUMBER=\"${PR_NUMBER}\"" >> ${ARTIFACTS_DIR}/context.out
Expand Down

0 comments on commit 427f044

Please sign in to comment.