From 12b8f6a5645872035ef301988f9008b5120699fb Mon Sep 17 00:00:00 2001 From: Cervac Petru Date: Sat, 9 Sep 2023 15:17:43 +0100 Subject: [PATCH] ci: add workflow to release features (#70) * feat: check a theory * asd * asd * asd * asd * asd * asd * asd * asd * asd * asd * asd * asd --- .github/workflows/update-version.yaml | 30 ++++++++++++++++++++++----- .nuke/build.schema.json | 3 +++ build/Build.Features.cs | 6 +++++- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/.github/workflows/update-version.yaml b/.github/workflows/update-version.yaml index 49a4317..2f870a5 100644 --- a/.github/workflows/update-version.yaml +++ b/.github/workflows/update-version.yaml @@ -7,15 +7,33 @@ jobs: name: features runs-on: ubuntu-latest outputs: - templates: ${{ steps.changed_files.outputs.templates }} features: ${{ steps.changed_files.outputs.features }} - changesToNuke: ${{ steps.changed_files.outputs.changesToNuke }} steps: - uses: actions/checkout@v3 name: pull branch with: fetch-depth: 0 repository: ${{ github.event.pull_request.head.repo.full_name }} + # - run: git switch main + - name: find changed templates & features + id: changed_files + run: | + ls -la features/src + ./build.sh GetFeatures -All -GithubOutput "$GITHUB_OUTPUT" + + release-feature: + if: ${{ needs.changes.outputs.features }} + needs: [changes] + name: Test feature ${{ matrix.feature }} + runs-on: ubuntu-latest + continue-on-error: true + strategy: + matrix: + feature: ${{ fromJSON(needs.changes.outputs.features) }} + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: "Cache: .nuke/temp, ~/.nuget/packages" uses: actions/cache@v3 with: @@ -23,6 +41,8 @@ jobs: .nuke/temp ~/.nuget/packages key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }} - - name: find changed templates & features - id: changed_files - run: ./build.sh ListTemplatesAndFeatures -GithubOutput "$GITHUB_OUTPUT" + - name: Install Node + uses: actions/setup-node@v3 + - name: Run test for '${{ matrix.feature }}' + id: smoke_test + run: ./build.sh ReleaseFeature -Feature '${{ matrix.feature }}' diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index 54ea748..8486b07 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -6,6 +6,9 @@ "build": { "type": "object", "properties": { + "All": { + "type": "boolean" + }, "Continue": { "type": "boolean", "description": "Indicates to continue a previously failed build attempt" diff --git a/build/Build.Features.cs b/build/Build.Features.cs index bd1736a..9cdaa07 100644 --- a/build/Build.Features.cs +++ b/build/Build.Features.cs @@ -1,6 +1,8 @@ using System.Text.Json; + using Nuke.Common; using Nuke.Common.IO; + using Serilog; sealed partial class Build @@ -11,6 +13,8 @@ sealed partial class Build [Parameter] private readonly bool SkipAutoGenerated; + [Parameter] private readonly bool All = false; + [Parameter("Feature to build")] private readonly string Feature = null!; private Target TestFeature => _ => _ @@ -71,7 +75,7 @@ sealed partial class Build var features = Directory .GetDirectories(FeaturesRoot / "src") .Select(x => RootDirectory.GetRelativePathTo(x)) - .Where(feature => Changes.Any(change => change.StartsWith(feature))) + .Where(feature => All || Changes.Any(change => change.StartsWith(feature))) .Select(x => x.ToString()) .Select(Path.GetFileName) .ToList();