-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (85 loc) · 3.43 KB
/
integration_tests.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: Integration Tests
on:
pull_request:
push:
branches:
- main
jobs:
test:
name: Integration tests
runs-on: ubuntu-latest
env:
GAS_OUT_DIR: gas_reports
GAS_LIMIT: 100000000
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install latest nightly toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2023-02-02
target: wasm32-unknown-unknown
override: true
- name: Rust Dependencies Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
artifacts/
key: ${{ runner.os }}-cargo-with-artifacts-${{ hashFiles('**/Cargo.lock') }}
- name: Set latest just version
run: echo "JUST_VERSION=$(cargo search just -q | sed -n -e '/^just[[:space:]]/p' | cut -d '"' -f 2)" >> $GITHUB_ENV
- name: Get cached just
uses: actions/cache@v3
with:
path: ~/.cargo/bin/just
key: ${{ runner.os }}-just-${{ env.JUST_VERSION }}
- name: Install just
run: cargo install just || true
- name: Get mainnet GAS_LIMIT
run: echo "MAINNET_GAS_LIMIT=$(curl -s https://juno-rpc.polkachu.com/consensus_params | jq -r '.result.consensus_params.block.max_gas')" >> $GITHUB_ENV
- name: Mainnet block GAS_LIMIT changed
if: ${{ env.MAINNET_GAS_LIMIT != env.GAS_LIMIT }}
uses: actions/github-script@v6
with:
script: core.setFailed(`Integration tests must update GAS_LIMIT from ${process.env.GAS_LIMIT} to ${process.env.MAINNET_GAS_LIMIT}`)
- name: Run Integration Tests
run: just integration-test
- name: Combine Test Gas Reports
run: cd ci/integration-tests/ && jq -rs 'reduce .[] as $item ({}; . * $item)' gas_reports/*.json > gas_report.json
- name: Raw Gas Report
run: cat ci/integration-tests/gas_report.json
- name: Set GIT_BRANCH
run: echo "GIT_BRANCH=$(echo ${{ github.ref }} | sed 's|/|-|g')" >> $GITHUB_ENV
- name: Upload Gas Report
if: ${{ github.ref == 'refs/heads/main' }}
uses: actions/upload-artifact@v3
with:
name: dao-dao-gas-report-${{ env.GIT_BRANCH }}
path: ci/integration-tests/gas_report.json
retention-days: 90
- name: Download main gas report
id: download_gas
# Because the max retention period of github artifacts is 90 days
# there's a possibility the main's report no longer exists
continue-on-error: true
if: ${{ github.ref != 'refs/heads/main' }}
# NOTE: We can't use github's `actions/download-artifact` because it doesnt support
# downloading an artifact cross workflows yet
# https://github.com/actions/download-artifact/issues/3
uses: dawidd6/action-download-artifact@v2
with:
branch: main
workflow: integration_tests.yml
name: dao-dao-gas-report-refs-heads-main
- name: Post gas diff to PR
if: ${{ github.ref != 'refs/heads/main' && steps.download_gas.outputs.found_artifact == 'true' }}
uses: de-husk/[email protected]
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
current_json: ci/integration-tests/gas_report.json
old_json: gas_report.json