-
Notifications
You must be signed in to change notification settings - Fork 14
194 lines (184 loc) · 5.54 KB
/
builds_and_tests.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: Builds and Tests
on: [pull_request]
jobs:
libwasmvm_sanity:
runs-on: ubuntu-latest
steps:
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.60.0
target: wasm32-unknown-unknown
profile: minimal
override: true
- name: Checkout
uses: actions/checkout@v2
- name: Cache cargo
uses: actions/cache@v3
with:
path: ~/.cargo
key: cargocache-v2-libwasmvm_sanity-rust:1.60.0-${{ hashFiles('Cargo.lock') }}
- name: Install shellcheck
run: sudo apt install shellcheck
- name: Show version information
run: rustc --version; cargo --version; rustup --version
- name: Add Rust components
run: rustup component add clippy rustfmt
- name: Check formatting
working-directory: ./libwasmvm
run: cargo fmt -- --check
- name: Run linter
working-directory: ./libwasmvm
run: cargo clippy -- -D warnings
- name: Run unit tests
working-directory: ./libwasmvm
run: cargo test
- name: Build docs
working-directory: ./libwasmvm
run: cargo doc --no-deps
- name: Test docs
working-directory: ./libwasmvm
run: |
sed -i '/^crate-type = \["cdylib"\]/d' Cargo.toml
cargo test --doc
- name: Run shellcheck
run: ./devtools/check_shellscript_lint.sh
format-go:
runs-on: ubuntu-latest
steps:
- name: set up
uses: actions/setup-go@v2
with:
go-version: '1.20'
id: go
- name: Checkout
uses: actions/checkout@v2
- name: Check Go formatting
run: |
[ "$(gofmt -l .)" = "" ] || (gofmt -d . && exit 1)
tidy-go:
runs-on: ubuntu-latest
steps:
- name: set up
uses: actions/setup-go@v2
with:
go-version: '1.20'
id: go
- name: CHeckout
uses: actions/checkout@v2
- name: Check go mod tidy
# Use --check or --exit-code when available (Go 1.19?)
# https://github.com/golang/go/issues/27005
run: |
go mod tidy
CHANGES_IN_REPO=$(git status --porcelain)
if [[ -n "$CHANGES_IN_REPO" ]]; then
echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:"
git status && git --no-pager diff
exit 1
fi
format-scripts:
runs-on: ubuntu-latest
steps:
- name: set up
uses: actions/setup-go@v2
with:
go-version: '1.20'
id: go
- name: Install shfmt
run: GO111MODULE=on go install mvdan.cc/sh/v3/cmd/[email protected]
- name: Run shfmt
run: shfmt -d .
lint-scripts:
runs-on: ubuntu-20.04
steps:
- name: Install packages
run: |
sudo apt update
sudo apt install -y git shellcheck
- name: Checkout
uses: actions/checkout@v2
- name: Run shellcheck
run: ./devtools/check_shellscript_lint.sh
test_internal_shared_lib_on_auto_build_pr:
if: ${{ github.event.pusher.name == 'finschia-auto-pr[bot]' }}
runs-on: ubuntu-latest
env:
GORACE: "halt_on_error=1"
BUILD_VERSION: $(echo $GITHUB_SHA | cut -c 1-10)
steps:
- name: set up
uses: actions/setup-go@v2
with:
go-version: '1.20'
id: go
- name: Checkout
uses: actions/checkout@v2
- name: Go integration tests
run: make test
- name: Go tests with cgo and race condition safety checks
run: make test-safety
- name: Make build-go
run: make build-go
build_shared_library:
runs-on: ubuntu-latest
steps:
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.60.0
target: x86_64-unknown-linux-gnu
profile: minimal
override: true
- name: Checkout
uses: actions/checkout@v2
- name: Cache cargo
uses: actions/cache@v3
with:
path: ~/.cargo
key: cargocache-v2-build_shared_library-rust:1.60.0-${{ hashFiles('Cargo.lock') }}
- name: Show version information
run: rustc --version; cargo --version; rustup --version
- name: Create release build of libwasmvm
run: make build-rust
- name: Upload libwasmvm
uses: actions/upload-artifact@v2
with:
name: libwasmvm
path: ./internal/api/libwasmvm.x86_64.so
test_shared_lib:
needs: build_shared_library
runs-on: ubuntu-latest
env:
GORACE: "halt_on_error=1"
BUILD_VERSION: $(echo $GITHUB_SHA | cut -c 1-10)
steps:
- name: set up
uses: actions/setup-go@v2
with:
go-version: '1.20'
id: go
- name: Checkout
uses: actions/checkout@v2
- name: Download libwasmvm
uses: actions/download-artifact@v2
with:
name: libwasmvm
path: /tmp/builds
- name: Copy libwasmvm
run: cp /tmp/builds/libwasmvm.x86_64.so ./internal/api
- name: Go integration tests
run: make test
- name: Go tests with cgo and race condition safety checks
run: make test-safety
- name: Make build-go
run: make build-go
test_static_lib:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Prepare docker image
run: cd builders && make docker-image-alpine
- name: Build static library and test
run: make test-alpine