diff --git a/.gitea/workflows/branch-build.yml b/.gitea/workflows/branch-build.yml new file mode 100644 index 0000000..cff33a4 --- /dev/null +++ b/.gitea/workflows/branch-build.yml @@ -0,0 +1,60 @@ +name: Branch Build + +on: + push: + branches: + - '**' + +env: + TZ: 'Europe/Berlin' + LANG: 'de' + CONFIGURATION: 'Debug' + CI_SERVER_HOST: ${{ gitea.server_url }} + +jobs: + build-test-deploy: + runs-on: ubuntu + steps: + - name: Checkout repository code + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Setup dotnet + uses: actions/setup-dotnet@v5 + with: + dotnet-version: 8.x + cache: false + + - name: Restore dependencies + run: | + set -ex + dotnet restore -v q + dotnet tool restore -v q + + - name: Setup tools + run: | + set -ex + dotnet tool install dotnet-reportgenerator-globaltool --tool-path /dotnet-tools + + - name: Build solution + shell: bash + run: | + set -ex + shopt -s globstar + mkdir /artifacts + dotnet build -c ${CONFIGURATION} --no-restore --nologo + mv ./**/*.nupkg /artifacts/ || true + mv ./**/*.snupkg /artifacts/ || true + + - name: Test solution + run: | + set -ex + dotnet test -c ${CONFIGURATION} --no-build --nologo /p:CoverletOutputFormat=Cobertura + /dotnet-tools/reportgenerator "-reports:${{ gitea.workspace }}/**/coverage.cobertura.xml" "-targetdir:/reports" "-reportType:TextSummary" + cat /reports/Summary.txt + + - name: Publish packages + run: | + set -ex + dotnet nuget push -k "${{ secrets.BAGET_APIKEY }}" -s https://nuget.am-wd.de/v3/index.json --skip-duplicate /artifacts/*.nupkg \ No newline at end of file diff --git a/.gitea/workflows/release-build.yml b/.gitea/workflows/release-build.yml new file mode 100644 index 0000000..c2bef32 --- /dev/null +++ b/.gitea/workflows/release-build.yml @@ -0,0 +1,78 @@ +name: Release Build + +on: + push: + tags: + - 'v*' + +env: + TZ: 'Europe/Berlin' + LANG: 'de' + CONFIGURATION: 'Release' + CI_SERVER_HOST: ${{ gitea.server_url }} + +jobs: + build-test-deploy: + runs-on: ubuntu + steps: + - name: Checkout repository code + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Setup dotnet + uses: actions/setup-dotnet@v5 + with: + dotnet-version: 8.x + cache: false + + - name: Restore dependencies + run: | + set -ex + dotnet restore -v q + dotnet tool restore -v q + + - name: Setup tools + run: | + set -ex + dotnet tool install dotnet-reportgenerator-globaltool --tool-path /dotnet-tools + dotnet tool install docfx --tool-path /dotnet-tools + + - name: Build solution + shell: bash + run: | + set -ex + shopt -s globstar + mkdir /artifacts + dotnet build -c ${CONFIGURATION} --no-restore --nologo + mv ./**/*.nupkg /artifacts/ || true + mv ./**/*.snupkg /artifacts/ || true + + - name: Test solution + run: | + set -ex + dotnet test -c ${CONFIGURATION} --no-build --nologo /p:CoverletOutputFormat=Cobertura + /dotnet-tools/reportgenerator "-reports:${{ gitea.workspace }}/**/coverage.cobertura.xml" "-targetdir:/reports" "-reportType:TextSummary" + + - name: Publish packages + run: | + set -ex + dotnet nuget push -k "${{ secrets.NUGET_APIKEY }}" -s https://api.nuget.org/v3/index.json --skip-duplicate /artifacts/*.nupkg + + - name: Publish documentation + env: + DOCFX_SOURCE_REPOSITORY_URL: 'https://github.com/AM-WD/AMWD.Protocols.Modbus' + run: | + set -ex + /dotnet-tools/docfx metadata docs/docfx.json + /dotnet-tools/docfx build docs/docfx.json + tar -C "${{ gitea.workspace }}/docs/_site" -czf "/artifacts/docs.tar.gz" . + curl -sSL --no-progress-meter --user "${{ secrets.DOCS_DEPLOY_USER }}:${{ secrets.DOCS_DEPLOY_PASS }}" -F docs=modbus -F dump=@/artifacts/docs.tar.gz "${{ vars.DOCS_DEPLOY_URL }}" + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: artifacts + path: | + /artifacts/* + /reports/Summary.txt \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 7f7e84e..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,157 +0,0 @@ -image: mcr.microsoft.com/dotnet/sdk:8.0 - -variables: - TZ: "Europe/Berlin" - LANG: "de" - -stages: - - build - - test - - deploy - - - -build-debug: - stage: build - tags: - - docker - - lnx - - 64bit - rules: - - if: $CI_COMMIT_TAG == null - script: - - shopt -s globstar - - mkdir ./artifacts - - dotnet build -c Debug --nologo - - mv ./**/*.nupkg ./artifacts/ - - mv ./**/*.snupkg ./artifacts/ - artifacts: - paths: - - artifacts/*.nupkg - - artifacts/*.snupkg - expire_in: 1 days - -test-debug: - stage: test - dependencies: - - build-debug - tags: - - docker - - lnx - - 64bit - rules: - - if: $CI_COMMIT_TAG == null - coverage: /Branch coverage[\s\S].+%/ - before_script: - - dotnet tool install dotnet-reportgenerator-globaltool --tool-path /dotnet-tools - script: - - dotnet test -c Debug --nologo /p:CoverletOutputFormat=Cobertura - - /dotnet-tools/reportgenerator "-reports:${CI_PROJECT_DIR}/**/coverage.cobertura.xml" "-targetdir:/reports" -reportType:TextSummary - after_script: - - cat /reports/Summary.txt - artifacts: - when: always - reports: - coverage_report: - coverage_format: cobertura - path: ./**/coverage.cobertura.xml - -deploy-debug: - stage: deploy - dependencies: - - build-debug - - test-debug - tags: - - docker - - lnx - - server - rules: - - if: $CI_COMMIT_TAG == null - script: - - dotnet nuget push -k $BAGET_APIKEY -s https://nuget.am-wd.de/v3/index.json --skip-duplicate artifacts/*.nupkg - - - -build-release: - stage: build - tags: - - docker - - lnx - - amd64 - rules: - - if: $CI_COMMIT_TAG != null - script: - - shopt -s globstar - - mkdir ./artifacts - - dotnet build -c Release --nologo - - mv ./**/*.nupkg ./artifacts/ - - mv ./**/*.snupkg ./artifacts/ - artifacts: - paths: - - artifacts/*.nupkg - - artifacts/*.snupkg - expire_in: 7 days - -test-release: - stage: test - dependencies: - - build-release - tags: - - docker - - lnx - - amd64 - rules: - - if: $CI_COMMIT_TAG != null - before_script: - - dotnet tool install dotnet-reportgenerator-globaltool --tool-path /dotnet-tools - script: - - dotnet test -c Release --nologo /p:CoverletOutputFormat=Cobertura - - /dotnet-tools/reportgenerator "-reports:${CI_PROJECT_DIR}/**/coverage.cobertura.xml" "-targetdir:/reports" -reportType:TextSummary - after_script: - - cat /reports/Summary.txt - artifacts: - when: always - reports: - coverage_report: - coverage_format: cobertura - path: ./**/coverage.cobertura.xml - -deploy-release: - stage: deploy - dependencies: - - build-release - - test-release - tags: - - docker - - lnx - - server - rules: - - if: $CI_COMMIT_TAG != null - script: - - dotnet nuget push -k $NUGET_APIKEY -s https://api.nuget.org/v3/index.json --skip-duplicate artifacts/*.nupkg - - - -publish-docs: - variables: - DOCFX_SOURCE_REPOSITORY_URL: "https://github.com/AM-WD/AMWD.Protocols.Modbus" - stage: deploy - tags: - - docker - - lnx - - server - rules: - - if: $CI_COMMIT_TAG != null - before_script: - - apt-get update - - apt-get -y install zip unzip - - dotnet tool install docfx --tool-path /dotnet-tools - script: - # Build the docs - - dotnet build -c Release --nologo - - /dotnet-tools/docfx metadata docs/docfx.json - - /dotnet-tools/docfx build docs/docfx.json - # Deploy the docs - - cd docs/_site - - zip -r ../docs.zip * - - curl --user "$DOCS_DEPLOY_USER:$DOCS_DEPLOY_PASS" -F docs=modbus -F dump=@../docs.zip "$DOCS_DEPLOY_URL" \ No newline at end of file diff --git a/AMWD.Protocols.Modbus.sln b/AMWD.Protocols.Modbus.sln index c993213..0f44d9d 100644 --- a/AMWD.Protocols.Modbus.sln +++ b/AMWD.Protocols.Modbus.sln @@ -25,7 +25,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "config", "config", "{2ED08B EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{C8065AE3-BA87-49AC-8100-C85D6DF7E436}" ProjectSection(SolutionItems) = preProject - .gitlab-ci.yml = .gitlab-ci.yml Directory.Build.props = Directory.Build.props EndProjectSection EndProject @@ -54,6 +53,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tool", "tool", "{3429CE19-2 tool\Directory.Build.props = tool\Directory.Build.props EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{42806262-7371-4239-AC04-33DC8E2596F1}" + ProjectSection(SolutionItems) = preProject + .gitea\workflows\branch-build.yml = .gitea\workflows\branch-build.yml + .gitea\workflows\release-build.yml = .gitea\workflows\release-build.yml + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -98,6 +103,7 @@ Global {D966826F-EE6C-4BC0-9185-C2A9A50FD586} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} {B0E53462-B0ED-4685-8AA5-948DC160EE27} = {3429CE19-211E-4AFA-9629-D7E1A360B7AC} {AC922E80-E9B6-493D-B1D1-752527E883ED} = {3429CE19-211E-4AFA-9629-D7E1A360B7AC} + {42806262-7371-4239-AC04-33DC8E2596F1} = {C8065AE3-BA87-49AC-8100-C85D6DF7E436} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {E4FD8EF0-3594-4994-BE80-5FADA5EE17B4} diff --git a/CHANGELOG.md b/CHANGELOG.md index 96312e1..4617088 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Reorganized folder structure to allow documentation generation. +- Migrated main repository from GitLab to Gitea. ## [v0.4.2] (2025-02-07) diff --git a/Directory.Build.props b/Directory.Build.props index e728983..0fcd59b 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -14,7 +14,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/README.md b/README.md index 981bf95..b700280 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,6 @@ Here you can find a basic implementation of the Modbus protocol. ![NuGet Version](https://shields.io/nuget/v/AMWD.Protocols.Modbus.Common?style=flat&logo=nuget) -![Test Coverage](https://git.am-wd.de/am-wd/amwd.protocols.modbus/badges/main/coverage.svg?style=flat) ## Overview @@ -37,8 +36,7 @@ It uses a specific TCP connection implementation and plugs all things from the C --- -Published under [MIT License] (see [choose a license]) -[![Buy me a Coffee](https://shields.io/badge/PayPal-Buy_me_a_Coffee-yellow?style=flat&logo=paypal)](https://link.am-wd.de/donate) +Published under [MIT License] (see [choose a license]) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 25297f9..a0922a1 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,6 +1,7 @@ netstandard2.0;net6.0;net8.0 + $(ContinuousIntegrationBuild) true false @@ -13,7 +14,6 @@ true true snupkg - false package-icon.png README.md @@ -23,13 +23,14 @@ ../../AMWD.Protocols.Modbus.snk - + true + true - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive