From 0b237c6d1cd22bd0a9a6335d373ad067205f5a30 Mon Sep 17 00:00:00 2001 From: Nikolay Tatarinov Date: Mon, 19 Jan 2026 14:54:55 +0300 Subject: [PATCH] Enhance unit tests for Address, Domain, Nameserver, Section, Session, Subnetwork, Tag, Vlan, and Vrf models; implement mock classes for HTTP requests and cmdlet testing. --- .gitea/workflows/ci.yaml | 121 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 .gitea/workflows/ci.yaml diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml new file mode 100644 index 0000000..324120e --- /dev/null +++ b/.gitea/workflows/ci.yaml @@ -0,0 +1,121 @@ +name: CI/CD Pipeline + +on: + push: + branches: + - main + - master + - develop + tags: + - 'v*' + pull_request: + branches: + - main + - master + +jobs: + build: + name: Build and Test + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup .NET SDK + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: Restore dependencies + run: dotnet restore + + - name: Build class library + run: dotnet build classlib/classlib.csproj --configuration Release --no-restore + + - name: Build test project + run: dotnet build classlib.tests/classlib.tests.csproj --configuration Release --no-restore + + - name: Run tests + run: dotnet test classlib.tests/classlib.tests.csproj --configuration Release --no-build --verbosity normal --logger "trx;LogFileName=test-results.trx" --collect:"XPlat Code Coverage" + + - name: Upload test results + uses: actions/upload-artifact@v4 + if: always() + with: + name: test-results + path: classlib.tests/TestResults/ + retention-days: 30 + + package: + name: Package Module + runs-on: ubuntu-latest + needs: build + if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')) + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup .NET SDK + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: Build Release + run: dotnet build classlib/classlib.csproj --configuration Release + + - name: Create module package + run: | + mkdir -p output/ps.ipam + + # Copy compiled DLL + cp classlib/bin/Release/netstandard2.1/ps.ipam.dll output/ps.ipam/ + + # Copy module manifest and related files + cp ps.ipam.psd1 output/ps.ipam/ + cp ps.ipam.psm1 output/ps.ipam/ + cp LICENSE output/ps.ipam/ + cp README.md output/ps.ipam/ + + # Copy types directory + cp -r types output/ps.ipam/ + + # Copy functions directory + cp -r functions output/ps.ipam/ + + # Copy images directory + cp -r images output/ps.ipam/ + + - name: Upload module artifact + uses: actions/upload-artifact@v4 + with: + name: ps.ipam-module + path: output/ps.ipam/ + retention-days: 90 + + release: + name: Create Release + runs-on: ubuntu-latest + needs: package + if: startsWith(github.ref, 'refs/tags/v') + steps: + - name: Download module artifact + uses: actions/download-artifact@v4 + with: + name: ps.ipam-module + path: ps.ipam + + - name: Create release archive + run: | + zip -r ps.ipam-${{ github.ref_name }}.zip ps.ipam/ + tar -czvf ps.ipam-${{ github.ref_name }}.tar.gz ps.ipam/ + + - name: Create Gitea Release + uses: actions/gitea-release-action@v1 + with: + token: ${{ secrets.GITEA_TOKEN }} + files: | + ps.ipam-${{ github.ref_name }}.zip + ps.ipam-${{ github.ref_name }}.tar.gz + title: Release ${{ github.ref_name }} + draft: false + prerelease: ${{ contains(github.ref_name, '-') }}