-
Notifications
You must be signed in to change notification settings - Fork 431
66 lines (56 loc) · 2.18 KB
/
measurements.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: continuous-intergration/measurements
on:
workflow_call:
env:
CARGO_TARGET_DIR: /ci-cache/${{ github.repository }}/targets/${{ github.ref_name }}/${{ github.job }}
jobs:
contract-sizes:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
defaults:
run:
shell: bash
container:
image: paritytech/ci-unified:bullseye-1.81.0
strategy:
fail-fast: false
matrix:
branch: [master, pull_request]
steps:
- name: Checkout Pull Request
if: ${{ matrix.branch == 'pull_request' }}
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Checkout Master
if: ${{ matrix.branch == 'master' }}
uses: actions/checkout@v4
with:
ref: master
fetch-depth: 1
- name: Cache
uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5
with:
cache-directories: ${{ env.CARGO_TARGET_DIR }}
- name: Rust Info
uses: ./.github/rust-info
- name: Measure Contract Sizes
env:
PR_NUMBER: ${{ github.event.number }}
run: |
# Variables
MEASUREMENTS_DIR="${GITHUB_WORKSPACE}/measurements"
SCRIPTS_DIR="${GITHUB_WORKSPACE}/scripts"
CONTRACT_SIZES="${MEASUREMENTS_DIR}/${{ matrix.branch }}_contract_sizes"
# 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 {} > ${CONTRACT_SIZES}
sed -ie 's/^integration-tests\/\(public\/\|internal\/\)\?//' ${CONTRACT_SIZES}
CARGO_CONTRACT_VERSION=$(cargo-contract --version | egrep --only-matching "cargo-contract.* .*-x86" | sed -s 's/-x86//')
echo "CARGO_CONTRACT_VERSION=\"${CARGO_CONTRACT_VERSION}\"" > ${MEASUREMENTS_DIR}/context.out
echo "PR_NUMBER=\"${PR_NUMBER}\"" >> ${MEASUREMENTS_DIR}/context.out
- uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}-${{ matrix.branch }}-data
path: ./measurements
retention-days: 1