From 9d1a2db45a46ee30c3f1d40811cd8a3ee6e91c7a Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Mon, 26 Feb 2024 12:29:12 -0500 Subject: [PATCH] Migrate to GitHub Actions --- .github/workflows/build_nupkg.yml | 44 +++++++++++++++++++++++++ .github/workflows/build_test.yml | 54 +++++++++++++++++++++++++++++++ appveyor.yml | 45 ++------------------------ 3 files changed, 101 insertions(+), 42 deletions(-) create mode 100644 .github/workflows/build_nupkg.yml create mode 100644 .github/workflows/build_test.yml diff --git a/.github/workflows/build_nupkg.yml b/.github/workflows/build_nupkg.yml new file mode 100644 index 00000000..e28fc8b0 --- /dev/null +++ b/.github/workflows/build_nupkg.yml @@ -0,0 +1,44 @@ +name: Test + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + + - name: Restore dependencies + run: dotnet restore + + - name: Pack + run: dotnet pack + + - name: Upload build + uses: actions/upload-artifact@v4 + with: + name: 'Nuget Package' + path: '*.nupkg' + + - name: Upload to rolling + uses: ncipollo/release-action@v1.14.0 + with: + allowUpdates: True + artifacts: '*.nupkg' + body: 'Last built commit: ${{ github.sha }}' + commit: ${{ github.sha }} + name: 'Rolling Release' + prerelease: True + replacesArtifacts: True + tag: "rolling" + updateOnlyUnreleased: True diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml new file mode 100644 index 00000000..1830725e --- /dev/null +++ b/.github/workflows/build_test.yml @@ -0,0 +1,54 @@ +name: Test + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + project: [Test] + runtime: [win-x86, win-x64, linux-x64, osx-x64] #[win-x86, win-x64, win-arm64, linux-x64, linux-arm64, osx-x64] + framework: [net8.0] #[net20, net35, net40, net452, net472, net48, netcoreapp3.1, net5.0, net6.0, net7.0, net8.0] + conf: [Release, Debug] + + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet publish ${{ matrix.project }}/${{ matrix.project }}.csproj -f ${{ matrix.framework }} -r ${{ matrix.runtime }} -c ${{ matrix.conf == 'Release' && 'Release -p:DebugType=None -p:DebugSymbols=false' || 'Debug'}} --self-contained true --version-suffix ${{ github.sha }} ${{ (startsWith(matrix.framework, 'net5') || startsWith(matrix.framework, 'net6') || startsWith(matrix.framework, 'net7') || startsWith(matrix.framework, 'net8')) && '-p:PublishSingleFile=true' || ''}} + + - name: Archive build + run: zip -r ${{ matrix.project }}_${{ matrix.framework }}_${{ matrix.runtime }}_${{ matrix.conf }}.zip ${{ matrix.project }}/bin/${{ matrix.conf }}/${{ matrix.framework }}/${{ matrix.runtime }}/publish/ + + - name: Upload build + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.project }}_${{ matrix.framework }}_${{ matrix.runtime }}_${{ matrix.conf }} + path: ${{ matrix.project }}_${{ matrix.framework }}_${{ matrix.runtime }}_${{ matrix.conf }}.zip + + - name: Upload to rolling + uses: ncipollo/release-action@v1.14.0 + with: + allowUpdates: True + artifacts: ${{ matrix.project }}_${{ matrix.framework }}_${{ matrix.runtime }}_${{ matrix.conf }}.zip + body: 'Last built commit: ${{ github.sha }}' + commit: ${{ github.sha }} + name: 'Rolling Release' + prerelease: True + replacesArtifacts: True + tag: "rolling" + updateOnlyUnreleased: True diff --git a/appveyor.yml b/appveyor.yml index 4ced2853..ec1d7f9b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,5 @@ # version format -version: 3.0.0-{build} +version: 3.1.0-{build} # pull request template pull_requests: @@ -15,33 +15,7 @@ install: # build step build_script: - - dotnet restore - - # Debug - - dotnet publish Test\Test.csproj -f net8.0 -r win-x86 -c Debug --self-contained true -p:PublishSingleFile=true - - dotnet publish Test\Test.csproj -f net8.0 -r win-x64 -c Debug --self-contained true -p:PublishSingleFile=true - - dotnet publish Test\Test.csproj -f net8.0 -r linux-x64 -c Debug --self-contained true -p:PublishSingleFile=true - - dotnet publish Test\Test.csproj -f net8.0 -r osx-x64 -c Debug --self-contained true -p:PublishSingleFile=true - - # Release - - dotnet publish Test\Test.csproj -f net8.0 -r win-x86 -c Release --self-contained true -p:PublishSingleFile=true -p:DebugSymbols=false - - dotnet publish Test\Test.csproj -f net8.0 -r win-x64 -c Release --self-contained true -p:PublishSingleFile=true -p:DebugSymbols=false - - dotnet publish Test\Test.csproj -f net8.0 -r linux-x64 -c Release --self-contained true -p:PublishSingleFile=true -p:DebugSymbols=false - - dotnet publish Test\Test.csproj -f net8.0 -r osx-x64 -c Release --self-contained true -p:PublishSingleFile=true -p:DebugSymbols=false - - # Nuget Package - - dotnet pack BinaryObjectScanner\BinaryObjectScanner.csproj --output %APPVEYOR_BUILD_FOLDER% - -# post-build script -after_build: - - cd %APPVEYOR_BUILD_FOLDER%\Test\bin\Debug\net8.0\win-x86\publish\ - - 7z a -tzip %APPVEYOR_BUILD_FOLDER%\BinaryObjectScanner_%APPVEYOR_REPO_COMMIT%_net8.0_win-x86.zip * - - cd %APPVEYOR_BUILD_FOLDER%\Test\bin\Debug\net8.0\win-x64\publish\ - - 7z a -tzip %APPVEYOR_BUILD_FOLDER%\BinaryObjectScanner_%APPVEYOR_REPO_COMMIT%_net8.0_win-x64.zip * - - cd %APPVEYOR_BUILD_FOLDER%\Test\bin\Debug\net8.0\linux-x64\publish\ - - 7z a -tzip %APPVEYOR_BUILD_FOLDER%\BinaryObjectScanner_%APPVEYOR_REPO_COMMIT%_net8.0_linux-x64.zip * - - cd %APPVEYOR_BUILD_FOLDER%\Test\bin\Debug\net8.0\osx-x64\publish\ - - 7z a -tzip %APPVEYOR_BUILD_FOLDER%\BinaryObjectScanner_%APPVEYOR_REPO_COMMIT%_net8.0_osx-x64.zip * + - dotnet build # success/failure tracking on_success: @@ -49,17 +23,4 @@ on_success: - ps: ./send.ps1 success $env:WEBHOOK_URL on_failure: - ps: Invoke-RestMethod https://raw.githubusercontent.com/DiscordHooks/appveyor-discord-webhook/master/send.ps1 -o send.ps1 - - ps: ./send.ps1 failure $env:WEBHOOK_URL - -# artifact linking -artifacts: -- path: BinaryObjectScanner_%APPVEYOR_REPO_COMMIT%_net8.0_win-x86.zip - name: BinaryObjectScanner (.NET 8.0, Windows x86) -- path: BinaryObjectScanner_%APPVEYOR_REPO_COMMIT%_net8.0_win-x64.zip - name: BinaryObjectScanner (.NET 8.0, Windows x64) -- path: BinaryObjectScanner_%APPVEYOR_REPO_COMMIT%_net8.0_linux-x64.zip - name: BinaryObjectScanner (.NET 8.0, Linux x64) -- path: BinaryObjectScanner_%APPVEYOR_REPO_COMMIT%_net8.0_osx-x64.zip - name: BinaryObjectScanner (.NET 8.0, OSX x64) -- path: '*.nupkg' - name: Nuget Packages + - ps: ./send.ps1 failure $env:WEBHOOK_URL \ No newline at end of file