forked from denoland/serde_v8
-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (67 loc) · 2.12 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
name: ci
on: [push, pull_request]
jobs:
rust:
name: serde_v8-${{ matrix.os }}
if: |
github.event_name == 'push' ||
!startsWith(github.event.pull_request.head.label, 'denoland:')
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
matrix:
os: [macOS-latest, ubuntu-latest-xl, windows-2019]
steps:
- name: Clone repository
uses: actions/checkout@v2
with:
submodules: true
persist-credentials: false
- name: Install rust
uses: hecrj/[email protected]
with:
rust-version: 1.54.0
- name: Install clippy and rustfmt
run: |
rustup component add clippy
rustup component add rustfmt
# Work around https://github.com/actions/cache/issues/403 by using GNU tar
# instead of BSD tar.
- name: Install GNU tar
if: runner.os == 'macOS'
run: |
brew install gnu-tar
echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH
- name: Cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target/
key: cache4-${{ runner.os }}-${{ github.sha }}
restore-keys: cache4-${{ runner.os }}-
- name: Environment
run: |
echo "GH_ACTIONS=1" >> ${GITHUB_ENV}
echo "RUST_BACKTRACE=full" >> ${GITHUB_ENV}
- name: Format
if: contains(matrix.os, 'ubuntu')
run: |
rustfmt --check src/lib.rs
rustfmt --check examples/basic.rs
- name: Build
run: cargo build --locked --release --all-targets
- name: Test
run: cargo test --locked --release --all-targets
- name: Lint
run: cargo clippy --all-targets --release --locked -- -D clippy::all
- name: Publish
if: |
contains(matrix.os, 'ubuntu') &&
github.repository == 'denoland/serde_v8' &&
startsWith(github.ref, 'refs/tags/')
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
cargo publish -vv