From 7a9a79650fdc00ac20ce1e43faa12a48414466bf Mon Sep 17 00:00:00 2001 From: Brian Surowiec Date: Mon, 14 Mar 2022 21:37:55 -0400 Subject: [PATCH 1/2] Move build scripts over to run-script --- .config/dotnet-tools.json | 12 ++++++++++++ .github/workflows/ci.yml | 10 ++++++---- .github/workflows/pull_request.yml | 10 ++++++---- .github/workflows/release.yml | 10 ++++++---- .vscode/settings.json | 3 +++ CHANGELOG.md | 1 + README.md | 5 +++++ global.json | 13 +++++++++++++ 8 files changed, 52 insertions(+), 12 deletions(-) create mode 100644 .config/dotnet-tools.json 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..3b1874d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,11 +44,13 @@ jobs: - run: npm ci - - run: dotnet build --configuration Release + - run: dotnet tool restore - - run: dotnet test --configuration Release --no-build --logger "trx" --results-directory "./.codecoverage" + - run: dotnet r build:release - - run: dotnet pack --configuration Release --output ./artifacts --version-suffix $VERSION_SUFFIX + - run: dotnet r test:release + + - run: dotnet r pack:release -- --version-suffix $VERSION_SUFFIX - name: Upload artifacts uses: actions/upload-artifact@v3.0.0 @@ -60,7 +62,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..45e08e9 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -39,11 +39,13 @@ jobs: - run: npm ci - - run: dotnet build --configuration Release + - run: dotnet tool restore - - run: dotnet test --configuration Release --no-build --logger "trx" --results-directory "./.codecoverage" + - run: dotnet r build:release - - run: dotnet pack --configuration Release --output ./artifacts --version-suffix $VERSION_SUFFIX + - run: dotnet r test:release + + - run: dotnet r pack:release -- --version-suffix $VERSION_SUFFIX - name: Upload artifacts uses: actions/upload-artifact@v3.0.0 @@ -55,4 +57,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..8ef4497 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -39,11 +39,13 @@ jobs: - run: npm ci - - run: dotnet build --configuration Release + - run: dotnet tool restore - - run: dotnet test --configuration Release --no-build --logger "trx" --results-directory "./.codecoverage" + - run: dotnet r build:release - - run: dotnet pack --configuration Release --output ./artifacts + - run: dotnet r test:release + + - run: dotnet r pack:release - name: Upload artifacts uses: actions/upload-artifact@v3.0.0 @@ -55,7 +57,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" } } From a8f6490945c354e3204b7f5e6676e89ef69af8ee Mon Sep 17 00:00:00 2001 From: Brian Surowiec Date: Mon, 14 Mar 2022 21:48:31 -0400 Subject: [PATCH 2/2] Directly reference the 6.0 sdk --- .github/workflows/ci.yml | 5 +++-- .github/workflows/pull_request.yml | 5 +++-- .github/workflows/release.yml | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3b1874d..6c24607 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,9 +38,10 @@ 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 diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 45e08e9..9d9188e 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -33,9 +33,10 @@ 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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8ef4497..aa67055 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,9 +33,10 @@ 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