-
-
Notifications
You must be signed in to change notification settings - Fork 796
111 lines (96 loc) · 3.84 KB
/
era-tester.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
102
103
104
105
106
107
108
109
110
111
name: Era compiler tester
# run the matter labs compiler test to integrate their test cases
# this is intended as a diagnostic / spot check to check that we
# haven't seriously broken the compiler. but, it is not intended as
# a requirement for merging since we may make changes to our IR
# which break the downstream backend (at which point, downstream needs
# to update, which we do not want to be blocked on).
on: [push, pull_request]
concurrency:
# cancel older, in-progress jobs from the same PR, same workflow.
# use run_id if the job is triggered by a push to ensure
# push-triggered jobs to not get canceled.
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
era-compiler-tester:
runs-on: ubuntu-latest
steps:
- name: Get latest commit hash
run: |
echo "ERA_HASH=$( curl -u "u:${{ github.token }}" https://api.github.com/repos/matter-labs/era-compiler-tester/git/ref/heads/main | jq .object.sha | tr -d '"' )" >> $GITHUB_ENV
echo "ERA_VYPER_HASH=$( curl -u "u:${{ github.token }}" https://api.github.com/repos/matter-labs/era-compiler-vyper/git/ref/heads/main | jq .object.sha | tr -d '"' )" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v1
- name: Rust setup
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-11-03
- name: Set up Python ${{ matrix.python-version[0] }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version[0] }}
cache: "pip"
- name: Get cache
id: get-cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
**/target
**/target-llvm
**/compiler_tester
**/llvm
**/era-compiler-tester
key: ${{ runner.os }}-${{ env.ERA_HASH }}-${{ env.ERA_VYPER_HASH }}
- name: Initialize repository and install dependencies
if: steps.get-cache.outputs.cache-hit != 'true'
run: |
git clone --depth 1 https://github.com/matter-labs/era-compiler-tester.git
cd era-compiler-tester
sed -i 's/ssh:\/\/git@/https:\/\//g' .gitmodules
git submodule init
git submodule update
sudo apt install cmake ninja-build clang-13 lld-13 parallel pkg-config lld
cargo install compiler-llvm-builder
zkevm-llvm clone && zkevm-llvm build
cargo build --release
- name: Save cache
uses: actions/cache/save@v3
if: steps.get-cache.outputs.cache-hit != 'true'
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
**/target
**/target-llvm
**/compiler_tester
**/llvm
**/era-compiler-tester
key: ${{ runner.os }}-${{ env.ERA_HASH }}-${{ env.ERA_VYPER_HASH }}
- name: Build Vyper
run: |
set -Eeuxo pipefail
pip install .
echo "VYPER_VERSION=$(vyper --version | cut -f1 -d'+')" >> $GITHUB_ENV
- name: Install Vyper
run: |
mkdir era-compiler-tester/vyper-bin
cp $(which vyper) era-compiler-tester/vyper-bin/vyper-${{ env.VYPER_VERSION }}
- name: Run tester (fast)
# Run era tester with no LLVM optimizations
if: ${{ github.ref != 'refs/heads/master' }}
run: |
cd era-compiler-tester
cargo run --release --bin compiler-tester -- --path=tests/vyper/ --mode="M0B0 ${{ env.VYPER_VERSION }}"
- name: Run tester (slow)
# Run era tester across the LLVM optimization matrix
if: ${{ github.ref == 'refs/heads/master' }}
run: |
cd era-compiler-tester
cargo run --release --bin compiler-tester -- --path=tests/vyper/ --mode="M*B* ${{ env.VYPER_VERSION }}"