Merge pull request #1168 from mandiant/package-update #2463
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test & Push | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
lint: | |
runs-on: windows-2019 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
# fetch all history for all branches | |
fetch-depth: 0 | |
- name: Run lint.py | |
run: python scripts/test/lint.py packages | |
- name: Run lint.ps1 | |
run: scripts/test/lint.ps1 | |
test_upload: | |
runs-on: ${{ matrix.os }} | |
needs: [lint] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-2019, windows-2022] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Get changed files | |
id: files | |
uses: Ana06/get-changed-files@25f79e676e7ea1868813e21465014798211fad8c # v2.3.0 | |
with: | |
filter: '*.nuspec' | |
- name: Build and test all modified packages | |
id: test | |
# It runs only if there are modified files | |
# We specifically test for "microsoft-windows-terminal.vm" in 'windows-2019' because it requires at least Windows 10 version 1903/OS build 18362 | |
if: steps.files.outputs.added_modified_renamed != '' | |
run: | | |
$os = "${{ matrix.os }}" | |
$packages = "${{ steps.files.outputs.added_modified_renamed }}".Split(" ") | Foreach-Object { (Get-Item $_).Directory.Name } | |
if ($os -eq 'windows-2019') { | |
$excludedPackages = @("microsoft-windows-terminal.vm") | |
$packages = $packages | Where-Object { $_ -notin $excludedPackages } | |
} | |
$packages = ("common.vm " + $packages -join " ").Trim() | |
scripts/test/test_install.ps1 "$packages" | |
- name: Upload logs to artifacts | |
uses: ./.github/actions/upload-logs | |
if: always() | |
- name: Push all built packages to MyGet | |
# Only push packages on master if they were built (not if testing was skipped) and | |
# only with one version of Windows (otherwise it would be pushed 3 times) | |
if: steps.test.outcome == 'success' && github.event_name == 'push' && matrix.os == 'windows-2022' | |
run: | | |
$built_pkgs = Get-ChildItem built_pkgs | |
Set-Location built_pkgs | |
foreach ($package in $built_pkgs) { | |
choco push -s "https://www.myget.org/F/vm-packages/api/v2" -k ${{ secrets.MYGET_TOKEN }} $package | |
} |