@@ -10,118 +10,112 @@ on:
10
10
- " **.md"
11
11
12
12
jobs :
13
- # Run the `rustfmt` code formatter
14
13
rustfmt :
15
- name : Rustfmt [ Formatter]
14
+ name : Formatter check
16
15
runs-on : ubuntu-latest
17
16
steps :
18
- - uses : actions/checkout@v1
17
+ - uses : actions/checkout@v3
18
+
19
19
- uses : actions-rs/toolchain@v1
20
20
with :
21
21
profile : minimal
22
22
toolchain : stable
23
23
components : rustfmt
24
24
override : true
25
+
25
26
- run : rustup component add rustfmt
26
27
- uses : actions-rs/cargo@v1
27
28
with :
28
29
command : fmt
29
30
args : --all -- --check
30
31
31
- # Run the `clippy` linting tool
32
- clippy :
33
- name : Clippy [Linter]
34
- runs-on : ubuntu-latest
32
+ # Run compile check on Linux, macOS, and Windows
33
+ # On both Rust stable and Rust nightly
34
+ compile :
35
+ name : Compile
36
+ runs-on : ${{ matrix.os }}
37
+ strategy :
38
+ fail-fast : true
39
+ matrix :
40
+ os : [ubuntu-latest, macOS-latest, windows-latest]
41
+ toolchain : [stable, nightly]
35
42
steps :
36
- - uses : actions/checkout@v1
37
- - uses : actions-rs/toolchain@v1
38
- with :
39
- profile : minimal
40
- toolchain : stable
41
- components : clippy
42
- override : true
43
- - uses : actions-rs/clippy-check@v1
44
- with :
45
- token : ${{ secrets.GITHUB_TOKEN }}
46
- args : --all-targets --all-features -- -D clippy::all
43
+ # Checkout the branch being tested
44
+ - uses : actions/checkout@v3
47
45
48
- # Run a security audit on dependencies
49
- cargo_audit :
50
- name : Cargo Audit [Security]
51
- runs-on : ubuntu-latest
52
- steps :
53
- - uses : actions/checkout@v1
54
- - uses : actions-rs/toolchain@v1
46
+ # Install rust stable
47
+ - uses : dtolnay/rust-toolchain@master
55
48
with :
56
- toolchain : stable
57
- override : true
58
- - run : cargo install --force cargo-audit
59
- - run : cargo generate-lockfile
60
- - uses : actions-rs/cargo@v1
61
- with :
62
- command : audit
49
+ toolchain : ${{ matrix.toolchain }}
63
50
64
- # Ensure that the project could be successfully compiled
65
- cargo_check :
66
- name : Compile
67
- runs-on : ubuntu-latest
68
- steps :
69
- - uses : actions/checkout@v1
70
- - uses : actions-rs/toolchain@v1
51
+ # Cache the built dependencies
52
+ -
uses :
Swatinem/[email protected]
71
53
with :
72
- profile : minimal
73
- toolchain : stable
74
- override : true
75
- - uses : actions-rs/cargo@v1
76
- with :
77
- command : check
78
- args : --all
54
+ save-if : ${{ github.event_name == 'push' }}
55
+
56
+ # Install cargo-hack
57
+ - uses : taiki-e/install-action@cargo-hack
58
+
59
+ # Compile all feature combinations on the target platform
60
+ - name : Compile
61
+ run : cargo hack --feature-powerset check
79
62
80
- # Run tests on Linux, macOS, and Windows
63
+ # Run tests on Linux
81
64
# On both Rust stable and Rust nightly
82
65
test :
83
- name : Test Suite
84
- needs : [cargo_check]
85
- runs-on : ${{ matrix.os }}
66
+ name : Test
67
+ runs-on : ubuntu-latest
86
68
strategy :
87
69
fail-fast : false
88
70
matrix :
89
- os : [ubuntu-latest, macOS-latest, windows-latest]
90
- rust : [stable, nightly]
71
+ toolchain : [stable, nightly]
91
72
steps :
92
73
# Checkout the branch being tested
93
- - uses : actions/checkout@v1
74
+ - uses : actions/checkout@v3
94
75
95
- # Install all the required dependencies for testing
96
- - uses : actions-rs/ toolchain@v1
76
+ # Install rust stable
77
+ - uses : dtolnay/rust- toolchain@master
97
78
with :
98
- profile : minimal
99
- toolchain : stable
100
- override : true
79
+ toolchain : ${{ matrix.toolchain }}
101
80
102
- # Install Node.js at a fixed version
103
- - uses : actions/setup-node@v1
81
+ # Cache the built dependencies
82
+ -
uses :
Swatinem/[email protected]
104
83
with :
105
- node-version : " 12.0 "
84
+ save-if : ${{ github.event_name == 'push' }}
106
85
107
- # Install Ruby at a fixed version
108
- - uses : actions/setup-ruby@v1
109
- with :
110
- ruby-version : " 2.6"
86
+ # Install cargo-hack
87
+ - uses : taiki-e/install-action@cargo-hack
111
88
112
- # Install Python at a fixed version
113
- - uses : actions/setup-python@v1
114
- with :
115
- python-version : " 3.7"
89
+ # Run the ignored tests that expect the above setup
90
+ - name : Run all tests
91
+ run : cargo hack --feature-powerset test
116
92
117
- # Install dotnet at a fixed version
118
- - uses : actions/setup-dotnet@v1
93
+ wasm :
94
+ name : WASM examples
95
+ runs-on : ubuntu-latest
96
+ steps :
97
+ - uses : actions/checkout@v3
98
+
99
+ # Install rust stable
100
+ - uses : dtolnay/rust-toolchain@master
119
101
with :
120
- dotnet-version : " 2.2.402"
102
+ toolchain : stable
103
+ targets : wasm32-unknown-unknown
121
104
122
- # Run the ignored tests that expect the above setup
123
- - name : Run all tests
124
- uses : actions-rs/cargo@v1
105
+ # Cache the built dependencies
106
+ -
uses :
Swatinem/[email protected]
125
107
with :
126
- command : test
127
- args : -- -Z unstable-options --include-ignored
108
+ save-if : ${{ github.event_name == 'push' }}
109
+
110
+ # Build the WASM examples
111
+ - name : Build example
112
+ run : cargo run --package run-wasm -- --release --build-only --example window
113
+
114
+ # Deploy to GitHub pages
115
+ - name : Deploy to GitHub Pages
116
+ uses : s0/git-publish-subdir-action@master
117
+ env :
118
+ REPO : self
119
+ BRANCH : gh-pages
120
+ FOLDER : target/wasm-examples
121
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments