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
118 changes: 47 additions & 71 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,71 +1,47 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
name: "CodeQL"

on:
push:
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
- cron: '0 4 * * 2'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['csharp']
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
name: "CodeQL"

on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '0 4 * * 2'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
security-events: write

strategy:
fail-fast: false
matrix:
language: ['csharp']

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x

- name: Build
run: dotnet build --configuration Release
working-directory: ./src/

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
68 changes: 41 additions & 27 deletions .github/workflows/dotnet-build.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,41 @@
name: .NET Core

on:
push:
pull_request:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1
- name: Install dependencies
run: dotnet restore
working-directory: ./src/
- name: Build
run: dotnet build --configuration Release --no-restore
working-directory: ./src/
- name: Test
run: dotnet test src --no-restore --verbosity normal

name: CI

on:
pull_request:
branches: [ main ]
push:
branches: [ main ]

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x

- name: Restore dependencies
run: dotnet restore
working-directory: ./src/

- name: Build
run: dotnet build --configuration Release --no-restore
working-directory: ./src/

- name: Run tests
run: dotnet test --configuration Release --no-build --verbosity normal --logger trx --results-directory "TestResults"
working-directory: ./src/

- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: src/TestResults
retention-days: 5

76 changes: 48 additions & 28 deletions .github/workflows/publish-nuget.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,48 @@
name: Publish Nuget

on:
push:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1
- name: Install dependencies
run: dotnet restore
working-directory: ./src/
- name: Build
run: dotnet build --configuration Release --no-restore
working-directory: ./src/
- name: Publish KnightwareCore
uses: brandedoutcast/publish-nuget@v2.5.5
with:
PROJECT_FILE_PATH: src/KnightwareCore/KnightwareCore.csproj
NUGET_KEY: ${{secrets.NUGET_API_KEY}}
name: Publish Nuget

on:
push:
tags:
- 'v*'

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Verify tag is on main branch
run: |
if ! git branch -r --contains ${{ github.ref }} | grep -q 'origin/main'; then
echo "Error: Tag must be on the main branch"
exit 1
fi
- name: Get version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Setup .NET Core
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0
- name: Install dependencies
run: dotnet restore
working-directory: ./src/
- name: Build
run: dotnet build --configuration Release --no-restore
working-directory: ./src/
- name: Pack
run: dotnet pack --configuration Release --no-build --output ./nupkg -p:PackageVersion=${{ steps.get_version.outputs.VERSION }}
working-directory: ./src/KnightwareCore/
- name: Publish to NuGet
run: dotnet nuget push ./nupkg/*.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json --skip-duplicate
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: Release v${{ steps.get_version.outputs.VERSION }}
files: ./src/KnightwareCore/nupkg/*.nupkg
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading
Loading