1
+ name : CI
2
+
3
+ on : [push, pull_request]
4
+
5
+ jobs :
6
+ build :
7
+ name : ${{ matrix.config.kind }} ${{ matrix.config.os }}
8
+ runs-on : ${{ matrix.config.os }}
9
+ strategy :
10
+ matrix :
11
+ config :
12
+ - os : ubuntu-16.04
13
+ kind : test_release
14
+ - os : ubuntu-16.04
15
+ kind : test_debug
16
+
17
+ env :
18
+ CARGO_INCREMENTAL : 0
19
+ RUST_BACKTRACE : full
20
+
21
+ steps :
22
+ - uses : actions/checkout@v2
23
+ - name : Install wasm32 target
24
+ if : matrix.config.kind == 'test_release'
25
+ run : rustup target add wasm32-unknown-unknown
26
+
27
+ - name : Cache cargo registry
28
+ uses : actions/cache@v1
29
+ with :
30
+ path : ~/.cargo/registry
31
+ key : ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
32
+ - name : Cache cargo index
33
+ uses : actions/cache@v1
34
+ with :
35
+ path : ~/.cargo/git
36
+ key : ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
37
+ - name : Cache cargo build
38
+ uses : actions/cache@v1
39
+ with :
40
+ path : target
41
+ key : ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
42
+
43
+ - name : Build debug
44
+ if : matrix.config.kind == 'test_debug'
45
+ run : cargo build --verbose
46
+ - name : Build release
47
+ if : matrix.config.kind == 'test_release'
48
+ run : cargo build --target wasm32-unknown-unknown --release --locked --verbose
49
+
50
+ - name : Test debug
51
+ if : matrix.config.kind == 'test_debug'
52
+ run : cargo test --verbose
53
+ - name : Test release
54
+ if : matrix.config.kind == 'test_release'
55
+ run : cargo test --release --locked --verbose
56
+
57
+ - name : Get tag version
58
+ if : matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/')
59
+ id : get_tag_version
60
+ run : echo ::set-output name=TAG_VERSION::${GITHUB_REF/refs\/tags\//}
61
+
62
+ - name : Pre-release
63
+ if : matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/')
64
+ run : |
65
+ cd target/wasm32-unknown-unknown/release/
66
+ mv dprint_plugin_typescript.wasm typescript-${{ steps.get_tag_version.outputs.TAG_VERSION }}.wasm
67
+
68
+ - name : Release
69
+ uses : softprops/action-gh-release@v1
70
+ if : matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/')
71
+ env :
72
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
73
+ with :
74
+ files : |
75
+ target/wasm32-unknown-unknown/release/typescript-${{ steps.get_tag_version.outputs.TAG_VERSION }}.wasm
76
+ draft : true
0 commit comments