-
Notifications
You must be signed in to change notification settings - Fork 16
48 lines (39 loc) · 1.25 KB
/
test-code.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
name: Check and Test Code
on:
pull_request:
push:
branches: [ "main", "feature/*" ]
jobs:
test-code:
# runs-on: ubuntu-20.04
runs-on: public-runners
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Install required packages
run: |
sudo apt-get update &&
sudo apt-get install build-essential git clang curl libssl-dev protobuf-compiler wget unzip -y
- name: Get rustc version from file
run: |
echo "rustc_version=$(cat RUSTC_VERSION)" >> $GITHUB_ENV
# Steps taken from https://github.com/actions/cache/blob/master/examples.md#rust---cargo
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Install toolchain
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: ${{ env.rustc_version }}
components: rustfmt
target: wasm32-unknown-unknown
- name: Check Code
run: cargo check --release
- name: Test Code
run: cargo test