-
Notifications
You must be signed in to change notification settings - Fork 54
173 lines (146 loc) · 4.72 KB
/
Copy pathci.yml
File metadata and controls
173 lines (146 loc) · 4.72 KB
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
on: [push, pull_request]
name: ipfs-embed
jobs:
ci:
strategy:
fail-fast: false
matrix:
toolchain:
- rust: stable
#- rust: nightly
platform:
- target: x86_64-unknown-linux-gnu
host: ubuntu-latest
cross: false
- target: x86_64-apple-darwin
host: macos-latest
cross: false
- target: x86_64-pc-windows-msvc
host: windows-latest
cross: false
- target: armv7-linux-androideabi
host: ubuntu-latest
cross: true
- target: aarch64-linux-android
host: ubuntu-latest
cross: true
- target: aarch64-apple-ios
host: macos-latest
cross: true
# - target: wasm32-unknown-unknown
# host: ubuntu-latest
# cross: true
env:
RUST_BACKTRACE: 1
RUST_LOG: netsim_embed_machine=debug,info
CARGO_INCREMENTAL: 0
LLVM_CONFIG_PATH: /usr/local/opt/llvm/bin/llvm-config
NDK_HOME: /usr/local/lib/android/sdk/ndk-bundle
runs-on: ${{ matrix.platform.host }}
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Cache cargo folder
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ matrix.platform.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies ubuntu
if: matrix.platform.host == 'ubuntu-latest'
run: sudo apt-get install llvm-dev
- name: Install dependencies macos
if: matrix.platform.host == 'macos-latest'
run: brew install llvm
- name: Install dependencies windows
if: matrix.platform.host == 'windows-latest'
run: choco install llvm
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.toolchain.rust }}
target: ${{ matrix.platform.target }}
- name: Install cargo-apk
if: contains(matrix.platform.target, 'android')
uses: baptiste0928/cargo-install@bf6758885262d0e6f61089a9d8c8790d3ac3368f # v1.3.0
with:
crate: cargo-apk
- name: Build
if: contains(matrix.platform.target, 'android') == false
uses: actions-rs/cargo@v1
with:
command: build
args: --target ${{ matrix.platform.target }}
- name: Build Tokio
if: contains(matrix.platform.target, 'android') == false
uses: actions-rs/cargo@v1
with:
command: build
args: --target ${{ matrix.platform.target }} --no-default-features --features tokio
- name: Build android
if: contains(matrix.platform.target, 'android')
uses: actions-rs/cargo@v1
with:
command: apk
args: -- build --target ${{ matrix.platform.target }} -p ipfs-embed
- name: Rust tests
if: matrix.platform.cross == false
uses: actions-rs/cargo@v1
with:
command: test
- name: Build netsim integration tests
if: contains(matrix.platform.target, 'linux-gnu')
uses: actions-rs/cargo@v1
with:
command: build
args: -p ipfs-embed-cli -p harness --release
- name: Run netsim integration tests
if: contains(matrix.platform.target, 'linux-gnu')
uses: actions-rs/cargo@v1
with:
command: test
args: --release -p harness
lint-rust:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Cache cargo folder
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: clippy, rustfmt
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --workspace --examples --tests -- -D warnings