-
Notifications
You must be signed in to change notification settings - Fork 5
154 lines (128 loc) · 4.76 KB
/
ci.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
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
name: CI (Rust)
on:
push:
branches: [master]
paths:
- '.cargo/**'
- '.github/workflows/ci.yml'
- 'examples/**'
- 'rs/**'
- 'templates/**'
- 'Cargo.lock'
- 'Cargo.toml'
- 'rust-toolchain.toml'
pull_request:
paths:
- '.cargo/**'
- '.github/workflows/ci.yml'
- 'examples/**'
- 'rs/**'
- 'templates/**'
- 'Cargo.lock'
- 'Cargo.toml'
- 'rust-toolchain.toml'
env:
BINARYEN_VERSION: version_111
CARGO_TERM_COLOR: always
jobs:
check:
name: Check Code
runs-on: ubuntu-latest
steps:
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: false
haskell: true
large-packages: false
docker-images: true
swap-storage: true
- name: Checkout Code
uses: actions/checkout@v4
- name: Install wasm-opt
run: |
sudo wget -c https://github.com/WebAssembly/binaryen/releases/download/$BINARYEN_VERSION/binaryen-$BINARYEN_VERSION-x86_64-linux.tar.gz -O - | sudo tar -xz -C .
sudo cp binaryen-$BINARYEN_VERSION/bin/wasm-opt /usr/bin/
- name: Check Code Formatting
run: __GEAR_WASM_BUILDER_NO_FEATURES_TRACKING=1 cargo fmt --all --check
- name: Check Code With Clippy
run: __GEAR_WASM_BUILDER_NO_FEATURES_TRACKING=1 cargo clippy --workspace --all-targets --locked -- -D warnings
- name: Check IDL Parser For WASM With Clippy
run: __GEAR_WASM_BUILDER_NO_FEATURES_TRACKING=1 cargo clippy -p sails-idl-parser --all-targets --locked --target=wasm32-unknown-unknown -- -D warnings
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: false
haskell: true
large-packages: false
docker-images: true
swap-storage: true
- name: Checkout Code
uses: actions/checkout@v4
- name: Install wasm-opt
run: |
sudo wget -c https://github.com/WebAssembly/binaryen/releases/download/$BINARYEN_VERSION/binaryen-$BINARYEN_VERSION-x86_64-linux.tar.gz -O - | sudo tar -xz -C .
sudo cp binaryen-$BINARYEN_VERSION/bin/wasm-opt /usr/bin/
- name: Download Gear Node
run: |
sudo wget -O ./gear https://github.com/gear-tech/gear/releases/download/v1.6.0/gear
sudo chmod +x gear
sudo mv gear /usr/bin/
- name: Run Tests
env:
GEAR_PATH: /usr/bin/gear
run: __GEAR_WASM_BUILDER_NO_FEATURES_TRACKING=1 cargo test --workspace --all-targets --locked --no-fail-fast -- --include-ignored
test-cli:
name: Run CLI Tests
runs-on: ubuntu-latest
steps:
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: false
haskell: true
large-packages: false
docker-images: true
swap-storage: true
- name: Checkout Code
uses: actions/checkout@v4
- name: Install wasm-opt
run: |
sudo wget -c https://github.com/WebAssembly/binaryen/releases/download/$BINARYEN_VERSION/binaryen-$BINARYEN_VERSION-x86_64-linux.tar.gz -O - | sudo tar -xz -C .
sudo cp binaryen-$BINARYEN_VERSION/bin/wasm-opt /usr/bin/
- name: Build CLI
run: |
cargo build -p sails-cli
- name: Generate MyDemo via CLI
run: |
SAILS_CLI_TEMPLATES_BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} ./target/debug/cargo-sails sails program ~/tmp --name my-demo
- name: Run Tests on MyDemo
run: |
cd ~/tmp/my-demo
cargo test -p my-demo
- name: Generate IDL from MyDemo via CLI
run: |
./target/debug/cargo-sails sails idl --manifest-path ~/tmp/my-demo/Cargo.toml
diff ~/tmp/my-demo/target/my-demo-app.idl ~/tmp/my-demo/target/wasm32-unknown-unknown/debug/my_demo.idl