Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Co-authored-by: Aasim Malladi <[email protected]>
Co-authored-by: Anton Kovalyov <[email protected]>
Co-authored-by: Jiahong Wen <[email protected]>
Co-authored-by: Edgar Ruiz <[email protected]>
Co-authored-by: Kevin Sigmund <[email protected]>
  • Loading branch information
5 people committed Jun 27, 2022
0 parents commit 09ed98e
Show file tree
Hide file tree
Showing 343 changed files with 24,162 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto

# Ensure shell scripts use LF line endings (linux only accepts LF)
*.sh eol=lf
*.ps1 eol=lf

###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp

###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary

###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary

###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# All PR reviews must be approved by one member of the sbom-pr-reviewers group.
* @microsoft/sbom-pr-reviewers
39 changes: 39 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# release-drafter automatically creates a draft release for you each time you complete a PR in the main branch.
# It uses GitHub labels to categorize changes (See categories) and draft the release.
# release-drafter also generates a version for your release based on GitHub labels. You can add a label of 'major',
# 'minor' or 'patch' to determine which number in the version to increment.
# You may need to add these labels yourself.
# See https://github.com/release-drafter/release-drafter
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
change-template: '- $TITLE by @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
no-changes-template: '- No changes'
categories:
- title: '📝 Documentation'
labels:
- 'type:docs'
- title: '🚀 New Features'
labels:
- 'type:feature'
- title: '🐛 Bug Fixes'
labels:
- 'type:bug'
- title: '🧰 Maintenance'
labels:
- 'type:ci'
- 'type:refactor'
version-resolver:
major:
labels:
- 'version:major'
minor:
labels:
- 'version:minor'
patch:
labels:
- 'version:patch'
default: patch
template: |
## ⚙️ Changes
$CHANGES
40 changes: 40 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build

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

jobs:
build:
name: Build
runs-on: windows-latest

env:
OFFICIAL_BUILD: 'True'
# Set the build number in MinVer.
MINVERBUILDMETADATA: build.${{github.run_number}}

steps:
- uses: actions/checkout@v3

# - uses: ./.github/workflows/setup-dotnet.yml
# with:
# platform_name: ${{ env.RUNNER_OS }}
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 3.1.300

- name: Verify files contain copyright header
run: .\scripts\verification\Verify-LicenceHeader.ps1 -Target .\src -LicenseHeaderPath .\scripts\verification\LicenseHeader.txt -Extensions *.xaml,*.xml,*.cs,*.ps1 -AddIfAbsent $false

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --no-restore

- name: Test
run: dotnet test --no-build --verbosity normal
70 changes: 70 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# 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.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
schedule:
- cron: '27 10 * * 1'

env:
CODEQL_BUILD: True

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

strategy:
fail-fast: false
matrix:
language: [ 'csharp' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

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

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
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.

# 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
# queries: security-extended,security-and-quality

- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 3.1.300

- name: dotnet restore
run: dotnet restore

- name: Build solution
run: dotnet build --no-restore

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
50 changes: 50 additions & 0 deletions .github/workflows/gen-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: 'Generate docs'

on:
push:
branches:
- main
paths:
- 'src/Microsoft.Sbom.Api/Config/Args/*.cs'
- 'src/Microsoft.Sbom.Common/Config/IConfiguration.cs'

jobs:
gen-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup .NET Core
uses: actions/setup-dotnet@v2
with:
dotnet-version: 3.1.300

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --no-restore

- name: Generate docs
run: |
# Run CLI
dotnet run -p src/Microsoft.Sbom.Tool generate -- -h 2> help.txt || true
cat <<EOF > docs/sbom-tool-arguments.md
# Sbom tool arguments
\`\`\`shell
dotnet run -p './src/Microsoft.Sbom.Tool' generate -- -h
\`\`\`
\`\`\`
$(tail --lines=+4 help.txt)
\`\`\`
EOF
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'Update docs'
file_pattern: '*.md'
20 changes: 20 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Release Drafter

on:
push:
branches:
- main
workflow_dispatch:

jobs:
update_release_draft:
permissions:
contents: write
pull-requests: read
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
with:
disable-autolabeler: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59 changes: 59 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Release

on:
release:
types:
- published

permissions:
contents: write
packages: write

jobs:
release:
runs-on: ubuntu-latest
environment: Production

strategy:
matrix:
rid: [win-x64, linux-x64, osx-x64]
env:
OFFICIAL_BUILD: 'True'
# Set the build number in MinVer.
MINVERBUILDMETADATA: build.${{github.run_number}}

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

# - uses: ./.github/workflows/setup-dotnet.yml
# with:
# platform_name: ${{ env.RUNNER_OS }}
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 3.1.x

- name: Restore dependencies
run: dotnet restore

- name: Build CLI cross-platform
run: dotnet publish --configuration Release -p:DebugType=None ./src/Microsoft.Sbom.Tool

- name: Build CLI self-contained
run: dotnet publish --configuration Release --output ./bin --self-contained --runtime ${{ matrix.rid }} -p:PublishSingleFile=true -p:DebugType=None -p:PublishTrimmed=true ./src/Microsoft.Sbom.Tool

- name: Publish CLI tool
uses: shogo82148/[email protected]
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./bin/*
asset_name: sbom-tool-${{ matrix.rid }}${{ matrix.rid == 'win-x64' && '.exe' || '' }}

- name: Build NuGet packages
run: dotnet pack --no-restore -p:DebugType=None --include-symbols --no-build --configuration Release --output ./out

- name: Publish NuGet packages to GitHub Packages
run: dotnet nuget push "./out/*.nupkg" --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/${{ github.repository_owner }}
17 changes: 17 additions & 0 deletions .github/workflows/setup-dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
on:
workflow_call:
inputs:
platform_name:
required: true
type: string

jobs:
setup_dotnet:

runs-on: ${{ inputs.platform_name }}

steps:
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 3.1.300
Loading

0 comments on commit 09ed98e

Please sign in to comment.