diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c674463f..7daf54b3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,10 +13,6 @@ on: env: dotnetVersion: 5.0.x -defaults: - run: - working-directory: src - jobs: test: name: Test @@ -33,7 +29,7 @@ jobs: dotnet-version: ${{ env.dotnetVersion }} - name: Test - run: dotnet test --configuration Release --logger GitHubActions + run: dotnet test src --configuration Release --logger GitHubActions build: name: Build @@ -41,10 +37,16 @@ jobs: strategy: fail-fast: true matrix: - runtime: [win-x64, linux-x64, osx-x64] + include: + - runtime: win-x64 + image: windows-latest + - runtime: linux-x64 + image: ubuntu-latest + - runtime: osx-x64 + image: macos-latest # Must run on Windows so that version info gets properly set in host EXE. See: # https://github.com/dotnet/runtime/issues/3828 - runs-on: windows-latest + runs-on: ${{ matrix.image }} steps: - name: Checkout Source Code uses: actions/checkout@v2 @@ -59,26 +61,15 @@ jobs: with: dotnet-version: ${{ env.dotnetVersion }} - - name: Publish - run: > - dotnet publish Trash - --configuration Release - --output publish - --runtime ${{ matrix.runtime }} - --self-contained true - -p:PublishSingleFile=true - -p:PublishTrimmed=true - -p:IncludeNativeLibrariesForSelfExtract=true - - - name: Zip Binary + - name: Publish & Zip shell: pwsh - run: Compress-Archive publish/trash* trash-${{ matrix.runtime }}.zip + run: ci/PublishAndZip.ps1 ${{ matrix.runtime }} - name: Upload Artifacts uses: actions/upload-artifact@v2 with: name: trash - path: src/trash-*.zip + path: publish/zip/trash-*.zip release: name: Release diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e9b1fb7..c3ff4f36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- Executable is now compiled using [Ready to Run]. This substantially increases the size of the + executable but makes the code much faster. + +[Ready to Run]: https://docs.microsoft.com/en-us/dotnet/core/deploying/ready-to-run + ## [1.3.0] - 2021-04-23 ### Added diff --git a/ci/PublishAndZip.ps1 b/ci/PublishAndZip.ps1 new file mode 100644 index 00000000..a63f7fb2 --- /dev/null +++ b/ci/PublishAndZip.ps1 @@ -0,0 +1,21 @@ +[CmdletBinding()] +param ( + [Parameter(Mandatory=$true)] + [string] + $runtime +) + +$ErrorActionPreference = "Stop" + +dotnet publish src\Trash ` + --output publish\$runtime ` + --configuration Release ` + --runtime $runtime ` + --self-contained true ` + -p:PublishSingleFile=true ` + -p:PublishTrimmed=true ` + -p:IncludeNativeLibrariesForSelfExtract=true ` + -p:PublishReadyToRun=true + +New-Item -ItemType Directory -Force -Path publish\zip +Compress-Archive publish\$runtime\trash* publish\zip\trash-$runtime.zip -Force diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 916ed5ec..2fc9819c 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -3,7 +3,7 @@ net5.0 enable 9999 - + embedded