diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..51a9560 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,43 @@ +name: CI build-test-pack +on: [push] +jobs: + build: + name: Build and test (${{ matrix.os }}) + strategy: + matrix: + os: [ubuntu-latest,windows-latest,macos-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - name: Setup .NET SDK - 6.0.x + uses: actions/setup-dotnet@v1 + with: + dotnet-version: '6.0.x' + - name: Setup .NET SDK - 5.0.x + uses: actions/setup-dotnet@v1 + with: + dotnet-version: '5.0.x' + - name: Setup .NET SDK - 3.1.x + uses: actions/setup-dotnet@v1 + with: + dotnet-version: '3.1.x' + - name: Install dependencies + run: dotnet restore + - name: Build + run: dotnet build --no-restore --configuration Release + - name: Test + run: dotnet test --no-restore --no-build --configuration Release --logger trx --results-directory "TestResults" + - name: Upload test results + uses: actions/upload-artifact@v2 + with: + name: TestResults + path: TestResults + # Use always() to always run this step to publish test results when there are test failures + if: ${{ always() }} + - name: Pack + run: dotnet pack --no-restore --no-build --configuration Release --version-suffix CI-${{ github.run_id }} --output pkg + - name: Upload package + uses: actions/upload-artifact@v2 + with: + name: LibDeflate-${{ matrix.os }} + path: pkg/* diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b395c46 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,19 @@ +name: Upload packages to feeds +on: + release: + types: [created] + workflow_dispatch: +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-dotnet@v1 + with: + dotnet-version: '6.0.x' # SDK Version to use. + - name: Pack + run: dotnet pack -c Release -o pkg + - name: Publish the package to GPR + run: dotnet nuget push pkg/*.nupkg -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/jzebedee/index.json --skip-duplicate + - name: Publish the package to NuGet + run: dotnet nuget push pkg/*.nupkg -k ${{ secrets.LIBDEFLATE_NUGET_TOKEN }} -s https://api.nuget.org/v3/index.json --skip-duplicate diff --git a/LibDeflate.sln b/LibDeflate.sln index bdd42bf..049a940 100644 --- a/LibDeflate.sln +++ b/LibDeflate.sln @@ -16,6 +16,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution .editorconfig = .editorconfig EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{A36D1CD3-44C1-4790-9AE6-708D6253394B}" + ProjectSection(SolutionItems) = preProject + .github\workflows\ci.yml = .github\workflows\ci.yml + .github\workflows\release.yml = .github\workflows\release.yml + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/bench/LibDeflate.Benchmarks/Program.cs b/bench/LibDeflate.Benchmarks/Program.cs new file mode 100644 index 0000000..e1c0549 --- /dev/null +++ b/bench/LibDeflate.Benchmarks/Program.cs @@ -0,0 +1,8 @@ +using BenchmarkDotNet.Running; + +namespace LibDeflate.Benchmarks; + +public class Program +{ + public static void Main(string[] args) => BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args); +}