Skip to content

Commit a13282d

Browse files
Initial import
0 parents  commit a13282d

File tree

11 files changed

+415
-0
lines changed

11 files changed

+415
-0
lines changed

.github/workflows/codeql.yml

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ "main" ]
17+
pull_request:
18+
branches: [ "main" ]
19+
schedule:
20+
- cron: '41 6 * * 6'
21+
22+
jobs:
23+
build:
24+
name: Roslyn Compiler Warnings
25+
runs-on: [self-hosted]
26+
env:
27+
# Required for actions/setup-dotnet@v3 on self-hosted runners where runners don't have sudo permissions
28+
DOTNET_INSTALL_DIR: "./.dotnet"
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@v4
32+
33+
# Install the .NET Core workload
34+
- name: Install .NET Core
35+
uses: actions/setup-dotnet@v3
36+
with:
37+
dotnet-version: 8.x.x
38+
39+
# Execute the build
40+
- name: Execute Build
41+
working-directory: ./src
42+
run: dotnet build --configuration Release
43+
test:
44+
name: Tests
45+
runs-on: [ self-hosted ]
46+
env:
47+
# Required for actions/setup-dotnet@v3 on self-hosted runners where runners don't have sudo permissions
48+
DOTNET_INSTALL_DIR: "./.dotnet"
49+
steps:
50+
- name: Checkout repository
51+
uses: actions/checkout@v4
52+
53+
# Install the .NET Core workload
54+
- name: Install .NET Core
55+
uses: actions/setup-dotnet@v3
56+
with:
57+
dotnet-version: 8.x.x
58+
59+
# Execute the tests
60+
- name: Execute Build
61+
working-directory: ./src
62+
run: dotnet test
63+
64+
code-ql:
65+
name: Analyze
66+
# Runner size impacts CodeQL analysis time. To learn more, please see:
67+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
68+
# - https://gh.io/supported-runners-and-hardware-resources
69+
# - https://gh.io/using-larger-runners
70+
# Consider using larger runners for possible analysis time improvements.
71+
runs-on: [self-hosted]
72+
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
73+
permissions:
74+
# required for all workflows
75+
security-events: write
76+
77+
# only required for workflows in private repositories
78+
actions: read
79+
contents: read
80+
81+
strategy:
82+
fail-fast: false
83+
matrix:
84+
language: [ 'csharp' ]
85+
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
86+
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
87+
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
88+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
89+
env:
90+
# Required for actions/setup-dotnet@v3 on self-hosted runners where runners don't have sudo permissions
91+
DOTNET_INSTALL_DIR: "./.dotnet"
92+
steps:
93+
- name: Checkout repository
94+
uses: actions/checkout@v4
95+
96+
# Initializes the CodeQL tools for scanning.
97+
- name: Initialize CodeQL
98+
uses: github/codeql-action/init@v3
99+
with:
100+
languages: ${{ matrix.language }}
101+
# If you wish to specify custom queries, you can do so here or in a config file.
102+
# By default, queries listed here will override any specified in a config file.
103+
# Prefix the list here with "+" to use these queries and those in the config file.
104+
105+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
106+
# queries: security-extended,security-and-quality
107+
108+
109+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
110+
# If this step fails, then you should remove it and run the build manually (see below)
111+
# - name: Autobuild
112+
# uses: github/codeql-action/autobuild@v3
113+
# Install the .NET Core workload
114+
- name: Install .NET Core
115+
uses: actions/setup-dotnet@v3
116+
with:
117+
dotnet-version: 8.x.x
118+
119+
# Execute the build
120+
- name: Execute Build
121+
working-directory: ./src
122+
run: dotnet build
123+
124+
# ℹ️ Command-line programs to run using the OS shell.
125+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
126+
127+
# If the Autobuild fails above, remove it and uncomment the following three lines.
128+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
129+
130+
# - run: |
131+
# echo "Run, Build Application using script"
132+
# ./location_of_script_within_repo/buildscript.sh
133+
134+
- name: Perform CodeQL Analysis
135+
uses: github/codeql-action/analyze@v3
136+
with:
137+
category: "/language:${{matrix.language}}"

.gitignore

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
## Ignore Visual Studio temporary files, build results, and
2+
## files generated by popular Visual Studio add-ons.
3+
4+
# User-specific files
5+
*.suo
6+
*.user
7+
*.sln.docstates
8+
9+
# Build results
10+
11+
[Dd]ebug/
12+
[Rr]elease/
13+
x64/
14+
[Bb]in/
15+
[Oo]bj/
16+
17+
# MSTest test Results
18+
[Tt]est[Rr]esult*/
19+
[Bb]uild[Ll]og.*
20+
21+
*_i.c
22+
*_p.c
23+
*_i.h
24+
*.ilk
25+
*.meta
26+
*.obj
27+
*.pch
28+
*.pdb
29+
*.pgc
30+
*.pgd
31+
*.rsp
32+
*.sbr
33+
*.tlb
34+
*.tli
35+
*.tlh
36+
*.tmp
37+
*.tmp_proj
38+
*.log
39+
*.vspscc
40+
*.vssscc
41+
.builds
42+
*.pidb
43+
*.log
44+
*.svclog
45+
*.scc
46+
47+
# Visual C++ cache files
48+
ipch/
49+
*.aps
50+
*.ncb
51+
*.opensdf
52+
*.sdf
53+
*.cachefile
54+
55+
# Visual Studio profiler
56+
*.psess
57+
*.vsp
58+
*.vspx
59+
60+
# Guidance Automation Toolkit
61+
*.gpState
62+
63+
# ReSharper is a .NET coding add-in
64+
_ReSharper*/
65+
*.[Rr]e[Ss]harper
66+
*.DotSettings.user
67+
68+
# Click-Once directory
69+
publish/
70+
71+
# Publish Web Output
72+
*.Publish.xml
73+
*.pubxml
74+
*.azurePubxml
75+
76+
# NuGet Packages Directory
77+
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
78+
packages/
79+
## TODO: If the tool you use requires repositories.config, also uncomment the next line
80+
!packages/repositories.config
81+
82+
# Windows Azure Build Output
83+
csx/
84+
*.build.csdef
85+
86+
# Windows Store app package directory
87+
AppPackages/
88+
89+
# Others
90+
sql/
91+
*.Cache
92+
ClientBin/
93+
[Ss]tyle[Cc]op.*
94+
![Ss]tyle[Cc]op.targets
95+
~$*
96+
*~
97+
*.dbmdl
98+
*.[Pp]ublish.xml
99+
100+
*.publishsettings
101+
102+
# RIA/Silverlight projects
103+
Generated_Code/
104+
105+
# Backup & report files from converting an old project file to a newer
106+
# Visual Studio version. Backup files are not needed, because we have git ;-)
107+
_UpgradeReport_Files/
108+
Backup*/
109+
UpgradeLog*.XML
110+
UpgradeLog*.htm
111+
112+
# SQL Server files
113+
App_Data/*.mdf
114+
App_Data/*.ldf
115+
116+
# =========================
117+
# Windows detritus
118+
# =========================
119+
120+
# Windows image file caches
121+
Thumbs.db
122+
ehthumbs.db
123+
124+
# Folder config file
125+
Desktop.ini
126+
127+
# Recycle Bin used on file shares
128+
$RECYCLE.BIN/
129+
130+
# Mac desktop service store files
131+
.DS_Store
132+
133+
_NCrunch*
134+
.idea
135+
136+
launchSettings.json

Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base
2+
USER $APP_UID
3+
WORKDIR /app
4+
5+
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
6+
ARG BUILD_CONFIGURATION=Release
7+
WORKDIR /src
8+
COPY ["Nullinside.Cicd.GitHub/Nullinside.Cicd.GitHub.csproj", "Nullinside.Cicd.GitHub/"]
9+
RUN dotnet restore "Nullinside.Cicd.GitHub/Nullinside.Cicd.GitHub.csproj"
10+
COPY . .
11+
WORKDIR "/src/Nullinside.Cicd.GitHub"
12+
RUN dotnet build "Nullinside.Cicd.GitHub.csproj" -c $BUILD_CONFIGURATION -o /app/build
13+
14+
FROM build AS publish
15+
ARG BUILD_CONFIGURATION=Release
16+
RUN dotnet publish "Nullinside.Cicd.GitHub.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
17+
18+
FROM base AS final
19+
WORKDIR /app
20+
COPY --from=publish /app/publish .
21+
ENTRYPOINT ["dotnet", "Nullinside.Cicd.GitHub.dll"]

Jenkinsfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
pipeline {
2+
agent any
3+
options {
4+
ansiColor('xterm')
5+
}
6+
7+
stages {
8+
stage('Checkout') {
9+
steps {
10+
git branch: env.BRANCH_NAME, credentialsId: 'GitHub PAT', url: 'https://github.com/nullinside-development-group/nullinside-cicd-github.git'
11+
}
12+
}
13+
14+
stage('Build & Deploy') {
15+
steps {
16+
withCredentials([
17+
usernamePassword(credentialsId: 'GitHub PAT', passwordVariable: 'GITHUB_PAT', usernameVariable: 'GITHUB_USERNAME'),
18+
]) {
19+
sh """
20+
bash go.sh
21+
"""
22+
}
23+
}
24+
}
25+
}
26+
27+
post {
28+
always {
29+
cleanWs cleanWhenFailure: false, notFailBuild: true
30+
}
31+
}
32+
}

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# nullinside-cicd-github
2+
3+
Handles automating chores for missing GitHub functionality or functionality that does existing but is put behind a pay wall for organizations only.

go.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
docker build -t nullinside-cicd-github:latest .
2+
docker container stop nullinside-cicd-github
3+
docker container prune -f
4+
docker run -d --name=nullinside-cicd-github -e GITHUB_PAT=$GITHUB_PAT --restart unless-stopped nullinside-cicd-github:latest

src/.dockerignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
**/.dockerignore
2+
**/.env
3+
**/.git
4+
**/.gitignore
5+
**/.project
6+
**/.settings
7+
**/.toolstarget
8+
**/.vs
9+
**/.vscode
10+
**/.idea
11+
**/*.*proj.user
12+
**/*.dbmdl
13+
**/*.jfm
14+
**/azds.yaml
15+
**/bin
16+
**/charts
17+
**/docker-compose*
18+
**/Dockerfile*
19+
**/node_modules
20+
**/npm-debug.log
21+
**/obj
22+
**/secrets.dev.yaml
23+
**/values.dev.yaml
24+
LICENSE
25+
README.md

src/Nullinside.Cicd.GitHub.sln

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nullinside.Cicd.GitHub", "Nullinside.Cicd.GitHub\Nullinside.Cicd.GitHub.csproj", "{94D9EEEF-B6C7-46AE-AB78-562D42E719A2}"
4+
EndProject
5+
Global
6+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
7+
Debug|Any CPU = Debug|Any CPU
8+
Release|Any CPU = Release|Any CPU
9+
EndGlobalSection
10+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
11+
{94D9EEEF-B6C7-46AE-AB78-562D42E719A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
12+
{94D9EEEF-B6C7-46AE-AB78-562D42E719A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
13+
{94D9EEEF-B6C7-46AE-AB78-562D42E719A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
14+
{94D9EEEF-B6C7-46AE-AB78-562D42E719A2}.Release|Any CPU.Build.0 = Release|Any CPU
15+
EndGlobalSection
16+
EndGlobal

0 commit comments

Comments
 (0)