diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index e84218b..0000000 --- a/.drone.yml +++ /dev/null @@ -1,66 +0,0 @@ -kind: pipeline -type: docker -name: Pipeline - -trigger: - event: - include: - - push - - pull_request - - custom - -steps: - - - name: compile - image: mcr.microsoft.com/dotnet/sdk:8.0-alpine - environment: - CI_WORKSPACE: "/drone/src" - commands: - - dotnet build - volumes: - - name: dockersock - path: /var/run - - - name: test - image: quay.io/testcontainers/dind-drone-plugin - environment: - CI_WORKSPACE: "/drone/src" - settings: - build_image: mcr.microsoft.com/dotnet/sdk:8.0-alpine - cmd: - - dotnet test --no-build - volumes: - - name: dockersock - path: /var/run - depends_on: - - compile - - - name: Telegram notification - image: appleboy/drone-telegram - settings: - token: - from_secret: telegram_token - to: - from_secret: telegram_user_id - when: - status: - - success - - failure - depends_on: - - compile - - test - - docker build and push - - deploy to test - - deploy to prod - -services: - - name: docker - image: docker:dind - privileged: true - volumes: - - name: dockersock - path: /var/run - -volumes: - - name: dockersock - temp: { } diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100644 index 0000000..206379f --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,62 @@ +name: Build Vegasco Server +on: + workflow_run: + types: + - requested + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Install docker + uses: papodaca/install-docker-action@main + + - name: Install dependencies + run: apt update && apt install -y curl + + - name: Check out repository code + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build + run: dotnet build + + - name: Test + run: dotnet test + + ### Report via telegram + + - name: Get 8 characters of commit id + uses: bhowell2/github-substring-action@1.0.2 + id: commit-hash-short + if: ${{ always() }} + with: + value: ${{ gitea.event.commits[0].id }} + length_from_start: 8 + + - name: Clean commit message + uses: mad9000/actions-find-and-replace-string@3 + id: commit-message-clean + with: + source: ${{ gitea.event.commits[0].message }} + find: '\n' + replace: '' + + - name: Telegram notification + uses: appleboy/telegram-action@master + if: ${{ always() }} + env: + STATUS_ICON: ${{ job.status == 'success' && '✅' || job.status == 'failure' && '❌' || '❕' }} + with: + to: ${{ secrets.TELEGRAM_TO }} + token: ${{ secrets.TELEGRAM_TOKEN }} + format: markdown + message: | + ${{ env.STATUS_ICON }} Build #${{ gitea.run_number }} of `${{ gitea.repository }}`: ${{ job.status }} + + 📝 Commit by ${{ gitea.actor }} on `${{ gitea.ref_name }}`: + [${{ steps.commit-message-clean.outputs.value }} - ${{ steps.commit-hash-short.outputs.substring }}](${{ gitea.event.commits[0].url }}) + + 🌐 ${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/${{ gitea.run_number }} diff --git a/vegasco-server.sln b/vegasco-server.sln index 68690a8..f91c064 100644 --- a/vegasco-server.sln +++ b/vegasco-server.sln @@ -10,7 +10,6 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A16251C2-47DB-4017-812B-CA18B280E049}" ProjectSection(SolutionItems) = preProject README.md = README.md - .drone.yml = .drone.yml EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{437DE053-1DAB-4EEF-BEA6-E3B5179692F8}" @@ -21,6 +20,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApi.Tests.Integration", EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebApi.Tests.System", "tests\WebApi.Tests.System\WebApi.Tests.System.csproj", "{21418359-4A20-4F4A-B26C-A75A2B70AA10}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "gitea_workflows", "gitea_workflows", "{B149FCA4-4FA0-4987-A451-75782BB0BD02}" + ProjectSection(SolutionItems) = preProject + .gitea\workflows\build.yaml = .gitea\workflows\build.yaml + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -52,6 +56,7 @@ Global {5BA94D65-1D04-49EA-B7CC-F3719DE2D97E} = {437DE053-1DAB-4EEF-BEA6-E3B5179692F8} {0B1F3D81-95E8-4CFC-8A90-8A3CB2549326} = {437DE053-1DAB-4EEF-BEA6-E3B5179692F8} {21418359-4A20-4F4A-B26C-A75A2B70AA10} = {437DE053-1DAB-4EEF-BEA6-E3B5179692F8} + {B149FCA4-4FA0-4987-A451-75782BB0BD02} = {A16251C2-47DB-4017-812B-CA18B280E049} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {7813E32D-AE19-479C-853B-063882D2D05A}