Merge branch 'master' into renovate/migrate-config #151
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-24.04, rid: linux-arm64 } # TODO | |
- { 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 |