-
Notifications
You must be signed in to change notification settings - Fork 11
68 lines (60 loc) · 1.9 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
name: CI
on:
pull_request:
branches: [main]
push:
tags: '*'
branches: [main]
jobs:
build:
name: ${{ matrix.config.kind }} ${{ matrix.config.os }}
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
- os: ubuntu-latest
kind: test_release
- os: ubuntu-latest
kind: test_debug
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full
steps:
- uses: actions/checkout@v3
- uses: dsherret/rust-toolchain-file@v1
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- uses: denoland/setup-deno@v1
- name: Ensure code generation same
if: matrix.config.kind == 'test_debug'
run: |
# lock this so it works on Rust 1.65
cargo install cargo-clone --version 1.1.0 --locked
chmod +x ./scripts/generate.ts
./scripts/generate.ts
echo Checking for git changes...
git diff --no-ext-diff --exit-code
- name: Build debug
if: matrix.config.kind == 'test_debug'
run: cargo build
- name: Clippy
if: matrix.config.kind == 'test_debug'
run: cargo clippy --all-features
- name: Test debug
if: matrix.config.kind == 'test_debug'
run: cargo test --all-features
- name: Build release
if: matrix.config.kind == 'test_release'
run: cargo build --release --all-features
- name: Test release
if: matrix.config.kind == 'test_release'
run: cargo test --release --all-features
- name: Publish
if: |
matrix.config.kind == 'test_release' &&
github.repository == 'dprint/dprint-swc-ext' &&
startsWith(github.ref, 'refs/tags/')
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_TOKEN }}
run: cd rs-lib && cargo +stable publish -p dprint-swc-ext