2026-01-19-nah9 #6
121
.gitea/workflows/ci.yaml
Normal file
121
.gitea/workflows/ci.yaml
Normal file
@@ -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, '-') }}
|
||||
Reference in New Issue
Block a user