Skip to content

Commit

Permalink
chore: add gitlab action
Browse files Browse the repository at this point in the history
  • Loading branch information
doddgu committed Jan 19, 2023
1 parent 2932d1c commit 98fdcf8
Show file tree
Hide file tree
Showing 5 changed files with 191 additions and 2 deletions.
17 changes: 17 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Description

_Please explain the changes you've made_

## Issue reference

We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.

Please reference the issue this PR will close: #_[issue number]_

## Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

* [ ] Code compiles correctly
* [ ] Created/updated tests
* [ ] Extended the documentation
66 changes: 66 additions & 0 deletions .github/workflows/Codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Codecov
on:
push:
branches:
- 'main'
workflow_dispatch:

jobs:
test:
name: codecov
runs-on: ubuntu-latest

steps:
- name: git pull
uses: actions/checkout@v2

- name: run a one-line script
run: env

- name: Configure sysctl limits
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.11

- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v1
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner

- name: Install SonarCloud scanner
run: |
dotnet tool install --global dotnet-sonarscanner
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
dotnet-sonarscanner begin /k:"BlazorComponent_MASA.Blazor.Extensions" /o:"blazorcomponent" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
dotnet build /p:ContinuousIntegrationBuild=true
dotnet test --no-build --verbosity normal --collect "Code Coverage" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[*.Tests]*"
dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
- name: codecov
uses: codecov/codecov-action@v2
35 changes: 35 additions & 0 deletions .github/workflows/package_push_nuget.org.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Package Push Nuget
on:
release:
types: [published]
workflow_dispatch:

jobs:
package-build:
name: package build and push
runs-on: ubuntu-latest
steps:
- name: git pull
uses: actions/checkout@v2

- name: run a one-line script
run: env

- name: setting dotnet version
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
include-prerelease: true

- name: restore
run: dotnet restore

- name: build
run: dotnet build --no-restore /p:ContinuousIntegrationBuild=true

- name: pack
run: dotnet pack --include-symbols -p:PackageVersion=$GITHUB_REF_NAME

- name: package push
run: dotnet nuget push "**/*.symbols.nupkg" -k ${{secrets.NUGET_TOKEN}} -s https://api.nuget.org/v3/index.json

68 changes: 68 additions & 0 deletions .github/workflows/pr_run_test_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: PR_Run_Test_CI
on:
pull_request:
branches:
- 'main'
workflow_dispatch:

jobs:
test:
name: PR_Run_Test_CI
runs-on: ubuntu-latest

steps:
- name: git pull
uses: actions/checkout@v2

- name: run a one-line script
run: env

- name: setting dotnet version
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
include-prerelease: true

- name: Configure sysctl limits
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.11
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v1
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- name: Install SonarCloud scanner
run: |
dotnet tool install --global dotnet-sonarscanner
- name: Build and analyze for SonarCloud
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
if: ${{ env.SONAR_TOKEN != '' }}
run: |
dotnet-sonarscanner begin /k:"BlazorComponent_MASA.Blazor.Extensions" /o:"blazorcomponent" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
dotnet build /p:ContinuousIntegrationBuild=true
dotnet test --no-build --verbosity normal --collect "Code Coverage" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[*.Tests]*"
dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
- name: Build and analyze for Codecov
run: |
dotnet build /p:ContinuousIntegrationBuild=true
dotnet test --no-build --verbosity normal --collect "Code Coverage" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[*.Tests]*"
7 changes: 5 additions & 2 deletions Masa.Blazor.Extensions.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ VisualStudioVersion = 17.5.33209.295
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{51E6BF6E-CF63-4DF0-B048-C821E763BE5A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masa.Blazor.Extensions.Languages.Razor", "src\Languages\Masa.Blazor.Extensions.Languages.Razor\Masa.Blazor.Extensions.Languages.Razor.csproj", "{0728B33B-0A33-403B-9586-41CBD4F9DB13}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Blazor.Extensions.Languages.Razor", "src\Languages\Masa.Blazor.Extensions.Languages.Razor\Masa.Blazor.Extensions.Languages.Razor.csproj", "{0728B33B-0A33-403B-9586-41CBD4F9DB13}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Languages", "Languages", "{B641C478-8E7D-4E62-BF0B-8214724AA144}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -22,7 +24,8 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{0728B33B-0A33-403B-9586-41CBD4F9DB13} = {51E6BF6E-CF63-4DF0-B048-C821E763BE5A}
{0728B33B-0A33-403B-9586-41CBD4F9DB13} = {B641C478-8E7D-4E62-BF0B-8214724AA144}
{B641C478-8E7D-4E62-BF0B-8214724AA144} = {51E6BF6E-CF63-4DF0-B048-C821E763BE5A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {58081D66-840C-41BE-AC2C-4E5B92BAE7E5}
Expand Down

0 comments on commit 98fdcf8

Please sign in to comment.