|
13 | 13 |
|
14 | 14 | jobs:
|
15 | 15 | test:
|
16 |
| - runs-on: ubuntu-latest |
| 16 | + runs-on: ${{ matrix.os }} |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + os: [ubuntu-latest, macos-latest, windows-latest] |
17 | 20 |
|
18 | 21 | steps:
|
19 | 22 | - uses: actions/checkout@v3
|
20 | 23 |
|
21 | 24 | - name: Install Rust
|
22 | 25 | uses: dsherret/rust-toolchain-file@v1
|
23 | 26 |
|
| 27 | + - uses: Swatinem/rust-cache@v2 |
| 28 | + |
24 | 29 | - name: Install protoc
|
25 | 30 | uses: arduino/setup-protoc@v2
|
26 | 31 | with:
|
27 | 32 | version: "21.12"
|
| 33 | + token: ${{ secrets.GITHUB_TOKEN }} |
28 | 34 |
|
29 | 35 | - name: Check formatting
|
30 | 36 | run: cargo fmt -- --check
|
31 | 37 |
|
32 | 38 | - name: Check linting
|
33 |
| - run: cargo clippy --all-targets --all-features -- -D clippy::all |
| 39 | + run: cargo clippy --release --all-targets --all-features -- -D clippy::all |
34 | 40 |
|
35 | 41 | - name: Build
|
36 |
| - run: cargo build --all-targets --all-features --tests -v |
| 42 | + run: cargo build --release --all-targets --all-features --tests -v |
37 | 43 |
|
38 | 44 | - name: Test
|
39 |
| - run: cargo test |
| 45 | + run: cargo test --release -- --nocapture |
| 46 | + |
| 47 | + - name: Prepare artifact (Linux) |
| 48 | + if: runner.os == 'Linux' |
| 49 | + run: |- |
| 50 | + cd target/release |
| 51 | + zip -r denokv-x86_64-unknown-linux-gnu.zip denokv |
| 52 | +
|
| 53 | + - name: Prepare artifact (macOS) |
| 54 | + if: runner.os == 'macOS' |
| 55 | + run: |- |
| 56 | + cd target/release |
| 57 | + zip -r denokv-x86_64-apple-darwin.zip denokv |
| 58 | +
|
| 59 | + - name: Prepare artifact (Windows) |
| 60 | + if: runner.os == 'Windows' |
| 61 | + run: |- |
| 62 | + Compress-Archive -CompressionLevel Optimal -Force -Path target/release/denokv.exe -DestinationPath target/release/denokv-x86_64-pc-windows-msvc.zip |
| 63 | +
|
| 64 | + - name: Upload artifact (Linux) |
| 65 | + if: runner.os == 'Linux' |
| 66 | + uses: actions/upload-artifact@v3 |
| 67 | + with: |
| 68 | + name: denokv-x86_64-unknown-linux-gnu.zip |
| 69 | + path: target/release/denokv-x86_64-unknown-linux-gnu.zip |
| 70 | + |
| 71 | + - name: Upload artifact (macOS) |
| 72 | + if: runner.os == 'macOS' |
| 73 | + uses: actions/upload-artifact@v3 |
| 74 | + with: |
| 75 | + name: denokv-x86_64-apple-darwin.zip |
| 76 | + path: target/release/denokv-x86_64-apple-darwin.zip |
| 77 | + |
| 78 | + - name: Upload artifact (Windows) |
| 79 | + if: runner.os == 'Windows' |
| 80 | + uses: actions/upload-artifact@v3 |
| 81 | + with: |
| 82 | + name: denokv-x86_64-pc-windows-msvc.zip |
| 83 | + path: target/release/denokv-x86_64-pc-windows-msvc.zip |
| 84 | + |
| 85 | + - name: Upload release to GitHub |
| 86 | + uses: softprops/action-gh-release@v0.1.15 |
| 87 | + if: github.repository == 'denoland/denokv' && startsWith(github.ref, 'refs/tags/') |
| 88 | + env: |
| 89 | + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
| 90 | + with: |
| 91 | + files: |- |
| 92 | + target/release/denokv-x86_64-pc-windows-msvc.zip |
| 93 | + target/release/denokv-x86_64-unknown-linux-gnu.zip |
| 94 | + target/release/denokv-x86_64-apple-darwin.zip |
| 95 | + draft: true |
40 | 96 |
|
41 |
| - - name: Publish |
42 |
| - if: | |
43 |
| - runner.os == 'Linux' && |
44 |
| - github.repository == 'denoland/denokv' && |
45 |
| - startsWith(github.ref, 'refs/tags/') |
| 97 | + - name: Publish to crates.io |
| 98 | + if: runner.os == 'Linux' && github.repository == 'denoland/denokv' && startsWith(github.ref, 'refs/tags/') |
46 | 99 | env:
|
47 | 100 | CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
48 |
| - run: | |
| 101 | + run: |- |
49 | 102 | cargo publish -vv -p denokv_proto
|
50 | 103 | cargo publish -vv -p denokv_sqlite
|
| 104 | + cargo publish -vv -p denokv_remote |
| 105 | + cargo publish -vv -p denokv |
0 commit comments