This repository has been archived by the owner on Nov 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
56 lines (52 loc) · 1.86 KB
/
rust.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
name: Rust
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install Rust components
run: rustup component add rustfmt && rustup component add clippy
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
- name: Install moleculec
run: CARGO_TARGET_DIR=target/ cargo install moleculec --version 0.7.2
- name: Install capsule
env:
CAPSULE_VERSION: v0.7.0
run: curl -OL https://github.com/nervosnetwork/capsule/releases/download/${CAPSULE_VERSION}/capsule_${CAPSULE_VERSION}_x86_64-linux.tar.gz && tar xf capsule_${CAPSULE_VERSION}_x86_64-linux.tar.gz && echo `pwd`/capsule_${CAPSULE_VERSION}_x86_64-linux >> $GITHUB_PATH
- name: Check Tests format
run: cargo fmt -- --check
- name: Check Rust format
run: cd contracts && cargo fmt -- --check
- name: Check C format
run: cd c && make fmt
- name: Init submodules
run: git submodule init && git submodule update -r
- name: Compile C contracts
run: cd c && make
#- name: Cargo clippy check
# env:
# RUSTFLAGS: -D warnings
# run: cd contracts && cargo clippy
- uses: actions/cache@v2
id: fetch-capsule-cache
with:
path: |
.tmp/capsule-cache.tar
key: ${{ runner.os }}-capsule-cache-${{ hashFiles('contracts/Cargo.lock') }}
- name: Restore capsule cache
if: steps.fetch-capsule-cache.outputs.cache-hit == 'true'
run: tools/restore-capsule-cache.sh
- name: Build Rust contracts
run: capsule build
- name: Backup capsule cache
if: steps.fetch-capsule-cache.outputs.cache-hit != 'true'
run: tools/backup-capsule-cache.sh
- name: Tests
run: cargo test