From 4c291e198d54321c6deab9e52e51ac682cb4dea5 Mon Sep 17 00:00:00 2001 From: Vikas Pachori Date: Wed, 16 Jul 2025 13:05:22 +0530 Subject: [PATCH 1/7] ymls added --- .github/workflows/build.yml | 119 ++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 86 ++++++++++++++++++++++++ 2 files changed, 205 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..8ee5951 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,119 @@ +name: "Build" + +on: + workflow_dispatch: + + push: + paths-ignore: + - '**.md' + - '**/NuGet.yml' + pull_request: + paths-ignore: + - '**.md' + +# schedule: +# - cron: "15 */12 * * *" + +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-14] + arch: ['amd64'] + fail-fast: false + + name: Build library (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + steps: + - name: Set Build Branch + if: github.event_name == 'schedule' + run: | + echo "BuildBranch=nightly-builds" >> "$GITHUB_ENV" + echo "BuildBranch=nightly-builds" >> $env:GITHUB_ENV + + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup .NET Core SDK + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: Restore dependencies + run: dotnet restore Source/EnergyExemplar.EFCore.Duckdb.Extensions.csproj + + - name: Build + run: dotnet build Source/EnergyExemplar.EFCore.Duckdb.Extensions.csproj --configuration Release --no-restore + + - name: Pack + if: matrix.os == 'ubuntu-latest' && github.event_name != 'pull_request' + run: | + dotnet pack Source/EnergyExemplar.EFCore.Duckdb.Extensions.csproj --configuration Release --no-build + + - name: Run tests + env: + CoverletOutputFormat: lcov + run: dotnet test Tests/Tests.csproj --configuration Release --verbosity normal --logger GitHubActions /p:CollectCoverage=true /p:CoverletOutputFormat=lcov + + - name: Upload coverage reports to Coveralls Parallel + uses: coverallsapp/github-action@v2 + if: github.event_name != 'schedule' + with: + github-token: ${{ secrets.github_token }} + flag-name: run-${{ matrix.os }} + path-to-lcov: Tests/coverage.net8.0.info + parallel: true + format: lcov + + - name: Upload coverage reports to Codecov + if: matrix.os == 'ubuntu-latest' && github.event_name != 'schedule' + uses: codecov/codecov-action@v4.0.1 + with: + # Add CODECOV_TOKEN secret to enable Codecov integration + # token: ${{ secrets.CODECOV_TOKEN }} + slug: VikasAtEnEx/EnergyExemplar.EFCore.Duckdb.Extensions + + - name: Upload Artifacts + if: matrix.os == 'ubuntu-latest' && github.event_name != 'pull_request' && github.actor == 'VikasAtEnEx' + uses: actions/upload-artifact@v4 + with: + name: nugetPackages-${{github.ref_name}} + path: ./**/bin/Release/*.nupkg + + publish: + needs: build + name: Publish Packages + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && github.event_name != 'schedule' + steps: + - name: Download nuget package artifact + uses: actions/download-artifact@v4 + with: + name: nugetPackages-${{github.ref_name}} + + - name: Display structure of downloaded files + run: ls -R + + - name: Prep packages + run: dotnet nuget add source --username VikasAtEnEx --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/VikasAtEnEx/index.json" + + - name: Push package to GitHub packages + run: dotnet nuget push "**/*.nupkg" --api-key ${{ secrets.GITHUB_TOKEN }} --source "github" + + Finish-Coveralls-Collection: + needs: build + name: Finish Coveralls Collection + runs-on: ubuntu-latest + if: github.event_name != 'schedule' + steps: + - name: Coveralls Finished + uses: coverallsapp/github-action@v2 + with: + github-token: ${{ secrets.github_token }} + parallel-finished: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..fbae829 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,86 @@ +name: "Release" + +on: + push: + branches: + - main + paths: + - 'Source/**' + workflow_dispatch: + inputs: + version: + description: 'Version to tag (e.g., 0.1.0)' + required: true + default: '0.1.0' + +jobs: + release: + if: github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup .NET Core SDK + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: Restore dependencies + run: dotnet restore Source/EnergyExemplar.EFCore.Duckdb.Extensions.csproj + + - name: Build + run: dotnet build Source/EnergyExemplar.EFCore.Duckdb.Extensions.csproj --configuration Release --no-restore + + - name: Run tests + run: dotnet test Tests/Tests.csproj --configuration Release --verbosity normal + + - name: Determine version + id: version + run: | + if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then + VERSION="${{ github.event.inputs.version }}" + else + # Auto-increment version based on existing tags + LATEST_TAG=$(git tag -l "0.1.*" --sort=-version:refname | head -n 1) + if [ -z "$LATEST_TAG" ]; then + VERSION="0.1.0" + else + # Extract patch version and increment + PATCH=$(echo $LATEST_TAG | sed 's/0\.1\.//') + NEW_PATCH=$((PATCH + 1)) + VERSION="0.1.$NEW_PATCH" + fi + fi + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "Version to be tagged: $VERSION" + + - name: Create GitHub Release + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ steps.version.outputs.version }} + name: Release ${{ steps.version.outputs.version }} + body: | + ## EnergyExemplar.EFCore.Duckdb.Extensions ${{ steps.version.outputs.version }} + + 🚀 **What's Changed** + - Latest updates and improvements + - Bug fixes and enhancements + + 📦 **Installation** + ```bash + git clone https://github.com/VikasAtEnEx/EnergyExemplar.EFCore.Duckdb.Extensions.git + cd EnergyExemplar.EFCore.Duckdb.Extensions + git checkout ${{ steps.version.outputs.version }} + ``` + + 🔧 **Build from source** + ```bash + dotnet build Source/EnergyExemplar.EFCore.Duckdb.Extensions.csproj --configuration Release + ``` + draft: false + prerelease: false + generate_release_notes: true From e3a1d0cd6a8153cea2e3f6169022f973cd9dc8b7 Mon Sep 17 00:00:00 2001 From: Vikas Pachori Date: Wed, 16 Jul 2025 13:19:57 +0530 Subject: [PATCH 2/7] yml change --- .github/workflows/build.yml | 246 +++++++++++++++++++++++----------- .github/workflows/release.yml | 86 ------------ 2 files changed, 167 insertions(+), 165 deletions(-) delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8ee5951..8f79600 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,119 +1,207 @@ -name: "Build" +name: CI on: - workflow_dispatch: - push: - paths-ignore: - - '**.md' - - '**/NuGet.yml' + branches: [ main, develop ] pull_request: - paths-ignore: - - '**.md' - -# schedule: -# - cron: "15 */12 * * *" + branches: [ main, develop ] + workflow_dispatch: +env: + DOTNET_VERSION: '8.0.x' + +# Cancel in-progress runs when new commits are pushed concurrency: - group: ${{ github.ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: - build: + build-and-test: + name: Build and Test + runs-on: ubuntu-latest + timeout-minutes: 30 + strategy: matrix: - os: [ubuntu-latest, windows-latest, macos-14] - arch: ['amd64'] + configuration: [Debug, Release] fail-fast: false - - name: Build library (${{ matrix.os }}) - runs-on: ${{ matrix.os }} + steps: - - name: Set Build Branch - if: github.event_name == 'schedule' - run: | - echo "BuildBranch=nightly-builds" >> "$GITHUB_ENV" - echo "BuildBranch=nightly-builds" >> $env:GITHUB_ENV - - - name: Checkout + - name: Checkout code uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Setup .NET Core SDK + - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: '8.0.x' + dotnet-version: ${{ env.DOTNET_VERSION }} + + - name: Cache dependencies + uses: actions/cache@v4 + with: + path: ~/.nuget/packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/Directory.Packages.props', '**/paket.lock') }} + restore-keys: | + ${{ runner.os }}-nuget- - name: Restore dependencies - run: dotnet restore Source/EnergyExemplar.EFCore.Duckdb.Extensions.csproj + run: dotnet restore + working-directory: ./Source + + - name: Check code formatting + run: dotnet format EnergyExemplar.EFCore.Duckdb.Extensions.sln --verify-no-changes --verbosity diagnostic + working-directory: ./Source + continue-on-error: true - name: Build - run: dotnet build Source/EnergyExemplar.EFCore.Duckdb.Extensions.csproj --configuration Release --no-restore + run: dotnet build --no-restore --configuration ${{ matrix.configuration }} + working-directory: ./Source - - name: Pack - if: matrix.os == 'ubuntu-latest' && github.event_name != 'pull_request' - run: | - dotnet pack Source/EnergyExemplar.EFCore.Duckdb.Extensions.csproj --configuration Release --no-build + - name: Test + run: dotnet test --no-build --verbosity normal --configuration ${{ matrix.configuration }} --collect:"XPlat Code Coverage" --results-directory ../coverage/${{ matrix.configuration }} + working-directory: ./Tests - - name: Run tests - env: - CoverletOutputFormat: lcov - run: dotnet test Tests/Tests.csproj --configuration Release --verbosity normal --logger GitHubActions /p:CollectCoverage=true /p:CoverletOutputFormat=lcov + - name: Pack (Release only) + if: matrix.configuration == 'Release' + run: dotnet pack --no-build --configuration ${{ matrix.configuration }} --output ./artifacts + working-directory: ./Source - - name: Upload coverage reports to Coveralls Parallel - uses: coverallsapp/github-action@v2 - if: github.event_name != 'schedule' + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4 + if: matrix.configuration == 'Release' with: - github-token: ${{ secrets.github_token }} - flag-name: run-${{ matrix.os }} - path-to-lcov: Tests/coverage.net8.0.info - parallel: true - format: lcov + directory: ./coverage/Release/ + flags: unittests + name: codecov-umbrella + fail_ci_if_error: false - - name: Upload coverage reports to Codecov - if: matrix.os == 'ubuntu-latest' && github.event_name != 'schedule' - uses: codecov/codecov-action@v4.0.1 + - name: Upload test results + uses: actions/upload-artifact@v4 + if: always() with: - # Add CODECOV_TOKEN secret to enable Codecov integration - # token: ${{ secrets.CODECOV_TOKEN }} - slug: VikasAtEnEx/EnergyExemplar.EFCore.Duckdb.Extensions + name: test-results-${{ matrix.configuration }} + path: ./coverage/${{ matrix.configuration }}/ - - name: Upload Artifacts - if: matrix.os == 'ubuntu-latest' && github.event_name != 'pull_request' && github.actor == 'VikasAtEnEx' + - name: Upload build artifacts uses: actions/upload-artifact@v4 + if: matrix.configuration == 'Release' with: - name: nugetPackages-${{github.ref_name}} - path: ./**/bin/Release/*.nupkg + name: nuget-packages + path: ./Source/artifacts/*.nupkg + retention-days: 30 - publish: - needs: build - name: Publish Packages + security-scan: + name: Security Scan runs-on: ubuntu-latest - if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && github.event_name != 'schedule' + needs: build-and-test + steps: - - name: Download nuget package artifact - uses: actions/download-artifact@v4 + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 with: - name: nugetPackages-${{github.ref_name}} + dotnet-version: ${{ env.DOTNET_VERSION }} - - name: Display structure of downloaded files - run: ls -R + - name: Restore dependencies + run: dotnet restore --verbosity normal + working-directory: ./Source - - name: Prep packages - run: dotnet nuget add source --username VikasAtEnEx --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/VikasAtEnEx/index.json" + - name: Check for vulnerable packages + run: dotnet list package --vulnerable + working-directory: ./Source + continue-on-error: true - - name: Push package to GitHub packages - run: dotnet nuget push "**/*.nupkg" --api-key ${{ secrets.GITHUB_TOKEN }} --source "github" - - Finish-Coveralls-Collection: - needs: build - name: Finish Coveralls Collection + - name: Check for outdated packages + run: dotnet list package --outdated + working-directory: ./Source + continue-on-error: true + + - name: Generate dependency report + run: | + echo "## Dependency Analysis Report" > dependency-report.md + echo "" >> dependency-report.md + echo "### Vulnerable Packages:" >> dependency-report.md + dotnet list package --vulnerable >> dependency-report.md 2>&1 || echo "No vulnerable packages found" >> dependency-report.md + echo "" >> dependency-report.md + echo "### Outdated Packages:" >> dependency-report.md + dotnet list package --outdated >> dependency-report.md 2>&1 || echo "No outdated packages found" >> dependency-report.md + working-directory: ./Source + + - name: Upload dependency report + uses: actions/upload-artifact@v4 + if: always() + with: + name: dependency-report + path: ./Source/dependency-report.md + + create-release: + name: Create Release and Tag runs-on: ubuntu-latest - if: github.event_name != 'schedule' + needs: [build-and-test, security-scan] + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + steps: - - name: Coveralls Finished - uses: coverallsapp/github-action@v2 + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Determine version + id: version + run: | + # Auto-increment version based on existing tags + LATEST_TAG=$(git tag -l "0.1.*" --sort=-version:refname | head -n 1) + if [ -z "$LATEST_TAG" ]; then + VERSION="0.1.0" + else + # Extract patch version and increment + PATCH=$(echo $LATEST_TAG | sed 's/0\.1\.//') + NEW_PATCH=$((PATCH + 1)) + VERSION="0.1.$NEW_PATCH" + fi + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "Version to be tagged: $VERSION" + + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + name: nuget-packages + path: ./artifacts + + - name: Create and push tag + run: | + VERSION="${{ steps.version.outputs.version }}" + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git tag -a "$VERSION" -m "Release $VERSION" + git push origin "$VERSION" + + - name: Create GitHub Release + uses: softprops/action-gh-release@v1 with: - github-token: ${{ secrets.github_token }} - parallel-finished: true + tag_name: ${{ steps.version.outputs.version }} + name: Release ${{ steps.version.outputs.version }} + body: | + ## EnergyExemplar.EFCore.Duckdb.Extensions ${{ steps.version.outputs.version }} + + 🚀 **What's Changed** + - Latest updates and improvements + - Bug fixes and enhancements + + 📦 **Installation** + ```bash + git clone https://github.com/VikasAtEnEx/EnergyExemplar.EFCore.Duckdb.Extensions.git + cd EnergyExemplar.EFCore.Duckdb.Extensions + git checkout ${{ steps.version.outputs.version }} + ``` + + 🔧 **Build from source** + ```bash + dotnet build Source/EnergyExemplar.EFCore.Duckdb.Extensions.csproj --configuration Release + ``` + files: | + ./artifacts/*.nupkg + draft: false + prerelease: false + generate_release_notes: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index fbae829..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,86 +0,0 @@ -name: "Release" - -on: - push: - branches: - - main - paths: - - 'Source/**' - workflow_dispatch: - inputs: - version: - description: 'Version to tag (e.g., 0.1.0)' - required: true - default: '0.1.0' - -jobs: - release: - if: github.ref == 'refs/heads/main' - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Setup .NET Core SDK - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '8.0.x' - - - name: Restore dependencies - run: dotnet restore Source/EnergyExemplar.EFCore.Duckdb.Extensions.csproj - - - name: Build - run: dotnet build Source/EnergyExemplar.EFCore.Duckdb.Extensions.csproj --configuration Release --no-restore - - - name: Run tests - run: dotnet test Tests/Tests.csproj --configuration Release --verbosity normal - - - name: Determine version - id: version - run: | - if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then - VERSION="${{ github.event.inputs.version }}" - else - # Auto-increment version based on existing tags - LATEST_TAG=$(git tag -l "0.1.*" --sort=-version:refname | head -n 1) - if [ -z "$LATEST_TAG" ]; then - VERSION="0.1.0" - else - # Extract patch version and increment - PATCH=$(echo $LATEST_TAG | sed 's/0\.1\.//') - NEW_PATCH=$((PATCH + 1)) - VERSION="0.1.$NEW_PATCH" - fi - fi - echo "version=$VERSION" >> $GITHUB_OUTPUT - echo "Version to be tagged: $VERSION" - - - name: Create GitHub Release - uses: softprops/action-gh-release@v1 - with: - tag_name: ${{ steps.version.outputs.version }} - name: Release ${{ steps.version.outputs.version }} - body: | - ## EnergyExemplar.EFCore.Duckdb.Extensions ${{ steps.version.outputs.version }} - - 🚀 **What's Changed** - - Latest updates and improvements - - Bug fixes and enhancements - - 📦 **Installation** - ```bash - git clone https://github.com/VikasAtEnEx/EnergyExemplar.EFCore.Duckdb.Extensions.git - cd EnergyExemplar.EFCore.Duckdb.Extensions - git checkout ${{ steps.version.outputs.version }} - ``` - - 🔧 **Build from source** - ```bash - dotnet build Source/EnergyExemplar.EFCore.Duckdb.Extensions.csproj --configuration Release - ``` - draft: false - prerelease: false - generate_release_notes: true From 9e5355520c7facaddedf41e378ecd3978b6c76af Mon Sep 17 00:00:00 2001 From: Vikas Pachori Date: Wed, 16 Jul 2025 17:39:22 +0530 Subject: [PATCH 3/7] run on self --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8f79600..a178882 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ concurrency: jobs: build-and-test: name: Build and Test - runs-on: ubuntu-latest + runs-on: self-hosted timeout-minutes: 30 strategy: @@ -91,7 +91,7 @@ jobs: security-scan: name: Security Scan - runs-on: ubuntu-latest + runs-on: self-hosted needs: build-and-test steps: @@ -137,7 +137,7 @@ jobs: create-release: name: Create Release and Tag - runs-on: ubuntu-latest + runs-on: self-hosted needs: [build-and-test, security-scan] if: github.ref == 'refs/heads/main' && github.event_name == 'push' From e516de2c812e76e3dbec4f6e1a05b10792128929 Mon Sep 17 00:00:00 2001 From: Vikas Pachori Date: Wed, 16 Jul 2025 17:47:31 +0530 Subject: [PATCH 4/7] changes --- .github/workflows/build.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a178882..84fe195 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,6 +9,7 @@ on: env: DOTNET_VERSION: '8.0.x' + DOTNET_INSTALL_DIR: ${{ github.workspace }}/.dotnet # Cancel in-progress runs when new commits are pushed concurrency: @@ -34,6 +35,11 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: ${{ env.DOTNET_VERSION }} + dotnet-install-dir: ${{ env.DOTNET_INSTALL_DIR }} + + - name: Add .NET to PATH + run: echo "${{ env.DOTNET_INSTALL_DIR }}" >> $GITHUB_PATH + shell: bash - name: Cache dependencies uses: actions/cache@v4 @@ -102,6 +108,11 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: ${{ env.DOTNET_VERSION }} + dotnet-install-dir: ${{ env.DOTNET_INSTALL_DIR }} + + - name: Add .NET to PATH + run: echo "${{ env.DOTNET_INSTALL_DIR }}" >> $GITHUB_PATH + shell: bash - name: Restore dependencies run: dotnet restore --verbosity normal @@ -147,6 +158,16 @@ jobs: with: fetch-depth: 0 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + dotnet-install-dir: ${{ env.DOTNET_INSTALL_DIR }} + + - name: Add .NET to PATH + run: echo "${{ env.DOTNET_INSTALL_DIR }}" >> $GITHUB_PATH + shell: bash + - name: Determine version id: version run: | From 528a6b2664d8c0af3164c9a6d9ae8bb12bfff06c Mon Sep 17 00:00:00 2001 From: Vikas Pachori Date: Wed, 16 Jul 2025 17:58:48 +0530 Subject: [PATCH 5/7] kjk --- .github/workflows/build.yml | 42 +++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 84fe195..f5d735f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,7 @@ on: env: DOTNET_VERSION: '8.0.x' - DOTNET_INSTALL_DIR: ${{ github.workspace }}/.dotnet + DOTNET_INSTALL_DIR: 'D:\tools\.dotnet' # Cancel in-progress runs when new commits are pushed concurrency: @@ -38,8 +38,8 @@ jobs: dotnet-install-dir: ${{ env.DOTNET_INSTALL_DIR }} - name: Add .NET to PATH - run: echo "${{ env.DOTNET_INSTALL_DIR }}" >> $GITHUB_PATH - shell: bash + run: echo "${{ env.DOTNET_INSTALL_DIR }}" >> $env:GITHUB_PATH + shell: pwsh - name: Cache dependencies uses: actions/cache@v4 @@ -111,8 +111,8 @@ jobs: dotnet-install-dir: ${{ env.DOTNET_INSTALL_DIR }} - name: Add .NET to PATH - run: echo "${{ env.DOTNET_INSTALL_DIR }}" >> $GITHUB_PATH - shell: bash + run: echo "${{ env.DOTNET_INSTALL_DIR }}" >> $env:GITHUB_PATH + shell: pwsh - name: Restore dependencies run: dotnet restore --verbosity normal @@ -165,24 +165,25 @@ jobs: dotnet-install-dir: ${{ env.DOTNET_INSTALL_DIR }} - name: Add .NET to PATH - run: echo "${{ env.DOTNET_INSTALL_DIR }}" >> $GITHUB_PATH - shell: bash + run: echo "${{ env.DOTNET_INSTALL_DIR }}" >> $env:GITHUB_PATH + shell: pwsh - name: Determine version id: version + shell: pwsh run: | # Auto-increment version based on existing tags - LATEST_TAG=$(git tag -l "0.1.*" --sort=-version:refname | head -n 1) - if [ -z "$LATEST_TAG" ]; then - VERSION="0.1.0" - else + $latestTag = git tag -l "0.1.*" --sort=-version:refname | Select-Object -First 1 + if ([string]::IsNullOrEmpty($latestTag)) { + $version = "0.1.0" + } else { # Extract patch version and increment - PATCH=$(echo $LATEST_TAG | sed 's/0\.1\.//') - NEW_PATCH=$((PATCH + 1)) - VERSION="0.1.$NEW_PATCH" - fi - echo "version=$VERSION" >> $GITHUB_OUTPUT - echo "Version to be tagged: $VERSION" + $patch = $latestTag -replace '0\.1\.', '' + $newPatch = [int]$patch + 1 + $version = "0.1.$newPatch" + } + echo "version=$version" >> $env:GITHUB_OUTPUT + Write-Host "Version to be tagged: $version" - name: Download build artifacts uses: actions/download-artifact@v4 @@ -191,12 +192,13 @@ jobs: path: ./artifacts - name: Create and push tag + shell: pwsh run: | - VERSION="${{ steps.version.outputs.version }}" + $version = "${{ steps.version.outputs.version }}" git config --local user.email "action@github.com" git config --local user.name "GitHub Action" - git tag -a "$VERSION" -m "Release $VERSION" - git push origin "$VERSION" + git tag -a "$version" -m "Release $version" + git push origin "$version" - name: Create GitHub Release uses: softprops/action-gh-release@v1 From 857f0a0716671d9879b516575d91535ab97c57d1 Mon Sep 17 00:00:00 2001 From: Vikas Pachori Date: Wed, 16 Jul 2025 18:10:24 +0530 Subject: [PATCH 6/7] x --- .github/workflows/build.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f5d735f..57f50a7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ concurrency: jobs: build-and-test: name: Build and Test - runs-on: self-hosted + runs-on: [self-hosted, windows] timeout-minutes: 30 strategy: @@ -38,8 +38,8 @@ jobs: dotnet-install-dir: ${{ env.DOTNET_INSTALL_DIR }} - name: Add .NET to PATH - run: echo "${{ env.DOTNET_INSTALL_DIR }}" >> $env:GITHUB_PATH - shell: pwsh + run: Add-Content -Path $env:GITHUB_PATH -Value $env:DOTNET_INSTALL_DIR + shell: powershell - name: Cache dependencies uses: actions/cache@v4 @@ -97,7 +97,7 @@ jobs: security-scan: name: Security Scan - runs-on: self-hosted + runs-on: [self-hosted, windows] needs: build-and-test steps: @@ -111,8 +111,8 @@ jobs: dotnet-install-dir: ${{ env.DOTNET_INSTALL_DIR }} - name: Add .NET to PATH - run: echo "${{ env.DOTNET_INSTALL_DIR }}" >> $env:GITHUB_PATH - shell: pwsh + run: Add-Content -Path $env:GITHUB_PATH -Value $env:DOTNET_INSTALL_DIR + shell: powershell - name: Restore dependencies run: dotnet restore --verbosity normal @@ -148,7 +148,7 @@ jobs: create-release: name: Create Release and Tag - runs-on: self-hosted + runs-on: [self-hosted, windows] needs: [build-and-test, security-scan] if: github.ref == 'refs/heads/main' && github.event_name == 'push' @@ -165,12 +165,12 @@ jobs: dotnet-install-dir: ${{ env.DOTNET_INSTALL_DIR }} - name: Add .NET to PATH - run: echo "${{ env.DOTNET_INSTALL_DIR }}" >> $env:GITHUB_PATH - shell: pwsh + run: Add-Content -Path $env:GITHUB_PATH -Value $env:DOTNET_INSTALL_DIR + shell: powershell - name: Determine version id: version - shell: pwsh + shell: powershell run: | # Auto-increment version based on existing tags $latestTag = git tag -l "0.1.*" --sort=-version:refname | Select-Object -First 1 @@ -192,7 +192,7 @@ jobs: path: ./artifacts - name: Create and push tag - shell: pwsh + shell: powershell run: | $version = "${{ steps.version.outputs.version }}" git config --local user.email "action@github.com" From c9637260f00c8045775a24b23f6295686614f884 Mon Sep 17 00:00:00 2001 From: Vikas Pachori Date: Wed, 16 Jul 2025 18:15:55 +0530 Subject: [PATCH 7/7] dd --- .github/workflows/build.yml | 86 +++++++++++-------------------------- 1 file changed, 26 insertions(+), 60 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 57f50a7..d0b2c12 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,11 +5,9 @@ on: branches: [ main, develop ] pull_request: branches: [ main, develop ] - workflow_dispatch: env: DOTNET_VERSION: '8.0.x' - DOTNET_INSTALL_DIR: 'D:\tools\.dotnet' # Cancel in-progress runs when new commits are pushed concurrency: @@ -19,7 +17,7 @@ concurrency: jobs: build-and-test: name: Build and Test - runs-on: [self-hosted, windows] + runs-on: ubuntu-latest timeout-minutes: 30 strategy: @@ -35,11 +33,6 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: ${{ env.DOTNET_VERSION }} - dotnet-install-dir: ${{ env.DOTNET_INSTALL_DIR }} - - - name: Add .NET to PATH - run: Add-Content -Path $env:GITHUB_PATH -Value $env:DOTNET_INSTALL_DIR - shell: powershell - name: Cache dependencies uses: actions/cache@v4 @@ -54,9 +47,8 @@ jobs: working-directory: ./Source - name: Check code formatting - run: dotnet format EnergyExemplar.EFCore.Duckdb.Extensions.sln --verify-no-changes --verbosity diagnostic + run: dotnet format EnergyExemplar.EFCore.Duckdb.Extensions.sln --verify-no-changes working-directory: ./Source - continue-on-error: true - name: Build run: dotnet build --no-restore --configuration ${{ matrix.configuration }} @@ -66,11 +58,6 @@ jobs: run: dotnet test --no-build --verbosity normal --configuration ${{ matrix.configuration }} --collect:"XPlat Code Coverage" --results-directory ../coverage/${{ matrix.configuration }} working-directory: ./Tests - - name: Pack (Release only) - if: matrix.configuration == 'Release' - run: dotnet pack --no-build --configuration ${{ matrix.configuration }} --output ./artifacts - working-directory: ./Source - - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v4 if: matrix.configuration == 'Release' @@ -87,17 +74,9 @@ jobs: name: test-results-${{ matrix.configuration }} path: ./coverage/${{ matrix.configuration }}/ - - name: Upload build artifacts - uses: actions/upload-artifact@v4 - if: matrix.configuration == 'Release' - with: - name: nuget-packages - path: ./Source/artifacts/*.nupkg - retention-days: 30 - security-scan: name: Security Scan - runs-on: [self-hosted, windows] + runs-on: ubuntu-latest needs: build-and-test steps: @@ -108,11 +87,6 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: ${{ env.DOTNET_VERSION }} - dotnet-install-dir: ${{ env.DOTNET_INSTALL_DIR }} - - - name: Add .NET to PATH - run: Add-Content -Path $env:GITHUB_PATH -Value $env:DOTNET_INSTALL_DIR - shell: powershell - name: Restore dependencies run: dotnet restore --verbosity normal @@ -121,12 +95,10 @@ jobs: - name: Check for vulnerable packages run: dotnet list package --vulnerable working-directory: ./Source - continue-on-error: true - name: Check for outdated packages run: dotnet list package --outdated working-directory: ./Source - continue-on-error: true - name: Generate dependency report run: | @@ -148,7 +120,7 @@ jobs: create-release: name: Create Release and Tag - runs-on: [self-hosted, windows] + runs-on: ubuntu-latest needs: [build-and-test, security-scan] if: github.ref == 'refs/heads/main' && github.event_name == 'push' @@ -162,43 +134,37 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: ${{ env.DOTNET_VERSION }} - dotnet-install-dir: ${{ env.DOTNET_INSTALL_DIR }} - - - name: Add .NET to PATH - run: Add-Content -Path $env:GITHUB_PATH -Value $env:DOTNET_INSTALL_DIR - shell: powershell - name: Determine version id: version - shell: powershell run: | # Auto-increment version based on existing tags - $latestTag = git tag -l "0.1.*" --sort=-version:refname | Select-Object -First 1 - if ([string]::IsNullOrEmpty($latestTag)) { - $version = "0.1.0" - } else { + LATEST_TAG=$(git tag -l "0.1.*" --sort=-version:refname | head -n 1) + if [ -z "$LATEST_TAG" ]; then + VERSION="0.1.0" + else # Extract patch version and increment - $patch = $latestTag -replace '0\.1\.', '' - $newPatch = [int]$patch + 1 - $version = "0.1.$newPatch" - } - echo "version=$version" >> $env:GITHUB_OUTPUT - Write-Host "Version to be tagged: $version" - - - name: Download build artifacts - uses: actions/download-artifact@v4 - with: - name: nuget-packages - path: ./artifacts + PATCH=$(echo $LATEST_TAG | sed 's/0\.1\.//') + NEW_PATCH=$((PATCH + 1)) + VERSION="0.1.$NEW_PATCH" + fi + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "Version to be tagged: $VERSION" + + - name: Build and pack + run: | + dotnet restore + dotnet build --configuration Release --no-restore + dotnet pack --configuration Release --no-build --output ./artifacts + working-directory: ./Source - name: Create and push tag - shell: powershell run: | - $version = "${{ steps.version.outputs.version }}" + VERSION="${{ steps.version.outputs.version }}" git config --local user.email "action@github.com" git config --local user.name "GitHub Action" - git tag -a "$version" -m "Release $version" - git push origin "$version" + git tag -a "$VERSION" -m "Release $VERSION" + git push origin "$VERSION" - name: Create GitHub Release uses: softprops/action-gh-release@v1 @@ -224,7 +190,7 @@ jobs: dotnet build Source/EnergyExemplar.EFCore.Duckdb.Extensions.csproj --configuration Release ``` files: | - ./artifacts/*.nupkg + ./Source/artifacts/*.nupkg draft: false prerelease: false - generate_release_notes: true + generate_release_notes: true \ No newline at end of file