diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 0000000..d98a700 --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "run-script": { + "version": "0.1.0-beta.2", + "commands": [ + "r" + ] + } + } +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef1b08f..6c24607 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,17 +38,20 @@ jobs: dotnet-version: | 3.1.x 5.0.x + 6.0.x - - name: Set up .NET Core (global.json) - uses: actions/setup-dotnet@v2.0.0 + #- name: Set up .NET Core (global.json) + # uses: actions/setup-dotnet@v2.0.0 - run: npm ci - - run: dotnet build --configuration Release + - run: dotnet tool restore + + - run: dotnet r build:release - - run: dotnet test --configuration Release --no-build --logger "trx" --results-directory "./.codecoverage" + - run: dotnet r test:release - - run: dotnet pack --configuration Release --output ./artifacts --version-suffix $VERSION_SUFFIX + - run: dotnet r pack:release -- --version-suffix $VERSION_SUFFIX - name: Upload artifacts uses: actions/upload-artifact@v3.0.0 @@ -60,7 +63,7 @@ jobs: if: always() with: name: test-results - path: ./.codecoverage/*.trx + path: ./.coverage/*.trx - name: Publish to GPR run: | diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index d2778d6..9d9188e 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -33,17 +33,20 @@ jobs: dotnet-version: | 3.1.x 5.0.x + 6.0.x - - name: Set up .NET Core (global.json) - uses: actions/setup-dotnet@v2.0.0 + #- name: Set up .NET Core (global.json) + # uses: actions/setup-dotnet@v2.0.0 - run: npm ci - - run: dotnet build --configuration Release + - run: dotnet tool restore + + - run: dotnet r build:release - - run: dotnet test --configuration Release --no-build --logger "trx" --results-directory "./.codecoverage" + - run: dotnet r test:release - - run: dotnet pack --configuration Release --output ./artifacts --version-suffix $VERSION_SUFFIX + - run: dotnet r pack:release -- --version-suffix $VERSION_SUFFIX - name: Upload artifacts uses: actions/upload-artifact@v3.0.0 @@ -55,4 +58,4 @@ jobs: if: always() with: name: test-results - path: ./.codecoverage/*.trx + path: ./.coverage/*.trx diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 16c0f56..aa67055 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,17 +33,20 @@ jobs: dotnet-version: | 3.1.x 5.0.x + 6.0.x - - name: Set up .NET Core (global.json) - uses: actions/setup-dotnet@v2.0.0 + #- name: Set up .NET Core (global.json) + # uses: actions/setup-dotnet@v2.0.0 - run: npm ci - - run: dotnet build --configuration Release + - run: dotnet tool restore + + - run: dotnet r build:release - - run: dotnet test --configuration Release --no-build --logger "trx" --results-directory "./.codecoverage" + - run: dotnet r test:release - - run: dotnet pack --configuration Release --output ./artifacts + - run: dotnet r pack:release - name: Upload artifacts uses: actions/upload-artifact@v3.0.0 @@ -55,7 +58,7 @@ jobs: if: always() with: name: test-results - path: ./.codecoverage/*.trx + path: ./.coverage/*.trx - name: Upload release assets uses: softprops/action-gh-release@v1 diff --git a/.vscode/settings.json b/.vscode/settings.json index 3962412..92d6a38 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,7 @@ { + "files.associations" : { + "global.json" : "json5" + }, "cSpell.words": [ "evenodd", "heroicon", diff --git a/CHANGELOG.md b/CHANGELOG.md index c497062..f32029c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Unreleased - Target .NET Core 3.1, .NET 5.0, and .NET 6.0 +- Moved build scripts over to the [run-script](https://github.com/xt0rted/dotnet-run-script) dotnet tool ## [1.0.5](https://github.com/xt0rted/heroicons-tag-helper/compare/v1.0.4...v1.0.5) - 2021-11-07 diff --git a/README.md b/README.md index d34eb21..09cc834 100644 --- a/README.md +++ b/README.md @@ -101,3 +101,8 @@ will output ``` + +## Development + +This project uses the [run-script](https://github.com/xt0rted/dotnet-run-script) dotnet tool to manage its build and test scripts. +To use this you'll need to run `dotnet tool install` and then `dotnet r` to see the available commands or look at the `scripts` section in the [global.json](global.json). diff --git a/global.json b/global.json index c009e93..899b2c9 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,18 @@ { "sdk": { "version": "6.0.201" + }, + "scripts": { + // Debug mode scripts + "build": "dotnet build", + "test": "dotnet test --no-build --logger \"trx\" --results-directory \"./.coverage\"", + "pack": "dotnet pack --no-build --output ./artifacts", + "ci": "dotnet r build && dotnet r test && dotnet r pack", + + // Release mode scripts + "build:release": "dotnet r build -- --configuration Release", + "test:release": "dotnet r test -- --configuration Release", + "pack:release": "dotnet r pack -- --configuration Release", + "ci:release": "dotnet r build:release && dotnet r test:release && dotnet r pack:release" } }