Compare commits

..
Author SHA1 Message Date
dependabot[bot] 54350c02db Bump semver, eslint-plugin-github and eslint-plugin-jest
Bumps [semver](https://github.com/npm/node-semver) to 6.3.1 and updates ancestor dependencies [semver](https://github.com/npm/node-semver), [eslint-plugin-github](https://github.com/github/eslint-plugin-github) and [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest). These dependencies need to be updated together.


Updates `semver` from 6.3.0 to 6.3.1
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/v6.3.1/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v6.3.0...v6.3.1)

Updates `semver` from 5.7.1 to 6.3.1
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/v6.3.1/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v6.3.0...v6.3.1)

Updates `semver` from 5.7.0 to 6.3.1
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/v6.3.1/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v6.3.0...v6.3.1)

Updates `eslint-plugin-github` from 2.0.0 to 4.8.0
- [Release notes](https://github.com/github/eslint-plugin-github/releases)
- [Commits](https://github.com/github/eslint-plugin-github/compare/v2.0.0...v4.8.0)

Updates `eslint-plugin-jest` from 22.21.0 to 27.2.2
- [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
- [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v22.21.0...v27.2.2)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: indirect
- dependency-name: semver
  dependency-type: indirect
- dependency-name: semver
  dependency-type: indirect
- dependency-name: eslint-plugin-github
  dependency-type: direct:development
- dependency-name: eslint-plugin-jest
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-11 02:45:39 +00:00
10 changed files with 6437 additions and 4979 deletions

No files matched your search

-11
View File
@@ -1,11 +0,0 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
groups:
github-actions:
patterns: ["*"]
schedule:
interval: "weekly"
cooldown:
default-days: 7
-30
View File
@@ -1,30 +0,0 @@
{
"problemMatcher": [
{
"owner": "msbuild",
"pattern": [
{
"regexp": "^\\s*(?:\\d+>\\s*)?([^\\s].*?)\\((\\d+)(?:,(\\d+))?(?:,\\d+)*\\)\\s*:\\s*(error|warning)\\s+([A-Za-z]+\\d+)\\s*:\\s*(.*?)(?:\\s+\\[(.+?)\\])?\\s*$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"code": 5,
"message": 6,
"fromPath": 7
}
]
},
{
"owner": "msbuild-no-location",
"pattern": [
{
"regexp": "^(?!.*\\().*\\b(error|warning)\\s+([A-Za-z]+\\d+)\\s*:\\s*(.*)$",
"severity": 1,
"code": 2,
"message": 3
}
]
}
]
}
+47 -57
View File
@@ -4,76 +4,66 @@ on:
branches:
- dev
paths-ignore:
- "*.md"
- '*.md'
push:
branches:
- dev
paths-ignore:
- "*.md"
- '*.md'
workflow_dispatch:
branches:
- dev
- arm64
- master
paths-ignore:
- '*.md'
jobs:
build:
strategy:
fail-fast: false
matrix:
runner:
- windows-latest
- windows-2025-vs2026
runs-on: ${{ matrix.runner }}
runs-on: windows-latest
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
- uses: actions/checkout@v2
- name: Setup MSBuild (vswhere-path)
id: setup_msbuild_explicit
uses: ./
with:
vswhere-path: C:\ProgramData\chocolatey\bin
- name: Setup MSBuild (vswhere-path)
id: setup_msbuild_explicit
uses: ./
with:
vswhere-path: C:\ProgramData\chocolatey\bin
- name: Setup MSBuild (PATH)
id: setup_msbuild_path
uses: ./
- name: Setup MSBuild (PATH)
id: setup_msbuild_path
uses: ./
- name: Setup MSBuild (fallback)
id: setup_msbuild_fallback
uses: ./
env:
PATH: ""
- name: Setup MSBuild (fallback)
id: setup_msbuild_fallback
uses: ./
env:
PATH: ''
- name: Setup MSBuild (x64)
if: runner.arch == 'X64'
id: setup_msbuild_path_x64
uses: ./
with:
vs-prerelease: true
msbuild-architecture: "x64"
- name: Setup MSBuild (x64)
if: always()
id: setup_msbuild_path_x64
uses: ./
with:
vs-prerelease: true
msbuild-architecture: 'x64'
- name: Setup MSBuild (arm64)
if: runner.arch == 'ARM64'
id: setup_msbuild_path_arm64
uses: ./
with:
vs-prerelease: true
msbuild-architecture: "arm64"
- name: Setup MSBuild (arm64)
if: always()
id: setup_msbuild_path_arm
uses: ./
with:
vs-prerelease: true
msbuild-architecture: 'arm64'
- name: Write MSBuild summary
if: always()
shell: pwsh
run: |
@"
## MSBuild setup summary
- name: echo msbuild path
run: |
echo "vswhere-path: ${{ steps.setup_msbuild_explicit.outputs.msbuildPath }}"
echo "PATH: ${{ steps.setup_msbuild_path.outputs.msbuildPath }}"
echo "ARM PATH: ${{ steps.setup_msbuild_path_arm.outputs.msbuildPath }}"
echo "ARM PATH: ${{ steps.setup_msbuild_path_x64.outputs.msbuildPath }}"
echo "Fallback: ${{ steps.setup_msbuild_fallback.outputs.msbuildPath }}"
- Runner label: `${{ matrix.runner }}`
- Runner architecture: `${{ runner.arch }}`
| Probe | msbuildPath |
| --- | --- |
| vswhere-path | ${{ steps.setup_msbuild_explicit.outputs.msbuildPath || 'N/A' }} |
| PATH | ${{ steps.setup_msbuild_path.outputs.msbuildPath || 'N/A' }} |
| Fallback | ${{ steps.setup_msbuild_fallback.outputs.msbuildPath || 'N/A' }} |
| x64 | ${{ steps.setup_msbuild_path_x64.outputs.msbuildPath || 'N/A' }} |
| arm64 | ${{ steps.setup_msbuild_path_arm64.outputs.msbuildPath || 'N/A' }} |
"@ | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append
- name: echo MSBuild
run: msbuild -version
- name: echo MSBuild
run: msbuild -version
+6 -24
View File
@@ -1,35 +1,27 @@
# microsoft/setup-msbuild
This action will help discover where the `MSBuild` tool is and automatically add it to the `PATH` environment variables for you so future steps in your Actions workflow can just initiate `msbuild` commands without knowing the full path.
> [!IMPORTANT]
> Please note this tool does NOT add other Visual Studio tools (like VSTest, cl, cmake, or others) to `PATH`
## Example Usage
```yml
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v3
uses: microsoft/setup-msbuild@v1.1
- name: Build app for release
run: msbuild src\YourProjectFile.csproj -t:rebuild -verbosity:diag -property:Configuration=Release
```
## Runners and included software
This action is intended to be used within the GitHub Actions workflows using the model of 'runners' either hosted (provided by GitHub) or self-hosted (provided by you). The version and parameters you specify below are going to be scoped to what software actually exists on the runner image being used. For example, hosted runner images from GitHub typically do NOT have pre-release versions of Visual Studio on them so using `vs-prerelease` parameter noted below may not have intended effect when using hosted runners. The software included for GitHub-hosted runner images can always be found here: <https://github.com/actions/runner-images> which also includes information on when/how software on hosted images gets updated.
## Optional Parameters
There are a few additional parameters that can be set if you need them. These are optional and should only be set if you know that you need them or what you are doing.
### Specifying specific versions of Visual Studio (optional)
You may have a situation where your Actions runner has multiple versions of Visual Studio and you need to find a specific version of the tool. Simply add the `vs-version` input to specify the range of versions to find. If looking for a specific version, specify the minimum and maximum versions as shown in the example below, which will look for just 16.4.
```yml
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v3
uses: microsoft/setup-msbuild@v1.1
with:
vs-version: '[16.4,16.5)'
```
@@ -37,48 +29,39 @@ You may have a situation where your Actions runner has multiple versions of Visu
The syntax is the same used for Visual Studio extensions, where square brackets like "[" mean inclusive, and parenthesis like "(" mean exclusive. A comma is always required, but eliding the minimum version looks for all older versions and eliding the maximum version looks for all newer versions. See the [vswhere wiki](https://github.com/microsoft/vswhere/wiki) for more details.
### Use pre-release versions of Visual Studio (optional)
If you need your Actions runner to target a pre-release version of Visual Studio, simply add the `vs-prerelease` input. This is necessary if you want to run an action on a virtual environment that contains a pre-release version of Visual Studio or self-hosted images that you may have that also have pre-release versions of Visual Studio installed.
```yml
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v3
uses: microsoft/setup-msbuild@v1.1
with:
vs-prerelease: true
```
### Specifying MSBuild architecture (optional)
By default the action will use the x86 architecture for MSBuild, but it is possible to target the x64 versions instead. Simply add the `msbuild-architecture` input. Valid input values are `x86` (default), `x64`, and `arm64`. Note that the success of these will rely on the runner OS.
```yml
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v3
uses: microsoft/setup-msbuild@v1.1
with:
msbuild-architecture: x64
```
## How does this work?
This makes use of the vswhere tool which is a tool delivered by Microsoft to help in identifying Visual Studio installs and various components. This tool is installed on the hosted Windows runners for GitHub Actions. If you are using a self-hosted runner, you either need to make sure vswhere.exe is in your agent's PATH or specify a full path to the location using:
```yml
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v3
uses: microsoft/setup-msbuild@v1.1
with:
vswhere-path: 'C:\path\to\your\tools\'
```
## Problem matcher
This action registers a [problem matcher](https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md) for MSBuild/csc-style `error`/`warning` output (for example `error MSB1234:` or `error CS1234:`). Once registered, matching lines in the build log are automatically surfaced as annotations in the GitHub Actions UI and, when applicable, as pull request check annotations.
## Notes on arguments
While the Action enables you to specify a `vswhere` path as well as a `vs-version`, these are more advanced options and when using GitHub-hosted runners you should not need these and is recommended you don't specify them as they are optional. Using these require you to fully understand the runner environment, updates to the tools on the runner, and can cause failures if you are out of sync. For GitHub-hosted runners, omitting these arguments is the preferred usage.
## Building this repo
As with most GitHub Actions, this requires NodeJS development tools. After installing NodeJS, you can build this by executing:
```bash
@@ -90,14 +73,13 @@ npm run pack
which will modify/create the /dist folder with the final index.js output
# Credits
Thank you to [Warren Buckley](https://github.com/warrenbuckley) for being a core contributor to this Action for the benefit of all developers!
# Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit <https://cla.opensource.microsoft.com>.
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
+10 -10
View File
@@ -1,27 +1,27 @@
name: "setup-msbuild"
description: "Helps set up MSBuild into PATH for later usage."
author: "Microsoft"
name: 'setup-msbuild'
description: 'Helps set up MSBuild into PATH for later usage.'
author: 'Microsoft'
branding:
color: purple
icon: terminal
inputs:
vswhere-path:
required: false
description: "Folder location of where vswhere.exe is located if a self-hosted agent"
description: 'Folder location of where vswhere.exe is located if a self-hosted agent'
vs-version:
description: "Version of Visual Studio to search; defaults to latest if not specified"
description: 'Version of Visual Studio to search; defaults to latest if not specified'
required: false
vs-prerelease:
description: "Enable searching for pre-release versions of Visual Studio/MSBuild"
description: 'Enable searching for pre-release versions of Visual Studio/MSBuild'
required: false
msbuild-architecture:
description: 'The preferred processor architecture of MSBuild. Can be either "x86", "x64", or "arm64". "x64" is only available from Visual Studio version 17.0 and later.'
required: false
default: "x86"
default: 'x86'
outputs:
msbuildPath:
description: "The resulting location of msbuild for your inputs"
description: 'The resulting location of msbuild for your inputs'
runs:
using: "node24"
main: "dist/index.js"
using: 'node16'
main: 'dist/index.js'
+3131 -3154
View File
File diff suppressed because it is too large. Load diff
+3237 -1577
View File
File diff suppressed because it is too large. Load diff
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "setup-msbuild",
"version": "3.0.0",
"version": "1.3.1",
"private": true,
"description": "Helps set up specific MSBuild tool into PATH for later usage.",
"main": "lib/main.js",
@@ -9,7 +9,7 @@
"format": "prettier --write **/*.ts",
"format-check": "prettier --check **/*.ts",
"lint": "eslint src/**/*.ts",
"pack": "ncc build lib/main.js -o dist",
"pack": "ncc build",
"test": "jest",
"all": "npm run build && npm run format && npm run lint && npm run pack"
},
@@ -36,10 +36,10 @@
"@types/jest": "^24.0.23",
"@types/node": "^12.12.25",
"@typescript-eslint/parser": "^2.8.0",
"@vercel/ncc": "^0.38.4",
"@zeit/ncc": "^0.20.5",
"eslint": "^5.16.0",
"eslint-plugin-github": "^2.0.0",
"eslint-plugin-jest": "^22.21.0",
"eslint-plugin-github": "^4.8.0",
"eslint-plugin-jest": "^27.2.2",
"jest": "^24.9.0",
"jest-circus": "^24.9.0",
"js-yaml": "^3.13.1",
@@ -47,4 +47,4 @@
"ts-jest": "^24.2.0",
"typescript": "^3.6.4"
}
}
}
-101
View File
@@ -1,101 +0,0 @@
import * as fs from 'fs'
import * as path from 'path'
interface ProblemMatcherPattern {
regexp: string
file?: number
line?: number
column?: number
severity?: number
code?: number
message?: number
fromPath?: number
}
interface ProblemMatcherOwner {
owner: string
pattern: ProblemMatcherPattern[]
}
interface ProblemMatcherFile {
problemMatcher: ProblemMatcherOwner[]
}
const matcherPath = path.join(__dirname, '..', '..', '.github', 'msbuild.json')
const matcherFile: ProblemMatcherFile = JSON.parse(
fs.readFileSync(matcherPath, 'utf8')
)
function findOwner(owner: string): ProblemMatcherOwner {
const found = matcherFile.problemMatcher.find(m => m.owner === owner)
if (!found) {
throw new Error(`No matcher owner named ${owner} found`)
}
return found
}
describe('msbuild problem matcher', () => {
it('is valid JSON with the expected owners', () => {
expect(matcherFile.problemMatcher.map(m => m.owner)).toEqual([
'msbuild',
'msbuild-no-location'
])
})
describe('msbuild owner (file-based diagnostics)', () => {
const regexp = new RegExp(findOwner('msbuild').pattern[0].regexp)
it('matches a csc-style error with file, line, column and project path', () => {
const line =
'Program.cs(10,5): error CS1002: ; expected [C:\\proj\\proj.csproj]'
const match = regexp.exec(line)
expect(match).not.toBeNull()
expect(match?.[1]).toBe('Program.cs')
expect(match?.[2]).toBe('10')
expect(match?.[3]).toBe('5')
expect(match?.[4]).toBe('error')
expect(match?.[5]).toBe('CS1002')
expect(match?.[6]).toBe('; expected')
expect(match?.[7]).toBe('C:\\proj\\proj.csproj')
})
it('matches an MSB-coded warning with file and line only', () => {
const line =
'C:\\proj\\proj.csproj(15,1): warning MSB3277: Found conflicts [C:\\proj\\proj.csproj]'
const match = regexp.exec(line)
expect(match).not.toBeNull()
expect(match?.[4]).toBe('warning')
expect(match?.[5]).toBe('MSB3277')
})
it('matches a diagnostic without a trailing project path', () => {
const line = 'Program.cs(3,1): error CS0246: The type or namespace name could not be found'
const match = regexp.exec(line)
expect(match).not.toBeNull()
expect(match?.[5]).toBe('CS0246')
expect(match?.[6]).toBe(
'The type or namespace name could not be found'
)
expect(match?.[7]).toBeUndefined()
})
})
describe('msbuild-no-location owner (engine-level diagnostics)', () => {
const regexp = new RegExp(findOwner('msbuild-no-location').pattern[0].regexp)
it('matches an MSBuild engine error with no file/line info', () => {
const line = 'MSBUILD : error MSB1009: Project file does not exist.'
const match = regexp.exec(line)
expect(match).not.toBeNull()
expect(match?.[1]).toBe('error')
expect(match?.[2]).toBe('MSB1009')
expect(match?.[3]).toBe('Project file does not exist.')
})
it('does not match lines already covered by the file-based owner', () => {
const line =
'Program.cs(10,5): error CS1002: ; expected [C:\\proj\\proj.csproj]'
expect(regexp.test(line)).toBe(false)
})
})
})
-9
View File
@@ -23,17 +23,8 @@ if (VS_VERSION !== 'latest') {
core.debug(`Execution arguments: ${VSWHERE_EXEC}`)
function registerProblemMatcher(): void {
const matcherPath = path.join(__dirname, '..', '.github', 'msbuild.json')
core.info(`##[add-matcher]${matcherPath}`)
}
async function run(): Promise<void> {
try {
// register the problem matcher so MSBuild/csc errors and warnings are
// annotated in the workflow log and any related pull request
registerProblemMatcher()
// exit if non Windows runner
if (IS_WINDOWS === false) {
core.setFailed('setup-msbuild can only be run on Windows runners')