-
Notifications
You must be signed in to change notification settings - Fork 0
165 lines (155 loc) · 4.62 KB
/
rust.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
name: Rust
on:
push:
branches: ["master"]
tags: ["v*.*.*"]
pull_request:
branches: ["master"]
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: "true"
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install Protoc
uses: arduino/setup-protoc@v3
- name: Run tests
run: cargo test --workspace
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: Enforce formatting
run: cargo +nightly fmt --all --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: "true"
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- name: Install Protoc
uses: arduino/setup-protoc@v3
- name: Linting
run: cargo clippy --workspace -- -D warnings
compat-test:
name: Compatibility test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: "true"
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install Protoc
uses: arduino/setup-protoc@v3
- run: cargo build
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: test-suite/package-lock.json
- name: Run compatibility test suite
run: npm ci && npm run test:rust-emulator -- --maxConcurrency=3
working-directory: test-suite
deploy:
name: Deploy
needs:
- test
- fmt
- clippy
- compat-test
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: "true"
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install Protoc
uses: arduino/setup-protoc@v3
- name: Build
run: cargo build --release --no-default-features
- name: Package
shell: bash
run: |
cd target/release
tar czvf ../../firestore-emulator.tar.gz firestore-emulator
cd -
- name: Publish
# More info at: https://github.com/softprops/action-gh-release
uses: softprops/action-gh-release@v2
with:
# Will be accessible at:
# - https://github.com/skunkteam/rust-firestore-emulator/releases/latest/download/firestore-emulator.tar.gz
# - https://github.com/skunkteam/rust-firestore-emulator/releases/download/<tag>/firestore-emulator.tar.gz
files: firestore-emulator.tar.gz
deploy-arm64:
name: Deploy ARM64
needs:
- test
- fmt
- clippy
- compat-test
runs-on: ubuntu-24.04-arm-4core
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: "true"
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install Protoc
uses: arduino/setup-protoc@v3
- name: Build
run: cargo build --release --no-default-features
- name: Package
shell: bash
run: |
cd target/release
tar czvf ../../firestore-emulator-arm64.tar.gz firestore-emulator
cd -
- name: Publish
# More info at: https://github.com/softprops/action-gh-release
uses: softprops/action-gh-release@v2
with:
# Will be accessible at:
# - https://github.com/skunkteam/rust-firestore-emulator/releases/latest/download/firestore-emulator-arm64.tar.gz
# - https://github.com/skunkteam/rust-firestore-emulator/releases/download/<tag>/firestore-emulator-arm64.tar.gz
files: firestore-emulator-arm64.tar.gz
# coverage:
# name: Code coverage
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# with:
# submodules: "true"
# - uses: dtolnay/rust-toolchain@stable
# - uses: Swatinem/rust-cache@v2
# - name: Install Protoc
# uses: arduino/setup-protoc@v3
# - name: Install tarpaulin
# run: cargo install cargo-tarpaulin
# - name: Generate code coverage
# run: cargo tarpaulin --workspace --color always