-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
82 lines (78 loc) · 2.18 KB
/
.gitlab-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
image: node:latest
stages:
- build
- deploy
.changes: &changes
- inference/src/**/*
- inference/Cargo.*
- public/**/*
- src/**/*
- '*.config.*'
- index.html
- package.json
- tsconfig*.json
- pnpm-lock.yaml
- .gitlab-ci.yml
- .prettier*
build:
variables:
CARGO_HOME: $CI_PROJECT_DIR/.cargo
RUSTUP_HOME: $CI_PROJECT_DIR/.rustup
stage: build
cache:
- key:
prefix: $CI_MERGE_REQUEST_IID
files:
- inference/Cargo.lock
- pnpm-lock.yaml
paths:
- $CARGO_HOME
- $RUSTUP_HOME
- .pnpm/v3/
- inference/target/
script:
# Rust configuration + build
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- . "$CARGO_HOME/env"
- rustup update
- curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- cd inference
- cargo check
- cargo clippy
- wasm-pack build --release --target bundler
- cd ..
# TypeScript configuration + build
- corepack enable
- corepack install
- pnpm config set store-dir .pnpm
- pnpm install
- pnpm run lint
- pnpm run check
- pnpm run build
- pnpm run test -- --run
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
changes: *changes
- if: $CI_MERGE_REQUEST_ID
changes: *changes
artifacts:
paths: ['dist']
pages:
image: alpine:latest
stage: deploy
dependencies:
- build
before_script:
- apk update
- apk add --no-cache brotli gzip
script:
- echo Compressing files...
- find dist -type f \( -name '*.js' -o -name '*.html' -o -name '*.css' -o -name '*.wasm' \) -exec gzip -fk {} \;
- find dist -type f \( -name '*.js' -o -name '*.html' -o -name '*.css' -o -name '*.wasm' \) -exec brotli -fk {} \;
- echo Done. Deploying to Pages
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
changes: *changes
artifacts:
paths: ['dist']
publish: dist