77 - ' .github/workflows/**.yml'
88 - ' **.pi'
99 - ' **/Kagari.*'
10+ - ' codecov.yml'
1011 push :
1112 branches :
1213 - " master"
1314 - " release/*"
1415 - " staging"
1516 - " trying"
1617
18+ env :
19+ RUSTFLAGS : -Dwarnings
20+ CARGO_TERM_COLOR : always
21+
22+ concurrency :
23+ group : ${{ github.workflow }}-${{ github.ref }}
24+ cancel-in-progress : true
25+
1726jobs :
18- container-test-job :
27+ check :
28+ name : Check
1929 runs-on : ubuntu-latest
20- container :
21- image : registry.cn-hangzhou.aliyuncs.com/pivotstudio/rust-pl:latest
22- options : --security-opt seccomp=unconfined
2330 steps :
24- - uses : actions/checkout@v2
31+ - uses : actions/checkout@v3
2532 with :
26- fetch-depth : 0
27- - name : auto test
33+ submodules : true
34+
35+ - name : Install packages
2836 run : |
29- export KAGARI_LIB_ROOT=$(pwd)/planglib
30- cargo test --all
31- bash -c 'for file in target/debug/deps/plc-*; do [ -x "$file" ] || continue; mkdir -p "target/cov/$(basename $file)"; /kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file"; done'
32- bash -c 'for file in target/debug/deps/vm-*; do [ -x "$file" ] || continue; mkdir -p "target/cov/$(basename $file)"; /kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file"; done'
33- ls target/cov/
34- - uses : codecov/codecov-action@v3
35- with :
36- token : ${{ secrets.CODE_COV }} # not required for public repos
37- name : codecov-umbrella # optional
38- fail_ci_if_error : true # optional (default = false)
39- verbose : true # optional (default = false)
37+ sudo apt-get update
38+ sudo apt-get install libasound2-dev libudev-dev
39+
40+ - name : Install Rust (stable)
41+ uses : actions-rs/toolchain@v1
42+ with :
43+ profile : minimal
44+ override : true
45+
46+ - name : Install LLVM
47+ uses : Pivot-Studio/setup-llvm@main
48+
49+ - uses : Swatinem/rust-cache@v2
50+
51+ - name : Cargo check
52+ uses : actions-rs/cargo@v1
53+ with :
54+ command : check
55+ args : --all-targets
56+
57+ test :
58+ name : Test Rust
59+ runs-on : ${{ matrix.os }}
60+ needs : check
61+ strategy :
62+ fail-fast : false
63+ matrix :
64+ os : ["ubuntu-latest", "windows-latest", "macOS-latest"]
65+ include :
66+ - RUSTFLAGS : " -Dwarnings"
67+ CARGO_INCREMENTAL : 1
68+ CARGO_TARGET_DIR : " target"
69+ KAGARI_LIB_ROOT : /planglib
70+ PL_ROOT : /target/release/
71+ - os : " windows-latest"
72+ RUSTFLAGS : " -Dwarnings -Ctarget-feature=+crt-static"
73+ CARGO_INCREMENTAL : 0
74+ CARGO_TARGET_DIR : " C:\\ cargo-target-dir"
75+ KAGARI_LIB_ROOT : \planglib
76+ PL_ROOT : \target\release
77+ env :
78+ RUSTFLAGS : ${{ matrix.RUSTFLAGS }}
79+ CARGO_INCREMENTAL : ${{ matrix.CARGO_INCREMENTAL }}
80+ # Disable generating debug info, we don't need it here anyway and its only using disk space
81+ CARGO_PROFILE_DEV_DEBUG : 0
82+ CARGO_TARGET_DIR : ${{ matrix.CARGO_TARGET_DIR }}
83+ KAGARI_LIB_ROOT : ${{ github.workspace }}${{ matrix.KAGARI_LIB_ROOT }}
84+ PL_ROOT : ${{ github.workspace }}${{ matrix.PL_ROOT }}
85+ steps :
86+ - uses : actions/checkout@v3
87+ with :
88+ submodules : true
89+
90+ - name : Install LLVM
91+ uses : Pivot-Studio/setup-llvm@main
92+
93+ - name : Install packages
94+ if : matrix.os == 'ubuntu-latest'
95+ run : |
96+ sudo apt-get update
97+ sudo apt-get install libasound2-dev libudev-dev
98+
99+ - name : Install toolchain
100+ uses : actions-rs/toolchain@v1
101+ with :
102+ profile : minimal
103+ override : true
104+ components : rustfmt, llvm-tools-preview
105+
106+ - uses : actions/cache@v3
107+ name : Cache Cargo
108+ with :
109+ path : |
110+ ~/.cargo/bin/
111+ ~/.cargo/registry/index/
112+ ~/.cargo/registry/cache/
113+ ~/.cargo/git/db/
114+ target/
115+ key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
116+
117+ - name : Install latest llvm-cov release
118+ uses : taiki-e/install-action@cargo-llvm-cov
119+
120+ - name : Install latest nextest release
121+ uses : taiki-e/install-action@nextest
122+
123+ - name : build vm release
124+ uses : actions-rs/cargo@v1
125+ with :
126+ command : build
127+ args : --manifest-path vm/Cargo.toml --release --target-dir target
128+
129+ - name : Test with latest nextest release
130+ uses : actions-rs/cargo@v1
131+ with :
132+ command : llvm-cov
133+ args : nextest --all-features --workspace --lcov --output-path lcov.info --profile ci
134+
135+ - name : Upload coverage to Codecov
136+ uses : codecov/codecov-action@v3
137+ with :
138+ token : ${{ secrets.CODE_COV }}
139+ files : lcov.info
140+ name : ${{ matrix.os }}
141+ fail_ci_if_error : true
142+ verbose : true
0 commit comments