Compare commits
16 Commits
69dd73a079
...
v0.1.2
Author | SHA1 | Date | |
---|---|---|---|
db45872908 | |||
8e0dcc34e7 | |||
015cdcb202 | |||
2841752870 | |||
8ffb220634 | |||
120374ebe1 | |||
55aa9f546a | |||
0974c1d7dd | |||
0e72287c6b | |||
3918425ef9 | |||
ec13a51575 | |||
b8626cb8ea | |||
281e9c686b | |||
df7674f063 | |||
c8dc8adb0d | |||
2d8bf648d9 |
132
.gitea/workflows/build.yaml
Normal file
132
.gitea/workflows/build.yaml
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
name: Gitea CI/CD
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches: [ "development", "main", "feature/*", "bugfix/*", "enhancement/*" ]
|
||||||
|
tags: [ "v*.*.*" ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ "development", "main" ]
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOTNET_VERSION: '8.0.x'
|
||||||
|
DOCKER_IMAGE_NAME: watcher-server
|
||||||
|
REGISTRY_URL: git.triggermeelmo.com
|
||||||
|
DOCKER_PLATFORMS: 'linux/amd64,linux/arm64'
|
||||||
|
TAG: ${{ github.ref == 'refs/heads/main' && 'latest' || github.ref == 'refs/heads/development' && 'development' || github.ref_type == 'tag' && github.ref_name || 'pr' }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
RUNNER_TOOL_CACHE: /toolcache # Runner Tool Cache
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup .NET SDK
|
||||||
|
uses: actions/setup-dotnet@v3
|
||||||
|
with:
|
||||||
|
dotnet-version: ${{ env.DOTNET_VERSION }}
|
||||||
|
|
||||||
|
- name: Restore dependencies
|
||||||
|
run: dotnet restore
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: dotnet build --configuration Release --no-restore
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: dotnet test --no-build --verbosity normal
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: Publish
|
||||||
|
run: dotnet publish -c Release -o out
|
||||||
|
|
||||||
|
set-tag:
|
||||||
|
name: Set Tag Name
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
RUNNER_TOOL_CACHE: /toolcache
|
||||||
|
outputs:
|
||||||
|
tag_name: ${{ steps.set_tag.outputs.tag_name }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Determine next semantic version tag
|
||||||
|
id: set_tag
|
||||||
|
run: |
|
||||||
|
git fetch --tags
|
||||||
|
|
||||||
|
# Find latest tag matching vX.Y.Z
|
||||||
|
latest_tag=$(git tag --list 'v*.*.*' --sort=-v:refname | head -n 1)
|
||||||
|
if [[ -z "$latest_tag" ]]; then
|
||||||
|
major=0
|
||||||
|
minor=0
|
||||||
|
patch=0
|
||||||
|
else
|
||||||
|
version="${latest_tag#v}"
|
||||||
|
IFS='.' read -r major minor patch <<< "$version"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${GITHUB_REF}" == "refs/heads/main" ]]; then
|
||||||
|
major=$((major + 1))
|
||||||
|
minor=0
|
||||||
|
patch=0
|
||||||
|
elif [[ "${GITHUB_REF}" == "refs/heads/development" ]]; then
|
||||||
|
minor=$((minor + 1))
|
||||||
|
patch=0
|
||||||
|
else
|
||||||
|
patch=$((patch + 1))
|
||||||
|
fi
|
||||||
|
|
||||||
|
new_tag="v${major}.${minor}.${patch}"
|
||||||
|
echo "tag_name=${new_tag}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
docker-build-and-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
RUNNER_TOOL_CACHE: /toolcache # Runner Tool Cache
|
||||||
|
needs: [build-and-test, set-tag]
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Login to Gitea Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY_URL}}
|
||||||
|
username: ${{ secrets.AUTOMATION_USERNAME }}
|
||||||
|
password: ${{ secrets.AUTOMATION_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Build and Push Multi-Arch Docker Image
|
||||||
|
run: |
|
||||||
|
docker buildx build \
|
||||||
|
--platform ${{ env.DOCKER_PLATFORMS }} \
|
||||||
|
-t ${{ env.REGISTRY_URL }}/watcher/${{ env.DOCKER_IMAGE_NAME }}:${{ needs.set-tag.outputs.tag_name }} \
|
||||||
|
--push .
|
||||||
|
|
||||||
|
tag:
|
||||||
|
name: Create Tag
|
||||||
|
needs: [docker-build, build, set-tag]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
RUNNER_TOOL_CACHE: /toolcache
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set up Git user
|
||||||
|
run: |
|
||||||
|
git config user.name "GitHub Actions"
|
||||||
|
git config user.email "actions@github.com"
|
||||||
|
|
||||||
|
- name: Create and push tag
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
git tag ${{ needs.set-tag.outputs.tag_name }}
|
||||||
|
git push origin ${{ needs.set-tag.outputs.tag_name }}
|
@@ -1,63 +0,0 @@
|
|||||||
name: Development Build
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- development
|
|
||||||
|
|
||||||
env:
|
|
||||||
DOTNET_VERSION: '8.0.x'
|
|
||||||
DOCKER_IMAGE_NAME: 'watcher-server'
|
|
||||||
REGISTRY_URL: 'git.triggermeelmo.com/watcher'
|
|
||||||
DOCKER_PLATFORMS: 'linux/amd64,linux/arm64'
|
|
||||||
RUNNER_TOOL_CACHE: /toolcache # Runner Tool Cache
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-and-test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Setup .NET SDK
|
|
||||||
uses: actions/setup-dotnet@v3
|
|
||||||
with:
|
|
||||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
|
||||||
|
|
||||||
- name: Restore dependencies
|
|
||||||
run: dotnet restore
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: dotnet build --configuration Release --no-restore
|
|
||||||
|
|
||||||
- name: Test
|
|
||||||
run: dotnet test --no-build --verbosity normal
|
|
||||||
continue-on-error: true
|
|
||||||
|
|
||||||
- name: Publish
|
|
||||||
run: dotnet publish -c Release -o out
|
|
||||||
|
|
||||||
docker-build-and-push:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: build-and-test
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Setup Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
|
|
||||||
- name: Login to Gitea Container Registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ${{ env.REGISTRY_URL}}
|
|
||||||
username: ${{ secrets.AUTOMATION_USERNAME }}
|
|
||||||
password: ${{ secrets.AUTOMATION_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Build and Push Multi-Arch Docker Image
|
|
||||||
run: |
|
|
||||||
docker buildx build \
|
|
||||||
--platform ${{ env.DOCKER_PLATFORMS }} \
|
|
||||||
-t ${{ env.REGISTRY_URL }}/${{ env.DOCKER_IMAGE_NAME }}:development \
|
|
||||||
-t ${{ env.REGISTRY_URL }}/${{ env.DOCKER_IMAGE_NAME }}:${{ github.sha }} \
|
|
||||||
--push .
|
|
@@ -1,62 +0,0 @@
|
|||||||
name: Release Build and Release
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
env:
|
|
||||||
DOTNET_VERSION: '8.0.x'
|
|
||||||
DOCKER_IMAGE_NAME: 'watcher-server'
|
|
||||||
REGISTRY_URL: 'git.triggermeelmo.com/watcher'
|
|
||||||
DOCKER_PLATFORMS: 'linux/amd64,linux/arm64'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-and-test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Setup .NET SDK
|
|
||||||
uses: actions/setup-dotnet@v3
|
|
||||||
with:
|
|
||||||
dotnet-version: ${{ env.DOTNET_VERSION }}
|
|
||||||
|
|
||||||
- name: Restore dependencies
|
|
||||||
run: dotnet restore
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: dotnet build --configuration Release --no-restore
|
|
||||||
|
|
||||||
- name: Test
|
|
||||||
run: dotnet test --no-build --verbosity normal
|
|
||||||
continue-on-error: true
|
|
||||||
|
|
||||||
- name: Publish
|
|
||||||
run: dotnet publish -c Release -o out
|
|
||||||
|
|
||||||
docker-build-and-push:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: build-and-test
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Setup Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
|
|
||||||
- name: Login to Gitea Container Registry
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
registry: git.triggermeelmo.com
|
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Build and Push Multi-Arch Docker Image
|
|
||||||
run: |
|
|
||||||
docker buildx build \
|
|
||||||
--platform ${{ env.DOCKER_PLATFORMS }} \
|
|
||||||
-t ${{ env.REGISTRY_URL }}/${{ env.DOCKER_IMAGE_NAME }}:v0.1.0 \
|
|
||||||
-t ${{ env.REGISTRY_URL }}/${{ env.DOCKER_IMAGE_NAME }}:${{ github.sha }} \
|
|
||||||
--push .
|
|
@@ -41,7 +41,6 @@ namespace Watcher.Controllers
|
|||||||
.Where(u => u.Username == preferredUserName)
|
.Where(u => u.Username == preferredUserName)
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
Console.WriteLine("Index" + _DashboardStore.NetworkStatus);
|
|
||||||
var viewModel = new DashboardViewModel
|
var viewModel = new DashboardViewModel
|
||||||
{
|
{
|
||||||
ActiveServers = await _context.Servers.CountAsync(s => s.IsOnline),
|
ActiveServers = await _context.Servers.CountAsync(s => s.IsOnline),
|
||||||
@@ -75,8 +74,6 @@ namespace Watcher.Controllers
|
|||||||
|
|
||||||
var now = DateTime.UtcNow;
|
var now = DateTime.UtcNow;
|
||||||
|
|
||||||
Console.WriteLine("DashboardStats" + _DashboardStore.NetworkStatus);
|
|
||||||
|
|
||||||
var model = new DashboardViewModel
|
var model = new DashboardViewModel
|
||||||
{
|
{
|
||||||
ActiveServers = await _context.Servers.CountAsync(s => s.IsOnline),
|
ActiveServers = await _context.Servers.CountAsync(s => s.IsOnline),
|
||||||
|
@@ -83,17 +83,17 @@
|
|||||||
|
|
||||||
@if (!Model.DatabaseStatus.IsNullOrEmpty())
|
@if (!Model.DatabaseStatus.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
@if (Model.DatabaseStatus == "$ok")
|
@if (Model.DatabaseStatus == "ok")
|
||||||
{
|
{
|
||||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||||
<span>Datenbank</span>
|
<span>Datenbank</span>
|
||||||
<span class="badge bg-success">OK</span>
|
<span class="badge bg-success">healthy</span>
|
||||||
</div>
|
</div>
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||||
<span>Datenbank</span>
|
<span>Datenbank</span>
|
||||||
<span class="badge bg-danger">Big Problem</span>
|
<span class="badge bg-danger">unhealthy</span>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
@@ -134,6 +134,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Services -->
|
<!-- Services -->
|
||||||
|
<!-- TODO
|
||||||
<div class="col-12 col-lg-6">
|
<div class="col-12 col-lg-6">
|
||||||
<div class="card shadow rounded-3 p-4 h-100">
|
<div class="card shadow rounded-3 p-4 h-100">
|
||||||
<h2 class="h5 fw-semibold mb-3">Services</h2>
|
<h2 class="h5 fw-semibold mb-3">Services</h2>
|
||||||
@@ -150,18 +151,20 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
-->
|
||||||
|
|
||||||
<!-- Server Liste -->
|
<!-- Server Liste -->
|
||||||
|
<!-- TODO
|
||||||
<div class="col-12 col-lg-6">
|
<div class="col-12 col-lg-6">
|
||||||
<div class="card shadow rounded-3 p-4 h-100">
|
<div class="card shadow rounded-3 p-4 h-100">
|
||||||
<h2 class="h5 fw-semibold mb-3">Server</h2>
|
<h2 class="h5 fw-semibold mb-3">Server</h2>
|
||||||
<ul class="list-group list-group-flush">
|
<ul class="list-group list-group-flush">
|
||||||
@foreach (var server in Model.Servers)
|
@foreach (Server server in Model.Servers)
|
||||||
{
|
{
|
||||||
<li class="list-group-item d-flex justify-content-between align-items-center serverlist">
|
<li class="list-group-item d-flex justify-content-between align-items-center serverlist">
|
||||||
<span>@server.Name</span>
|
<span>@server.Name</span>
|
||||||
<span class="badge bg-info" )">
|
<span class="badge bg-info" )">
|
||||||
CPU: 30.45%
|
CPU:
|
||||||
</span>
|
</span>
|
||||||
<span class="badge bg-info" )">
|
<span class="badge bg-info" )">
|
||||||
RAM: 65.09%
|
RAM: 65.09%
|
||||||
@@ -173,6 +176,7 @@
|
|||||||
}
|
}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
-->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user