Skip to content

Commit

Permalink
feat: CrossPlatform version
Browse files Browse the repository at this point in the history
- As little changes as possible, to allow future merges of upstream changes
- Even the same namespace to be a drop-in replacement
- Still comes with libmp3lame.dll for Windows, needs libmp3lame.so installed via package manager on Linux
- .NET 8.0
- Drops support for .NET Framework
- Removes FodyWeavers
- Uses NLayer in Unit tests to read MP3 files cross platform
- Uses WAV file with actual PCM content to avoid AudioFileReader trying to use Msacm32.dll which is not available on Linux
- Docker container to run tests on Linux
- NAudio 2.2.1
  • Loading branch information
dhilgarth committed Mar 20, 2024
1 parent 5b5bb00 commit f8e9f3c
Show file tree
Hide file tree
Showing 46 changed files with 403 additions and 635 deletions.
30 changes: 30 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
!**/.gitignore
!.git/HEAD
!.git/config
!.git/packed-refs
!.git/refs/heads/**
52 changes: 0 additions & 52 deletions .github/workflows/CI_NetCore_2_2.yml

This file was deleted.

134 changes: 134 additions & 0 deletions .github/workflows/CI_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: publish
on:
workflow_dispatch:
push:
branches:
- 'main' # Run the workflow when pushing to the main branch
tags:
- 'v*'
pull_request:
branches:
- '*' # Run the workflow for all pull requests
release:
types:
- published # Run the workflow when a new GitHub release is published


env:
NuGetDirectory: ${{ github.workspace}}/nuget

jobs:
ci-windows:
runs-on: windows-latest
strategy:
matrix:
dnversion: ['8.0.x']

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Setup .NET ${{ matrix.dnversion }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dnversion }}

- name: Restore packages
run: dotnet restore NAudio.Lame.CrossPlatform.sln

- name: Build LameDLLWrap (Debug|AnyCPU)
run: dotnet build LameDLLWrap -c:Debug -p:Platform=AnyCPU
- name: Build NAudio.Lame
run: dotnet build NAudio.Lame -c:Debug -p:Platform=AnyCPU
- name: Build Lame.Test
run: dotnet build Lame.Test -c:Debug -p:Platform=AnyCPU
- name: Run tests
run: dotnet test Lame.Test

ci-linux:
runs-on: ubuntu-latest
strategy:
matrix:
dnversion: ['8.0.x']

steps:
- name: Install libmp3lame
run: sudo apt-get install -y lame

- name: Check out repository
uses: actions/checkout@v4

- name: Setup .NET ${{ matrix.dnversion }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dnversion }}

- name: Restore packages
run: dotnet restore NAudio.Lame.CrossPlatform.sln

- name: Build LameDLLWrap (Debug|AnyCPU)
run: dotnet build LameDLLWrap -c:Debug -p:Platform=AnyCPU
- name: Build NAudio.Lame
run: dotnet build NAudio.Lame -c:Debug -p:Platform=AnyCPU
- name: Build Lame.Test
run: dotnet build Lame.Test -c:Debug -p:Platform=AnyCPU
- name: Run tests
run: dotnet test Lame.Test

create_nuget:
runs-on: ubuntu-latest
if: github.event_name == 'release' || startsWith(github.ref, 'refs/tags/')
strategy:
matrix:
dnversion: ['8.0.x']

steps:
- uses: actions/checkout@v4

- name: Setup .NET ${{ matrix.dnversion }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dnversion }}

- name: Build Nuget package
run: |
VERSION_SUFFIX=""
if [[ "${{ startsWith(github.ref, 'refs/tags/') }}" == "true" ]]; then
VERSION_SUFFIX="/p:Version=${GITHUB_REF#refs/tags/}"
fi
dotnet pack ./NAudio.Lame/NAudio.Lame.csproj --configuration Release --output ${{ env.NuGetDirectory }} $VERSION_SUFFIX
# Publish the NuGet package as an artifact, so they can be used in the following jobs
- uses: actions/upload-artifact@v3
with:
name: nuget
if-no-files-found: error
retention-days: 7
path: ${{ env.NuGetDirectory }}/*.nupkg

deploy:
runs-on: ubuntu-latest
needs: [ create_nuget, ci-windows, ci-linux ]
strategy:
matrix:
dnversion: ['8.0.x']
steps:
# Download the NuGet package created in the previous job
- uses: actions/download-artifact@v3
with:
name: nuget
path: ${{ env.NuGetDirectory }}

- name: Setup .NET ${{ matrix.dnversion }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dnversion }}

# Publish all NuGet packages to NuGet.org
# Use --skip-duplicate to prevent errors if a package with the same version already exists.
# If you retry a failed workflow, already published packages will be skipped without error.
- name: Publish NuGet package
run: |
foreach($file in (Get-ChildItem "${{ env.NuGetDirectory }}" -Recurse -Include *.nupkg)) {
dotnet nuget push $file --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
}
4 changes: 4 additions & 0 deletions .idea/.idea.NAudio.Lame.CrossPlatform/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
The MIT License (MIT)

Copyright (c) 2013-2019 Corey Murtagh
Copyright (c) 2024 Daniel Hilgarth / Sovarto GmbH

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
Binary file removed Lame.Test.Core/test.wav
Binary file not shown.
142 changes: 0 additions & 142 deletions Lame.Test.Framework/Lame.Test.Framework.csproj

This file was deleted.

20 changes: 0 additions & 20 deletions Lame.Test.Framework/Properties/AssemblyInfo.cs

This file was deleted.

0 comments on commit f8e9f3c

Please sign in to comment.