Skip to content

Commit

Permalink
Merge pull request #401 from microsoft/chbeck/ghcodespaces
Browse files Browse the repository at this point in the history
Upgraded infrastructure + onboard to GitHub Codespaces + upgraded dependencies
  • Loading branch information
CodeCyclone authored Nov 6, 2024
2 parents a369dc0 + 17f0f25 commit cf341f0
Show file tree
Hide file tree
Showing 39 changed files with 731 additions and 181 deletions.
13 changes: 13 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": 1,
"isRoot": true,
"tools": {
"nbgv": {
"version": "3.6.143",
"commands": [
"nbgv"
],
"rollForward": false
}
}
}
47 changes: 47 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "powerbi-powershell in Codespaces",
"image": "mcr.microsoft.com/dotnet/sdk:8.0",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/github-cli:1": {
"version": "2"
},
"ghcr.io/devcontainers/features/powershell:1": {
"version": "latest"
},
"ghcr.io/devcontainers/features/common-utils:2": {},
"ghcr.io/devcontainers/features/dotnet:2": {
"version": "none",
"dotnetRuntimeVersions": "7.0",
"aspNetCoreRuntimeVersions": "7.0"
}
},
"customizations": {
"vscode": {
"extensions": [
"GitHub.copilot",
"GitHub.copilot-chat",
"GitHub.vscode-github-actions",
"ms-dotnettools.vscode-dotnet-runtime",
"ms-dotnettools.csdevkit",
"ms-dotnetools.csharp",
"ms-vscode.powershell",
"ms-dotnettools.vscodeintellicode-csharp",
"esbenp.prettier-vscode",
"github.github-vscode-theme",
"github.vscode-pull-request-github",
"github.vscode-codeql",
"ms-cst-e.vscode-devskim"
]
}
},
"postCreateCommand": "dotnet restore dirs.proj",
"hostRequirements": {
"memory": "8gb",
"cpus": 4
},
"remoteEnv": {
"DOTNET_MULTILEVEL_LOOKUP": "0",
"TARGET": "net8.0"
}
}
30 changes: 30 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Upload Package to GitHub Packages

on:
release:
types: [created]

jobs:
deploy:
runs-on: [self-hosted, 1ES.Pool=powerbi-powershell-pool]
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Need for history to be able to determine version number

- uses: actions/setup-dotnet@v3
with:
#dotnet-version: '8.0.x' # SDK Version to use.
global-json-file: 'global.json'
source-url: https://nuget.pkg.github.com/microsoft/powerbi-powershell/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Create the package
run: dotnet pack --configuration Release dirs.proj

- name: Publish the package to GPR
run: dotnet nuget push PkgOut/*.nupkg
58 changes: 58 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: PR Build
run-name: Executing Build for ${{ github.actor }} on ${{ github.repository }} for branch ${{ github.ref }}

on:
pull_request:
types:
- opened
- synchronize
- reopened
branches:
- master

jobs:
Build:
runs-on: [self-hosted, 1ES.Pool=powerbi-powershell-pool]
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Need for history to be able to determine version number

- name: Disable StrongName
shell: pwsh
run: |
scripts/DisableStrongName.ps1
- name: Setup .NET 8.x
uses: actions/setup-dotnet@v3
with:
# Semantic version range syntax or exact version of a dotnet version
#dotnet-version: '8.x'
global-json-file: 'global.json'

- uses: actions/cache@v3
with:
path: ~/.nuget/packages
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.*proj','**/*.props','**/*.targets','**/*.cs') }}
restore-keys: |
${{ runner.os }}-nuget
- name: Restore dependencies
run: dotnet restore dirs.proj

- name: Build
run: dotnet build --no-restore dirs.proj --property:GenerateFullPaths=true --verbosity normal

- name: Test
run: dotnet test --no-build --no-restore --filter "TestCategory!=Interactive" --verbosity normal --logger trx --results-directory "TestResults" dirs.proj

- name: Publish Test Results
uses: actions/upload-artifact@v4
with:
name: TestResults
path: TestResults
if: ${{ always() }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -291,4 +291,7 @@ __pycache__/
*.binlog

# Package Build Output
PkgOut/
PkgOut/

# Mono\VSCode development
.mono/
17 changes: 17 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"recommendations": [
"ms-vscode.powershell",
"ms-dotnettools.csdevkit",
"ms-dotnettools.vscodeintellicode-csharp",
"GitHub.copilot",
"GitHub.copilot-chat",
"MS-CST-E.vscode-devskim",
"ms-sarifvscode.sarif-viewer",
"esbenp.prettier-vscode",
"github.codespaces",
"github.github-vscode-theme",
"github.vscode-pull-request-github",
"github.vscode-github-actions",
"github.vscode-codeql"
]
}
13 changes: 13 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
},
{
"type": "PowerShell",
"request": "attach",
"name": "PowerShell Attach to Host Process",
"processId": "${command:PickPSHostProcess}",
"runspaceId": 1
},
{
"type": "PowerShell",
"request": "launch",
"name": "PowerShell Interactive Session",
"cwd": "${workspaceRoot}"
}
,]
}
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"**/.vs/": true,
"**/bin/": true,
"**/obj/": true,
"TestResult/": true
"TestResult/": true,
".mono/": true,
"powerbi-powershell.sln": true
}
}
79 changes: 69 additions & 10 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
// https://code.visualstudio.com/docs/editor/variables-reference
// Example: https://github.com/PowerShell/vscode-powershell/blob/main/examples/.vscode/tasks.json
"version": "2.0.0",
"windows": {
"options": {
"shell": {
"executable": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
"executable": "C:\\Program Files\\PowerShell\\7\\pwsh.exe",
"args": [
"-NoProfile",
"-ExecutionPolicy",
Expand Down Expand Up @@ -38,12 +39,46 @@
},
"tasks": [
{
"label": "Build",
"label": "Build via dotnet",
"command": "dotnet",
"type": "process",
"group": {
"kind": "build",
"isDefault": true
},
"args": [
"build",
"${workspaceFolder}/dirs.proj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "Build (Release) via dotnet",
"command": "dotnet",
"type": "process",
"group": {
"kind": "build",
"isDefault": true
},
"args": [
"build",
"-c",
"Release",
"${workspaceFolder}/dirs.proj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "Build via Shell",
"type": "shell",
"command": "& '${workspaceFolder}\\scripts\\Build.ps1'",
"group": {
"kind": "build",
"isDefault": true
"isDefault": false
},
"problemMatcher": "$msCompile"
},
Expand All @@ -60,25 +95,49 @@
// }
// },
{
"label": "Clean",
"label": "Clean via Shell",
"type": "shell",
"command": "& '${workspaceFolder}\\scripts\\Build.ps1' -Clean -NoBuild",
"problemMatcher": "$msCompile"
},
{
"label": "Pack",
"label": "Clean via dotnet",
"command": "dotnet",
"type": "process",
"args": [
"clean",
"${workspaceFolder}/dirs.proj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "Pack via Shell",
"type": "shell",
"command": "& '${workspaceFolder}\\scripts\\Build.ps1' -Pack -Clean",
"problemMatcher": "$msCompile"
},
{
"label": "Restore",
"label": "Pack (release build) via dotnet",
"command": "dotnet",
"type": "process",
"args": [
"pack",
"${workspaceFolder}/dirs.proj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "Restore via Shell",
"type": "shell",
"command": "& '${workspaceFolder}\\scripts\\RestorePackages.ps1'",
"problemMatcher": "$msCompile"
},
{
"label": "Test",
"label": "Test via Shell",
"type": "shell",
"command": "& '${workspaceFolder}\\scripts\\Test.ps1'",
"group": "test",
Expand All @@ -89,7 +148,7 @@
}
},
{
"label": "PrepManualTesting",
"label": "PrepManualTesting via Shell",
"type": "shell",
"command": "& '${workspaceFolder}\\scripts\\PrepManualTesting.ps1' -Build -Force",
"problemMatcher": "$msCompile",
Expand All @@ -102,7 +161,7 @@
}
},
{
"label": "DebugTest",
"label": "DebugTest via Shell",
"type": "shell",
"command": "& '${workspaceFolder}\\scripts\\DebugTest.ps1' -TestName '${selectedText}' -DirectoryName '${fileDirname}'",
"problemMatcher": "$msCompile",
Expand All @@ -116,7 +175,7 @@
}
},
{
"label": "DebugTest (No Build)",
"label": "DebugTest (No Build) via Shell",
"type": "shell",
"command": "& '${workspaceFolder}\\scripts\\DebugTest.ps1' -TestName '${selectedText}' -DirectoryName '${fileDirname}' -NoBuild",
"problemMatcher": "$msCompile",
Expand Down
Loading

0 comments on commit cf341f0

Please sign in to comment.