-
-
Notifications
You must be signed in to change notification settings - Fork 28
68 lines (59 loc) · 2.04 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: tests
on:
push:
branches: ["master"]
pull_request:
# The branches below must be a subset of the branches above
branches: ["master"]
workflow_dispatch:
branches: ["*"]
jobs:
unit-tests:
name: Run unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 16
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust toolchain
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #@v1
with:
profile: minimal
toolchain: stable
components: llvm-tools-preview
override: true
- name: Install cargo-llvm-cov
run: |
if type cargo-llvm-cov >/dev/null 2>&1; then echo "cargo-llvm-cov is already installed"; else cargo install cargo-llvm-cov ; fi
- name: Installing needed dependencies
run: sudo apt-get install -y libasound2-dev protobuf-compiler
- name: Run cargo-llvm-cov
run: |
cp -r fixtures/audio /tmp
sudo cp fixtures/asound.conf /etc
cd migration && DATABASE_URL=sqlite:///tmp/music-player.sqlite3 cargo run && cd ..
export MUSIC_PLAYER_APPLICATION_DIRECTORY=/tmp
export MUSIC_PLAYER_MUSIC_DIRECTORY=/tmp/audio
export MUSIC_PLAYER_DATABASE_URL=sqlite:///tmp/music-player.sqlite3
export MUSIC_PLAYER_PORT=5040
cargo run -- scan
cd server && cargo run &
sleep 3
cargo llvm-cov --all-features --lib --workspace --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}