-
-
Notifications
You must be signed in to change notification settings - Fork 109
176 lines (159 loc) · 5.93 KB
/
ci.yml
File metadata and controls
176 lines (159 loc) · 5.93 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
174
175
176
name: CI
on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
paths: &watch
- '.cargo/**'
- 'cli/**'
- 'crates/**'
- 'deno/**'
- 'ext/**'
- 'vendor/**'
- '.env'
- 'Cargo.lock'
- 'Cargo.toml'
- 'rust-toolchain.toml'
push:
branches:
- main
- develop
paths: *watch
workflow_dispatch:
permissions:
contents: read
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
CARGO_TERM_COLOR: always
RUSTUP_MAX_RETRIES: 10
ORT_DYLIB_PATH: /tmp/onnxruntime/lib/libonnxruntime.so
RUST_LOG: ext_event_worker=trace
ESZIP_TESTDATA_REPO: supabase/edge-runtime-test-eszip
EXT_AI_CACHE_DIR: /home/runner/.cache/ext-ai-cache
jobs:
cargo-fmt:
if: github.event.pull_request.draft == false
name: 'fmt'
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282 # v2.0.4
with:
deno-version: v2.x
- run: rustup show
- run: deno run --allow-write --allow-read --allow-run --allow-net ./scripts/format.js --check
cargo-clippy:
if: github.event.pull_request.draft == false
name: 'cargo clippy'
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install deps
run: |
sudo apt-get update
sudo apt-get -y install libblas-dev liblapack-dev libopenblas-dev
- run: rustup show
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- run: ./scripts/clippy.sh
cargo-test:
if: github.event.pull_request.draft == false
name: 'cargo test'
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- name: Install deps
run: |
sudo apt-get update
sudo apt-get -y install libblas-dev liblapack-dev libopenblas-dev
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@328a871ad8f62ecac78390391f463ccabc974b72 # v2.69.9
with:
tool: cargo-llvm-cov
- name: Remove unwanted software
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo docker image prune --all --force
sudo apt-get remove --purge -y man-db
sudo apt-get remove 'clang-13*' 'clang-14*' 'clang-15*' 'llvm-13*' 'llvm-14*' 'llvm-15*' 'lld-13*' 'lld-14*' 'lld-15*'
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- run: rustup show
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- uses: cardinalby/export-env-action@b16a08b396d047e3f9e1446e3946440e2be02a73 # 2.2.2
with:
envFile: '.env'
- name: Install ONNX Runtime Library
run: ./scripts/install_onnx.sh "${{ env.ONNXRUNTIME_VERSION }}" linux x64 /tmp/onnxruntime
- name: Prepare test eszip binaries
if: |
github.actor != 'dependabot[bot]' &&
(
github.event_name != 'pull_request'
|| github.event.pull_request.head.repo.full_name == github.repository
)
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: ${{ env.ESZIP_TESTDATA_REPO }}
path: ./edge-runtime-test-eszip
token: ${{ secrets.EDGE_RUNTIME_ORG_TOKEN }}
- name: Decompress test eszip binaries
if: |
github.actor != 'dependabot[bot]' &&
(
github.event_name != 'pull_request'
|| github.event.pull_request.head.repo.full_name == github.repository
)
run: |
mkdir -p crates/base/tests/fixture/testdata
./scripts/esbr.cjs decompress ./edge-runtime-test-eszip/testdata
mv ./edge-runtime-test-eszip/testdata/*.out crates/base/tests/fixture/testdata
- name: Install Supabase Storage S3 credentials for testing
if: |
github.actor != 'dependabot[bot]' &&
(
github.event_name != 'pull_request'
|| github.event.pull_request.head.repo.full_name == github.repository
)
run: |
cd crates/fs/tests
echo "S3FS_TEST_SUPABASE_STORAGE=true" >> .env
echo "S3FS_TEST_APP_NAME=edge_runtime_github_ci" >> .env
echo "S3FS_TEST_BUCKET_NAME=$BUCKET_NAME" >> .env
echo "S3FS_TEST_ENDPOINT_URL=$ENDPOINT_URL" >> .env
echo "S3FS_TEST_REGION=$REGION" >> .env
echo "S3FS_TEST_ACCESS_KEY_ID=$ACCESS_KEY_ID" >> .env
echo "S3FS_TEST_SECRET_ACCESS_KEY=$SECRET_ACCESS_KEY" >> .env
shell: bash
env:
BUCKET_NAME: ${{ secrets.SUPABASE_S3_BUCKET_NAME }}
ENDPOINT_URL: ${{ secrets.SUPABASE_S3_ENTRYPOINT }}
REGION: ${{ secrets.SUPABASE_S3_REGION }}
ACCESS_KEY_ID: ${{ secrets.SUPABASE_S3_ACCESS_KEY }}
SECRET_ACCESS_KEY: ${{ secrets.SUPABASE_S3_SECRET }}
- name: Set AI model cache directory
run: |
echo "EXT_AI_CACHE_DIR=$HOME/.cache/ext-ai-cache" >> .env
shell: bash
- name: Cache AI models
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ${{ env.EXT_AI_CACHE_DIR }}
key: ext-ai-cache-${{ runner.os }}-v1
restore-keys: |
ext-ai-cache-${{ runner.os }}-
- name: Generate code coverage
id: coverage
run: |
cargo llvm-cov test --workspace --no-fail-fast --lcov -j 1 --output-path lcov.info
- name: Coveralls upload
uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e # v2.3.7
with:
fail-on-error: false
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: lcov.info
debug: true