generated from AlekseyMartynov/ad-hoc-util
-
Notifications
You must be signed in to change notification settings - Fork 4
117 lines (85 loc) · 3.16 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: CI
concurrency:
group: ${{github.workflow}}-${{github.event.pull_request.number || github.sha}}
cancel-in-progress: true
on:
schedule:
- cron: '0 12 1 * *'
workflow_dispatch:
push:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: curl -L https://github.com/editorconfig-checker/editorconfig-checker/releases/download/2.7.1/ec-linux-amd64.tar.gz | tar xzf - -C /opt
- run: /opt/bin/ec-linux-amd64
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8
- run: dotnet format Project.csproj --verify-no-changes
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8
- run: dotnet test --logger "console;verbosity=detailed"
publish:
strategy:
fail-fast: false
matrix:
include:
- { os: windows-latest, rid: win-x64 }
- { os: windows-latest, rid: win-arm64 }
- { os: ubuntu-latest, rid: linux-x64 }
- { os: ubuntu-latest, rid: linux-arm64 }
- { os: macos-latest, rid: osx-x64 }
- { os: macos-latest, rid: osx-arm64 }
env:
OUT_DIR: ./bin/Release/net8/${{ matrix.rid }}/native
OUT_BIN: ./bin/Release/net8/${{ matrix.rid }}/native/Shazam.${{ matrix.rid }}
TEST_FILE: TestData/test.mp3
TEST_TRACK_ID: 11188983
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8
- if: matrix.rid == 'linux-arm64'
run: sudo sh -e .github/workflows/install-ubuntu-arm64.sh
- run: dotnet publish --sc -c Release -r ${{ matrix.rid }}
# Test with file
- if: endsWith(matrix.rid, '-x64') || matrix.rid == 'linux-arm64'
run: ${{ env.OUT_BIN }} ${{ env.TEST_FILE }} > test-out
- if: matrix.rid == 'win-x64'
run: findstr ${{ env.TEST_TRACK_ID }} test-out
- if: matrix.rid == 'linux-x64' || matrix.rid == 'linux-arm64' || matrix.rid == 'osx-x64'
run: grep ${{ env.TEST_TRACK_ID }} test-out
# Test with virtual device (Linux)
- if: matrix.rid == 'linux-x64' || matrix.rid == 'linux-arm64'
run: |
sudo apt-get update
sudo apt-get install -y alsa-base ffmpeg sox
ffmpeg -i ${{ env.TEST_FILE }} -ar 48000 -ac 2 /tmp/test.wav
cp .github/workflows/test-asoundrc ~/.asoundrc
echo ' ' | AUDIODEV=test ${{ env.OUT_BIN }} > test-out-live
grep ${{ env.TEST_TRACK_ID }} test-out-live
# Test with virtual device (Win)
- if: matrix.rid == 'win-x64'
uses: AlekseyMartynov/action-vbcable-win@main
- if: matrix.rid == 'win-x64'
run: |
iwr https://github.com/stsaz/fmedia/releases/download/v1.31/fmedia-1.31-windows-x64.zip -OutFile fmedia.zip
Expand-Archive fmedia.zip .
Start-Job -ScriptBlock { .\fmedia\fmedia --repeat-all ${{ env.TEST_FILE }} }
" " | ${{ env.OUT_BIN }} > test-out-live
findstr ${{ env.TEST_TRACK_ID }} test-out-live
# Ready
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.rid }}
path: ${{ env.OUT_DIR }}/*
retention-days: 1