From a6bae9dc80b23fd00b0b73e9eb11e6691a24ea6e Mon Sep 17 00:00:00 2001 From: Simon Diesenreiter Date: Wed, 27 Nov 2024 19:20:16 +0100 Subject: [PATCH] bugfixes --- .gitea/rename_project.sh | 4 ++++ .gitea/workflows/main.yml | 4 ---- .gitea/workflows/rename_project.yml | 2 +- .gitea/workflows/sonar.yml | 2 +- Containerfile | 2 +- Makefile | 21 ++++++++++++++------- README.md | 2 +- project_name/Program.cs | 2 +- 8 files changed, 23 insertions(+), 16 deletions(-) diff --git a/.gitea/rename_project.sh b/.gitea/rename_project.sh index b5ede16..022fc64 100755 --- a/.gitea/rename_project.sh +++ b/.gitea/rename_project.sh @@ -31,6 +31,10 @@ do done mv project_name $name +mv project_name.Tests $name.Tests +mv project_name.sln $name.sln +mv $name/project_name.csproj $name/$name.csproj +mv $name.Tests/project_name.Tests.csproj $name.Tests/$name.Tests.csproj # This command runs only once on GHA! rm -rf .gitea/template.yml diff --git a/.gitea/workflows/main.yml b/.gitea/workflows/main.yml index 41faa58..bffb70d 100644 --- a/.gitea/workflows/main.yml +++ b/.gitea/workflows/main.yml @@ -26,8 +26,6 @@ jobs: - uses: actions/setup-dotnet@v4 with: dotnet-version: ${{ matrix.dotnet-version }} - - name: Install project - run: make install - name: Run linter run: make lint @@ -44,8 +42,6 @@ jobs: - uses: actions/setup-dotnet@v4 with: dotnet-version: ${{ matrix.dotnet-version }} - - name: Install project - run: make install - name: Run tests run: make test diff --git a/.gitea/workflows/rename_project.yml b/.gitea/workflows/rename_project.yml index 43bd15a..dc1779a 100644 --- a/.gitea/workflows/rename_project.yml +++ b/.gitea/workflows/rename_project.yml @@ -16,7 +16,7 @@ jobs: fetch-depth: 0 ref: ${{ gitea.head_ref }} - - run: echo "REPOSITORY_NAME=$(echo "$GITHUB_REPOSITORY" | awk -F '/' '{print $2}' | tr '-' '_' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV + - run: echo "REPOSITORY_NAME=$(echo "$GITHUB_REPOSITORY" | awk -F '/' '{print $2}' | tr '-' '_')" >> $GITHUB_ENV shell: bash - run: echo "REPOSITORY_URLNAME=$(echo "$GITHUB_REPOSITORY" | awk -F '/' '{print $2}')" >> $GITHUB_ENV diff --git a/.gitea/workflows/sonar.yml b/.gitea/workflows/sonar.yml index 51bab5f..7f62db9 100644 --- a/.gitea/workflows/sonar.yml +++ b/.gitea/workflows/sonar.yml @@ -10,7 +10,7 @@ jobs: sonarqube: name: SonarQube Trigger runs-on: ubuntu-latest - if: ${{ !endsWith (github.repository, 'Templates/Dotnet_Executable') }} + if: ${{ !contains ('project_name', format('{0}_{1}', 'project', 'name')) }} steps: - name: Checking out uses: actions/checkout@v4 diff --git a/Containerfile b/Containerfile index a386e7d..21c0a2b 100644 --- a/Containerfile +++ b/Containerfile @@ -1,4 +1,4 @@ FROM mcr.microsoft.com/dotnet/runtime:9.0 -COPY . /app +COPY ./project_name/bin/Release/net9.0/ /app WORKDIR /app CMD ["project_name"] diff --git a/Makefile b/Makefile index 12c37c2..2797c77 100644 --- a/Makefile +++ b/Makefile @@ -5,16 +5,28 @@ help: ## Show the help. @echo "Targets:" @fgrep "##" Makefile | fgrep -v fgrep +.PHONY: buildrel +buildrel: ## Format code. + dotnet build -c Release project_name.sln + +.PHONY: build +build: ## Format code. + dotnet build project_name.sln + +.PHONY: publish +publish: ## Format code. + dotnet publish -c Release project_name.sln + .PHONY: fmt fmt: ## Format code. dotnet format project_name.sln .PHONY: lint -lint: ## Lint code. +lint: ## Lint code. dotnet format --verify-no-changes --verbosity diagnostic project_name.sln .PHONY: test -test: lint ## Run tests and generate coverage report. +test: ## Run tests and generate coverage report. dotnet test project_name.sln .PHONY: clean @@ -40,11 +52,6 @@ docs: ## Build the documentation. @$(ENV_PREFIX)mkdocs build URL="site/index.html"; xdg-open $$URL || sensible-browser $$URL || x-www-browser $$URL || gnome-open $$URL || open $$URL -.PHONY: init -init: ## Initialize the project based on an application template. - @./.gitea/init.sh - - # This project has been generated from rochacbruno/python-project-template # __author__ = 'rochacbruno' # __repo__ = https://github.com/rochacbruno/python-project-template diff --git a/README.md b/README.md index ce3040c..7980522 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ See also ### HOW TO USE THIS TEMPLATE 1. Create a new repository from this template and choose a name for your project - (e.g. `my_awesome_project` - recommendation is to use all lowercase and underscores separation for repo names.) + (e.g. `my_awesome_project` - recommendation is to use underscores separation for repo names.) 2. Wait until the first run of CI finishes (Gitea Actions will process the template and commit to your new repo) 3. Read the file [CONTRIBUTING.md](CONTRIBUTING.md) 4. Then clone your new project and happy coding! diff --git a/project_name/Program.cs b/project_name/Program.cs index ebe2ee9..2c9e48c 100644 --- a/project_name/Program.cs +++ b/project_name/Program.cs @@ -16,7 +16,7 @@ class Program if (o.Verbose) { Console.WriteLine($"Verbose output enabled. Current Arguments: -v {o.Verbose}"); - Console.WriteLine("Quick Start Example! App is in Verbose mode!"); + Console.WriteLine("Quick Start Example! App is in Verbose mode!"); } else {