diff options
| author | Adonais Romero Gonzalez <[email protected]> | 2022-09-26 16:04:27 -0700 |
|---|---|---|
| committer | Adonais Romero Gonzalez <[email protected]> | 2022-09-26 16:04:27 -0700 |
| commit | b6812b8d510dd8f23da7703506cb67cefc985533 (patch) | |
| tree | 83057821801d7f9a9c274834a973e9abd8c07aa0 /.github | |
| parent | 78a4097df51c69947516fff09abf1444eebe70c2 (diff) | |
| parent | 239361d9ab5c4b2098896f7a29451b99b71d9063 (diff) | |
Merge branch 'main' into develop
Diffstat (limited to '.github')
| -rw-r--r-- | .github/scripts/Build-ChangedProjects.ps1 | 34 | ||||
| -rw-r--r-- | .github/workflows/ci-pr.yml | 40 | ||||
| -rw-r--r-- | .github/workflows/ci.yml | 35 |
3 files changed, 109 insertions, 0 deletions
diff --git a/.github/scripts/Build-ChangedProjects.ps1 b/.github/scripts/Build-ChangedProjects.ps1 new file mode 100644 index 00000000..a13e3501 --- /dev/null +++ b/.github/scripts/Build-ChangedProjects.ps1 @@ -0,0 +1,34 @@ +param ( + [array]$ChangedFiles +) + +$root = (Get-Location).Path + +# To include in CI gate +$projectSet = @{} +foreach ($file in $ChangedFiles) +{ + if (-not (Test-Path $file)) { + Write-Output "`u{2754} Changed file $file cannot be found" + continue + } + $dir = (Get-Item $file).DirectoryName + while ((-not ($slnItems = (Get-ChildItem $dir '*.sln'))) -and ($dir -ne $root)) + { + $dir = (Get-Item $dir).Parent.FullName + } + if ($dir -eq $root) + { + Write-Output "`u{2754} Changed file $file does not match a project." + continue + } + $projectName = $dir.Replace($root, '').Trim('\').Replace('\', '.').ToLower() + Write-Output "`u{1F50E} Found project [$projectName] at $dir from changed file $file" + if (-not ($projectSet.ContainsKey($projectName))) + { + $projectSet[$projectName] = $dir + } +} + +.\Build-ProjectSet -ProjectSet $projectSet + diff --git a/.github/workflows/ci-pr.yml b/.github/workflows/ci-pr.yml new file mode 100644 index 00000000..12062b34 --- /dev/null +++ b/.github/workflows/ci-pr.yml @@ -0,0 +1,40 @@ +name: Build changes to driver samples +on: + pull_request: + branches: + - main + - develop + paths-ignore: + - '**.md' + - 'LICENSE' +jobs: + build: + strategy: + fail-fast: false + matrix: + configuration: [Debug, Release] + platform: [x64, arm64] + runs-on: windows-2019 + env: + Solution_Path: general\echo\kmdf\kmdfecho.sln + steps: + - name: Check out repository code + uses: actions/checkout@v3 + with: + submodules: 'recursive' + + - name: Add MSBuild to PATH + uses: microsoft/[email protected] + + - name: Get changed files + id: get-changed-files + uses: tj-actions/changed-files@v27 + + - name: Retrieve and build solutions from changed files + id: build-changed-projects + run: | + $changedFiles = "${{ steps.get-changed-files.outputs.all_changed_files }}".Split(' ') + .\.github\scripts\Build-ChangedProjects.ps1 -ChangedFiles $changedFiles + env: + Configuration: ${{ matrix.configuration }} + Platform: ${{ matrix.platform }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..68b46552 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,35 @@ +name: Build all driver samples +on: + push: + branches: + - main + - develop + paths-ignore: + - '**.md' + - 'LICENSE' +jobs: + build: + strategy: + fail-fast: false + matrix: + configuration: [Debug, Release] + platform: [x64, arm64] + runs-on: windows-2019 + env: + Solution_Path: general\echo\kmdf\kmdfecho.sln + steps: + - name: Check out repository code + uses: actions/checkout@v3 + with: + submodules: 'recursive' + + - name: Add MSBuild to PATH + uses: microsoft/[email protected] + + - name: Retrieve and build all available solutions + id: build-all-projects + run: | + .\Build-AllProjects.ps1 + env: + Configuration: ${{ matrix.configuration }} + Platform: ${{ matrix.platform }} |
