Skip to content

Commit

Permalink
refactor: vital records .net monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
whichwit committed Jan 6, 2024
0 parents commit 92da584
Show file tree
Hide file tree
Showing 272 changed files with 199,943 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet
{
"name": "C# (.NET)",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/dotnet:0-6.0",
"features": {
"ghcr.io/devcontainers/features/dotnet:2": {},
"ghcr.io/devcontainers/features/github-cli:1": {},
"node": {
"version": "lts",
"nodeGypDependencies": true
},
"ghcr.io/devcontainers-contrib/features/go-task:1": {}
},

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [5000, 5001],
// "portsAttributes": {
// "5001": {
// "protocol": "https"
// }
// }

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "task post-container-create"

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "nuget"
directory: "/projects"
schedule:
interval: daily
51 changes: 51 additions & 0 deletions .github/workflows/canary-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Deploy reference Canary to Azure

on:
push:
branches: [main]
paths:
- 'projects/Canary/**'
release:
types: [published]
workflow_dispatch:
inputs:
deploy_level:
description: 'Deployment level'
required: true
default: latest
type: choice
options:
- latest
- release

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.CTENVSSCANARY_AZURE_CREDENTIALS }}
- name: Build and push LATEST container image
if: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.deploy_level == 'latest') }}
uses: azure/container-apps-deploy-action@v1
with:
appSourcePath: ${{ github.workspace }}
registryUrl: ctenvss20221223092705.azurecr.io
registryUsername: ${{ secrets.CTENVSSCANARY_REGISTRY_USERNAME }}
registryPassword: ${{ secrets.CTENVSSCANARY_REGISTRY_PASSWORD }}
containerAppName: nvss-canary-staging
resourceGroup: CTE_NVSS
imageToBuild: ctenvss20221223092705.azurecr.io/nvss-canary-staging:${{ github.sha }}
- name: Build and push RELEASE container image
if: ${{ github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.deploy_level == 'release') }}
uses: azure/container-apps-deploy-action@v1
with:
appSourcePath: ${{ github.workspace }}
registryUrl: ctenvss20221223092705.azurecr.io
registryUsername: ${{ secrets.CTENVSSCANARY_REGISTRY_USERNAME }}
registryPassword: ${{ secrets.CTENVSSCANARY_REGISTRY_PASSWORD }}
containerAppName: nvss-canary
resourceGroup: CTE_NVSS
imageToBuild: ctenvss20221223092705.azurecr.io/nvss-canary:${{ github.sha }}
27 changes: 27 additions & 0 deletions .github/workflows/canary-docker-latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Push to docker (latest)

on:
push:
branches: [ main ]
paths:
- 'projects/Canary/**'
workflow_dispatch:

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
with:
file: ./projects/Canary/Dockerfile
push: true
tags: mitre/canary:latest
25 changes: 25 additions & 0 deletions .github/workflows/canary-docker-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Push to docker (release)

on:
release:
types: [published]
workflow_dispatch:

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
with:
file: ./projects/Canary/Dockerfile
push: true
tags: mitre/canary:release-latest,mitre/canary:${{ github.event.release.tag_name }}
33 changes: 33 additions & 0 deletions .github/workflows/canary-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Canary Testing

on:
push:
branches: [ main ]
paths:
- 'projects/Canary/**'
- 'projects/Canary.Tests/**'
pull_request:
branches: [ main ]
workflow_dispatch:

jobs:
test:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
defaults:
run:
working-directory: ./projects

steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
- name: Run .NET tests
run: dotnet test Canary.Tests
- name: Run Node.js tests
working-directory: ./projects/Canary/ClientApp
run: npm run test
26 changes: 26 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Lint commit message

on:
pull_request:
types: [opened, synchronize, reopened, edited]
workflow_dispatch:

jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
- name: Install commitlint
run: |
npm install -g @commitlint/cli @commitlint/config-conventional
- name: Validate pull request title with commitlint
if: github.event_name == 'pull_request'
run: echo "${{ github.event.pull_request.title }}" | commitlint --verbose
- name: Validate pull request title with commitlint
if: github.event_name == 'workflow_dispatch'
run: gh pr view --json title -t "{{.title}}" | commitlint --verbose
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22 changes: 22 additions & 0 deletions .github/workflows/maintenance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Dependency maintenance

on:
pull_request:
types: [opened, synchronize, reopened, edited]

permissions:
pull-requests: write
actions: write

jobs:
dependabot-pr:
if: startsWith(github.event.pull_request.title, 'Bump ') && startsWith(github.event.pull_request.head.ref, 'dependabot/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TITLE=$(echo ${{github.event.pull_request.title}} | sed "s/Bump /chore: bump /")
gh pr edit ${{ github.event.pull_request.number}} --title "$TITLE"
gh workflow run lint-commit-message.yml --ref ${{ github.event.pull_request.head.ref }}
29 changes: 29 additions & 0 deletions .github/workflows/nuget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Publish project to NuGet
on:
push:
branches:
- main
workflow_dispatch:
jobs:
publish:
name: Publish to nuget
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./projects
strategy:
matrix:
proj: [VRDR, VRDR.Messaging, VRDR.Client, VitalRecord]
steps:
- uses: actions/checkout@v3
- name: Publish to NuGet
uses: alirezanet/[email protected]
with:
PROJECT_FILE_PATH: projects/${{ matrix.proj }}/${{ matrix.proj }}.csproj # Relative to repository root
# VERSION_FILE_PATH: Directory.Build.props # Filepath with version info, shared between all projects in this repo
VERSION_REGEX: <Version>(.*)<\/Version> # Regex pattern to extract version info in a capturing group
TAG_COMMIT: true # Tag the project when the version has changed
TAG_FORMAT: ${{ matrix.proj }}-* # Format of the git tag, [*] gets replaced with version
NUGET_KEY: ${{secrets.NUGET_API_KEY}} # nuget.org API key
PACKAGE_NAME: ${{ matrix.proj }}
INCLUDE_SYMBOLS: false
46 changes: 46 additions & 0 deletions .github/workflows/vrdr-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: VRDR Testing

on:
push:
branches:
- main
paths:
- 'projects/VRDR/**'
- 'projects/VRDR.CLI/**'
- 'projects/VRDR.Client/**'
- 'projects/VRDR.Filter/**'
- 'projects/VRDR.Messaging/**'
- 'projects/VRDR.Tests/**'
pull_request:
branches:
- main
paths:
- 'projects/VRDR/**'
- 'projects/VRDR.CLI/**'
- 'projects/VRDR.Client/**'
- 'projects/VRDR.Filter/**'
- 'projects/VRDR.Messaging/**'
- 'projects/VRDR.Tests/**'
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./projects
strategy:
matrix:
dotnet-version: [2.1.815, 3.1.408, 6.0.100]
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Install dependencies
run: dotnet restore vrdr-dotnet.sln
- name: Build
run: dotnet build vrdr-dotnet.sln --configuration Release --no-restore
- name: Test
run: ./VRDR.Tests/run_tests.sh
Loading

0 comments on commit 92da584

Please sign in to comment.