-
Notifications
You must be signed in to change notification settings - Fork 3
187 lines (183 loc) · 6.37 KB
/
main.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
name: main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:
env:
RUSTFLAGS: -Ctarget-feature=+avx
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- run: lscpu
if: matrix.os == 'ubuntu-latest'
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
target: wasm32-unknown-unknown
components: rustfmt, clippy
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: false
target: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
- run: cargo fmt -- --check
- run: cargo clippy --workspace --all-features -- --deny warnings
- run: cargo clippy --all-features --target wasm32-unknown-unknown -- --deny warnings
- run: cargo build --workspace --release --all-features
- run: cargo test --workspace --release --all-features
- run: cargo +nightly build --workspace --release --all-features
- run: cargo +nightly test --workspace --release --all-features
- run: cargo +nightly bench --workspace --all-features
- name: wasm build and tests
if: matrix.os != 'windows-latest'
env:
RUSTFLAGS: -Ctarget-feature=-simd128
run: |
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
wasm-pack build -t web -s hanabi1224 --out-name annoy
wasm-pack test --node --release
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: java Test
run: |
pushd java
./gradlew clean test
./gradlew clean build publishToMavenLocal
./gradlew copy-artifacts
./gradlew clean test
./gradlew clean build publishToMavenLocal
- uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.x"
- name: dotnet Test
run: |
dotnet test -c Release dotnet/RuAnnoy.Tests
- name: dotnet Build - Linux
if: matrix.os == 'ubuntu-latest'
run: |
dotnet build -c Release dotnet/RuAnnoy-Batteries-Linux-x64
dotnet pack -c Release dotnet/RuAnnoy-Batteries-Linux-x64 -o dotnet/artifacts
- name: dotnet Build - OSX
if: matrix.os == 'macos-latest'
run: |
dotnet build -c Release dotnet/RuAnnoy-Batteries-Darwin-x64
dotnet pack -c Release dotnet/RuAnnoy-Batteries-Darwin-x64 -o dotnet/artifacts
- name: dotnet Build - Windows
if: matrix.os == 'windows-latest'
run: |
dotnet build -c Release dotnet/RuAnnoy-Batteries-Windows-x64
dotnet build -c Release dotnet/RuAnnoy
dotnet pack -c Release dotnet/RuAnnoy -o dotnet/artifacts
dotnet pack -c Release dotnet/RuAnnoy-Batteries-Windows-x64 -o dotnet/artifacts
- name: Benchmarks - Linux
if: matrix.os == 'ubuntu-latest'
run: |
sudo sh -c 'wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
sudo sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
sudo apt-get update -y
sudo apt-get install dart -y
sudo ln -sf /usr/lib/dart/bin/dart /usr/bin/dart
pushd bench
./bench.sh
- uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-latest'
with:
name: npm
path: pkg/**/*
if-no-files-found: error
- uses: actions/upload-artifact@v3
with:
path: dotnet/artifacts/*.nupkg
if-no-files-found: error
- uses: actions/upload-artifact@v3
with:
path: dotnet/artifacts/*.snupkg
- uses: actions/upload-artifact@v3
if: matrix.os == 'windows-latest'
with:
path: target/release/*.dll
if-no-files-found: error
- uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-latest'
with:
path: target/release/*.so
if-no-files-found: error
- uses: actions/upload-artifact@v3
if: matrix.os == 'macos-latest'
with:
path: target/release/*.dylib
if-no-files-found: error
- uses: EmbarkStudios/cargo-deny-action@v1
if: matrix.os == 'ubuntu-latest'
# - name: Cargo deny
# run: |
# cargo install cargo-deny
# cargo deny check
- name: Deploy nugets
if: github.ref == 'refs/heads/master'
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
shell: pwsh
run: |
pushd dotnet/artifacts
dotnet nuget push *.nupkg --skip-duplicate -s https://api.nuget.org/v3/index.json -k $env:NUGET_API_KEY ; exit 0
web:
runs-on: ubuntu-latest
env:
RUSTFLAGS: -Ctarget-feature=-simd128
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: wasm32-unknown-unknown
override: true
- run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- uses: pnpm/action-setup@v2
with:
version: latest
- run: pnpm -r i
- run: pnpm -r run build
- run: pnpm -r run lint
- uses: actions/upload-artifact@v3
with:
name: example-web
path: example/web/dist/**/*
if-no-files-found: error
codedov:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: llvm-tools-preview
- uses: taiki-e/install-action@cargo-llvm-cov
- run: cargo llvm-cov --all-features --lcov --output-path lcov.info
- uses: actions/upload-artifact@v3
with:
name: lcov.info
path: lcov.info
if-no-files-found: error
- name: Upload to codecov
run: |
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov -f lcov.info -Z