Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 121 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
root = true

[*]

# Change these settings to your own preference
indent_style = space
indent_size = 2

# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.cs]
charset = utf-8
indent_style = space
indent_size = 4

[*.{csproj,props}]
charset = utf-8
indent_style = space
indent_size = 2

[Dockerfile]
charset = utf-8
indent_style = space
indent_size = 4

[{appsettings.json,appsettings.*.json}]
charset = utf-8
indent_style = space
indent_size = 2

[*.cs]

# C# Standards
# CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
dotnet_diagnostic.CS1998.severity = none

# Nullable Reference Types
# CS8618: Non-nullable field is uninitialized. Consider declaring as nullable.
dotnet_diagnostic.CS8618.severity = error

# CS8604: Possible null reference argument.
dotnet_diagnostic.CS8604.severity = error

# CS8629: Nullable value type may be null.
dotnet_diagnostic.CS8629.severity = error

# CS8600: Converting null literal or possible null value to non-nullable type.
dotnet_diagnostic.CS8600.severity = error

# CS8603: Possible null reference return.
dotnet_diagnostic.CS8603.severity = error

# CS8610: Nullability of reference types in type of parameter doesn't match overridden member.
dotnet_diagnostic.CS8610.severity = error

# CS8625: Cannot convert null literal to non-nullable reference type.
dotnet_diagnostic.CS8625.severity = error

# CS8606: Possible null reference assignment to iteration variable
dotnet_diagnostic.CS8606.severity = error

# CS8602: Dereference of a possibly null reference.
dotnet_diagnostic.CS8602.severity = error

# CS8601: Possible null reference assignment.
dotnet_diagnostic.CS8601.severity = error

# CS8614: Nullability of reference types in type of parameter doesn't match implicitly implemented member.
dotnet_diagnostic.CS8614.severity = error

# CS8765: Nullability of type of parameter 'obj' doesn't match overridden member (possibly because of nullability attributes).
dotnet_diagnostic.CS8765.severity = error

# CS8619: Nullability of reference types in value of type 'GenericType<T?>' doesn't match target type 'GenericType<T>'.
dotnet_diagnostic.CS8619.severity = error

# =================
# Analyzer Rulesets
# =================

# Microsoft.CodeAnalysis.BannedApiAnalyzers
# RS0030: Banned API
dotnet_diagnostic.RS0030.severity = error

# Microsoft.VisualStudio.Threading.Analyzers
# VSTHRD100: Avoid async void methods
dotnet_diagnostic.VSTHRD100.severity = error

# VSTHRD101: Avoid unsupported async delegates
dotnet_diagnostic.VSTHRD101.severity = error

# VSTHRD110: Observe result of async calls
dotnet_diagnostic.VSTHRD110.severity = error

# VSTHRD003 Avoid awaiting foreign Tasks
dotnet_diagnostic.VSTHRD003.severity = none

# =================
# Format Rulesets
# =================

# IDE0005: Remove unnecessary imports
dotnet_diagnostic.IDE0005.severity = warning

# IDE0160: Convert to file-scoped namespace
csharp_style_namespace_declarations = file_scoped:warning

# =================
# Too Match Detail Rulesets
# =================

# CONSIDER: Are IDE0051 and IDE0052 too noisy to be warnings for IDE editing scenarios? Should they be made build-only warnings?
# IDE0051: Remove unused private member
dotnet_diagnostic.IDE0051.severity = warning

# IDE0052: Remove unread private member
dotnet_diagnostic.IDE0052.severity = warning
5 changes: 5 additions & 0 deletions .ghalint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
excludes:
- policy_name: action_ref_should_be_full_length_commit_sha
action_name: guitarrapc/actions/.github/actions/*
- policy_name: action_ref_should_be_full_length_commit_sha
action_name: guitarrapc/actions/.github/workflows/*
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
*.g4 text eol=lf
*.sh text eol=lf
*.yml text eol=lf
*.yaml text eol=lf
34 changes: 13 additions & 21 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,25 @@ name: dotnet-build
on:
push:
branches:
- "master"
- "main"
pull_request:
branches:
- "master"
- "main"

jobs:
build-dotnet:
runs-on: ubuntu-latest
permissions:
contents: read
runs-on: ubuntu-24.04
timeout-minutes: 15
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
NUGET_XMLDOC_MODE: skip
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
dotnet-version: 5.0.x
- uses: actions/setup-dotnet@v1
persist-credentials: false
- uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d # v5.0.0
with:
dotnet-version: 3.1.x
- run: dotnet build ./src/MySQLToCsharp.Parser/ -c Debug
- run: dotnet build ./src/MySQLToCsharp -c Debug
- run: dotnet test ./src/MySQLToCsharp.Tests/ -c Debug -p:CollectCoverage=true -p:CoverletOutputFormat=opencover --test-adapter-path:. --logger:"xunit;LogFilePath=results.xml"
- uses: codecov/codecov-action@v1
with:
file: ./src/MySQLToCsharp.Tests/coverage.net5.0.opencover.xml
flags: unittests
fail_ci_if_error: true
verbose: true
dotnet-version: |
8.0.x
- run: dotnet build -c Release
- run: dotnet test -c Release
- run: dotnet pack -c Release
107 changes: 42 additions & 65 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,87 +7,64 @@ on:

jobs:
build-dotnet:
runs-on: ubuntu-latest
permissions:
contents: read
runs-on: ubuntu-24.04
timeout-minutes: 15
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
NUGET_XMLDOC_MODE: skip
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
dotnet-version: 5.0.x
- uses: actions/setup-dotnet@v1
persist-credentials: false
- uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d # v5.0.0
with:
dotnet-version: 3.1.x
# tag
- run: echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
# build
- run: dotnet build ./src/MySQLToCsharp.Parser/ -c Release -p:Version=${{ env.GIT_TAG }}
- run: dotnet build ./src/MySQLToCsharp/ -c Release -p:Version=${{ env.GIT_TAG }}
# pack
- run: dotnet pack ./src/MySQLToCsharp/ -c Release -p:Version=${{ env.GIT_TAG }} -o ./pack
- uses: actions/upload-artifact@v2
dotnet-version: |
8.0.x
- run: dotnet build -c Release -p:Version=${{ github.ref_name }}
- run: dotnet pack -c Release -p:Version=${{ github.ref_name }} -o ./pack
- uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 # v2.3.1
with:
name: nuget
path: ./pack/
# publish
- run: dotnet publish ./src/MySQLToCsharp/ -c Release -o ./publish -f netcoreapp3.1 -r win-x64 -p:PublishSingleFile=true -p:Version=${{ env.GIT_TAG }}
- run: dotnet publish ./src/MySQLToCsharp/ -c Release -o ./publish -f netcoreapp3.1 -r linux-x64 -p:PublishSingleFile=true -p:Version=${{ env.GIT_TAG }}
- run: dotnet publish ./src/MySQLToCsharp/ -c Release -o ./publish -f netcoreapp3.1 -r osx-x64 -p:PublishSingleFile=true -p:Version=${{ env.GIT_TAG }}
- uses: actions/upload-artifact@v2
- run: dotnet publish ./src/MySQLToCsharp/ -c Release -o ./publish -f netcoreapp3.1 -r win-x64 -p:PublishSingleFile=true -p:Version=${{ github.ref_name }}
- run: dotnet publish ./src/MySQLToCsharp/ -c Release -o ./publish -f netcoreapp3.1 -r linux-x64 -p:PublishSingleFile=true -p:Version=${{ github.ref_name }}
- run: dotnet publish ./src/MySQLToCsharp/ -c Release -o ./publish -f netcoreapp3.1 -r osx-x64 -p:PublishSingleFile=true -p:Version=${{ github.ref_name }}
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: publish
path: ./publish/
retention-days: 1
if-no-files-found: error

create-release:
needs: [build-dotnet]
runs-on: ubuntu-latest
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
NUGET_XMLDOC_MODE: skip
permissions:
contents: write
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/setup-dotnet@v1
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
- uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d # v5.0.0
with:
dotnet-version: 5.0.x
- run: echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
dotnet-version: |
8.0.x
# Create Release
- uses: actions/create-release@v1
id: create_release
- name: Create Release
shell: bash
run: gh release create "${TAG}" --title "${TITLE}" --generate-notes --draft
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
prerelease: false
- uses: actions/download-artifact@v2
TAG: ${{ github.ref_name }}
TITLE: ${{ github.ref_name }}
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Release Asset (Windows)
run: gh release upload "${{ github.ref_name }}" MySQLToCsharp_win-x64_${{ github.ref_name }}.exe --clobber
working-directory: publish/
- name: Upload Release Asset (Linux)
run: gh release upload "${{ github.ref_name }}" MySQLToCsharp_linux-x64_${{ github.ref_name }} --clobber
working-directory: publish/
- name: Upload Release Asset (macOS)
run: gh release upload "${{ github.ref_name }}" MySQLToCsharp_osx-x64_${{ github.ref_name }} --clobber
working-directory: publish/
# upload nuget
- run: dotnet nuget push "./nuget/*.nupkg" --skip-duplicate -s https://www.nuget.org/api/v2/package -k ${{ secrets.NUGET_KEY }}
# upload release
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./publish/MySQLToCsharp_win-x64_${{ env.GIT_TAG }}.exe
asset_name: MySQLToCsharp_win-x64_${{ env.GIT_TAG }}.exe
asset_content_type: application/octet-stream
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./publish/MySQLToCsharp_linux-x64_${{ env.GIT_TAG }}
asset_name: MySQLToCsharp_linux-x64_${{ env.GIT_TAG }}
asset_content_type: application/octet-stream
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./publish/MySQLToCsharp_osx-x64_${{ env.GIT_TAG }}
asset_name: MySQLToCsharp_osx-x64_${{ env.GIT_TAG }}
asset_content_type: application/octet-stream
- run: dotnet nuget push "./nuget/*.nupkg" --skip-duplicate -k ${{ secrets.NUGET_KEY }}
Loading