-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (83 loc) · 3 KB
/
ci.yaml
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
name: ZQ2 CI
on:
push:
branches:
- main
pull_request:
branches:
- main
merge_group:
types:
- checks_requested
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
env:
CARGO_TERM_COLOR: always
# Run a decent number of samples for our randomized tests
ZQ_TEST_SAMPLES: 20
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "16"
- run: npm install --save-dev prettier prettier-plugin-solidity solhint
- run: npx prettier --write --plugin=prettier-plugin-solidity './**/*.sol'
- run: npx solhint 'zilliqa/src/contracts/**/*.sol' --fix --noPrompt
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Apply formatting changes to solidity files
branch: ${{ github.head_ref }}
add_options: "-u"
file_pattern: "*.sol"
status_options: "--untracked-files=no"
check:
runs-on: [self-hosted, gcp]
steps:
- name: Install Rust
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Install nightly
run: rustup toolchain install nightly
- name: Install dependencies
run: sudo add-apt-repository ppa:ethereum/ethereum && sudo apt update && sudo apt install -y solc build-essential pkg-config libssl-dev cmake protobuf-compiler
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --all-targets --all-features
- name: Clippy
run: cargo clippy --all --all-targets --all-features -- -D warnings
# Run `cargo fmt` with nightly, because we use 'unstable' rustfmt features.
- name: rustfmt
run: cargo +nightly fmt --all --check
- name: Test
run: cargo test --tests --examples --bins --all-features
- name: Verify working directory is clean
run: git diff --exit-code
e2e_test:
services:
scilla:
image: asia-docker.pkg.dev/prj-p-devops-services-tvwmrf63/zilliqa-public/scilla:a5a81f72
options: --init --add-host host.docker.internal:host-gateway --entrypoint "/scilla/0/bin/scilla-server-http"
ports:
- 3000:3000
volumes:
- /tmp:/scilla_ext_libs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Test connection to Scilla server
run: curl http://localhost:3000
- name: Install Rust
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- uses: Swatinem/rust-cache@v2
- name: JS test framework
run: export PATH="/scilla/0/bin:$PATH" && ./scripts/js_test.sh