-
Notifications
You must be signed in to change notification settings - Fork 24
107 lines (88 loc) · 3.2 KB
/
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
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
name: ci
on:
push:
branches: ["main"]
tags: ["[0-9]+.[0-9]+.[0-9]+"]
pull_request:
branches: ["main"]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: dsherret/rust-toolchain-file@v1
- uses: Swatinem/rust-cache@v2
- name: Install protoc
uses: arduino/setup-protoc@v2
with:
version: "21.12"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Check formatting
run: cargo fmt -- --check
- name: Check linting
run: cargo clippy --release --all-targets --all-features -- -D clippy::all
- name: Build
run: cargo build --release --all-targets --all-features --tests -v
- name: Test
run: cargo test --release -- --nocapture
- name: Prepare artifact (Linux)
if: runner.os == 'Linux'
run: |-
cd target/release
zip -r denokv-x86_64-unknown-linux-gnu.zip denokv
- name: Prepare artifact (macOS)
if: runner.os == 'macOS'
run: |-
cd target/release
zip -r denokv-x86_64-apple-darwin.zip denokv
- name: Prepare artifact (Windows)
if: runner.os == 'Windows'
run: |-
Compress-Archive -CompressionLevel Optimal -Force -Path target/release/denokv.exe -DestinationPath target/release/denokv-x86_64-pc-windows-msvc.zip
- name: Upload artifact (Linux)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v3
with:
name: denokv-x86_64-unknown-linux-gnu.zip
path: target/release/denokv-x86_64-unknown-linux-gnu.zip
- name: Upload artifact (macOS)
if: runner.os == 'macOS'
uses: actions/upload-artifact@v3
with:
name: denokv-x86_64-apple-darwin.zip
path: target/release/denokv-x86_64-apple-darwin.zip
- name: Upload artifact (Windows)
if: runner.os == 'Windows'
uses: actions/upload-artifact@v3
with:
name: denokv-x86_64-pc-windows-msvc.zip
path: target/release/denokv-x86_64-pc-windows-msvc.zip
- name: Upload release to GitHub
uses: softprops/action-gh-release@v0.1.15
if: github.repository == 'denoland/denokv' && startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
files: |-
target/release/denokv-x86_64-pc-windows-msvc.zip
target/release/denokv-x86_64-unknown-linux-gnu.zip
target/release/denokv-x86_64-apple-darwin.zip
draft: true
- name: Publish to crates.io
if: runner.os == 'Linux' && github.repository == 'denoland/denokv' && startsWith(github.ref, 'refs/tags/')
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |-
cargo publish -vv -p denokv_proto
cargo publish -vv -p denokv_sqlite
cargo publish -vv -p denokv_remote
cargo publish -vv -p denokv_timemachine
cargo publish -vv -p denokv