Skip to content

Commit dce25e9

Browse files
committed
Initial commit
1 parent 2be75ee commit dce25e9

File tree

13 files changed

+1526
-2
lines changed

13 files changed

+1526
-2
lines changed
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# Workflow to build and release OcrInspector for production
2+
name: OCR Inspector Production
3+
4+
# Permissions for the workflow
5+
permissions:
6+
contents: write
7+
8+
# Trigger workflow on push to the main branch
9+
on:
10+
push:
11+
branches:
12+
- main
13+
14+
# Set environment variables
15+
env:
16+
artifactStagingDirectory: ${{ github.workspace }}/artifact_staging
17+
artifactType: 'Production'
18+
binariesDirectory: ${{ github.workspace }}/binaries
19+
buildConfiguration: 'Release'
20+
buildPlatform: 'any cpu'
21+
projectName: UiaXpathTester
22+
23+
# Default settings for all run steps
24+
defaults:
25+
run:
26+
working-directory: src
27+
28+
# Define jobs for the workflow
29+
jobs:
30+
# Job to get the version of the build
31+
new-version:
32+
name: New Version
33+
runs-on: windows-latest
34+
35+
# Outputs of the job
36+
outputs:
37+
buildVersion: ${{ steps.parse-version.outputs.version }}
38+
validVersion: ${{ steps.validate-version.outputs.valid }}
39+
40+
steps:
41+
# Step to checkout the repository
42+
- name: Checkout repository
43+
uses: actions/checkout@v4
44+
45+
# Step to parse the build version for GitHub tag
46+
- name: Parse Build Version for GitHub Tag
47+
id: parse-version
48+
shell: pwsh
49+
run: echo "version=$(Get-Date -UFormat '%Y.%m.%d').${{ github.run_number }}" >> $env:GITHUB_OUTPUT
50+
51+
# Step to validate the parsed version
52+
- name: Validate Version ${{ steps.parse-version.outputs.version }}
53+
id: validate-version
54+
shell: pwsh
55+
run: |
56+
$version = "${{ steps.parse-version.outputs.version }}"
57+
echo "valid=$($version -match '^\d+(\.\d+){3}$')" >> $env:GITHUB_OUTPUT
58+
59+
# Job to build and publish the project
60+
build:
61+
name: Build & Publish Version ${{ needs.new-version.outputs.buildVersion }}
62+
runs-on: windows-latest
63+
needs: new-version
64+
if: ${{ needs.new-version.result == 'success' && needs.new-version.outputs.validVersion == 'True' }}
65+
66+
# Outputs of the job
67+
outputs:
68+
buildVersion: ${{ needs.new-version.outputs.buildVersion }}
69+
70+
# Set environment variables specific to the build job
71+
env:
72+
buildVersion: ${{ needs.new-version.outputs.buildVersion }}
73+
74+
steps:
75+
# Step to checkout the repository
76+
- name: Checkout repository
77+
uses: actions/checkout@v4
78+
79+
# Step to setup .NET Core SDK
80+
- name: Setup .NET Core SDK
81+
uses: actions/setup-dotnet@v4
82+
with:
83+
dotnet-version: 8
84+
85+
# Step to restore packages
86+
- name: Restore Packages
87+
shell: pwsh
88+
run: dotnet restore
89+
90+
# Step to publish the project
91+
- name: Publish
92+
shell: pwsh
93+
run: dotnet publish -c Release --self-contained -r win-x64
94+
95+
# Step to create a build artifact
96+
- name: Create Build Artifact
97+
shell: pwsh
98+
run: |
99+
New-Item -Path "${{ env.artifactStagingDirectory }}" -ItemType Directory
100+
Compress-Archive `
101+
-Path ${{ env.projectName }}/bin/Release/net8.0-windows/win-x64./publish/* `
102+
-DestinationPath ${{ env.artifactStagingDirectory }}/${{ env.projectName }}.${{ env.buildVersion }}-win-x64.zip
103+
104+
# Step to upload the build artifact
105+
- name: Upload a Build Artifact
106+
uses: actions/upload-artifact@v4
107+
with:
108+
name: drop
109+
path: ${{ env.artifactStagingDirectory }}/*.zip
110+
111+
# Job to create a GitHub release and tag the new version
112+
create-release:
113+
name: New GitHub Release Version ${{ needs.new-version.outputs.buildVersion }}
114+
runs-on: windows-latest
115+
needs:
116+
- new-version
117+
- build
118+
if: success()
119+
120+
# Set environment variables specific to the release job
121+
env:
122+
buildVersion: ${{ needs.new-version.outputs.buildVersion }}
123+
124+
steps:
125+
# Step to checkout the repository
126+
- name: Checkout repository
127+
uses: actions/checkout@v4
128+
129+
# Step to download build artifacts
130+
- name: Download Build Artifacts
131+
uses: actions/download-artifact@v4
132+
with:
133+
name: drop
134+
135+
# Step to create a GitHub release and tag
136+
- name: Create GitHub Release & Tag v${{ env.buildVersion }}
137+
uses: softprops/action-gh-release@v2
138+
with:
139+
files: ./${{ env.projectName }}.${{ env.buildVersion }}-win-x64.zip
140+
tag_name: v${{ env.buildVersion }}
141+
name: ${{ env.artifactType }} v${{ env.buildVersion }}
142+
generate_release_notes: true
143+
env:
144+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024 g4-api
3+
Copyright (c) 2023 gravity-api
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,62 @@
1-
# uia-xpath-tester
1+
# UIA XPath Tester v1.0
2+
3+
[![Build & Release](https://github.com/g4-api/uia-xpath-tester/actions/workflows/GithubActions.yml/badge.svg?branch=main)](https://github.com/g4-api/uia-xpath-tester/actions/workflows/GithubActions.yml)
4+
5+
## Overview
6+
7+
The UIA XPath Tester is a simple WPF application designed to assist users in testing UI Automation (UIA) XPath expressions. With this tool, you can input XPath expressions, initiate tests, and view the results.
8+
9+
## Features
10+
11+
- **XPath Testing:** Input your UIA XPath expressions for testing.
12+
- **Test Button:** Click the "▶ _Test" button to initiate the test operation.
13+
- **Result Display:** View the results in a DataGrid (hidden by default).
14+
- **Status Feedback:** The application provides status feedback through a labeled area.
15+
16+
## Getting Started
17+
18+
Follow these steps to use the UIA XPath Tester:
19+
20+
1. **Clone the Repository:**
21+
```
22+
git clone https://github.com/your-username/UIAXpathTester.git
23+
```
24+
25+
2. **Open in Visual Studio:**
26+
- Open the solution file (`UIAXpathTester.sln`) in Visual Studio.
27+
28+
3. **Build the Solution:**
29+
- Build the solution to ensure all dependencies are resolved.
30+
31+
4. **Run the Application:**
32+
- Start the application using the "Start Debugging" (F5) or "Start without Debugging" (Ctrl+F5) option.
33+
34+
5. **Input XPath Expression:**
35+
- Enter your UIA XPath expression in the provided TextBox.
36+
37+
6. **Initiate Test:**
38+
- Click the "▶ _Test" button to initiate the test.
39+
40+
7. **View Results:**
41+
- Results will be displayed in the DataGrid.
42+
43+
## Additional Information
44+
45+
- **MainWindow.xaml:** Contains the XAML markup for the UI layout.
46+
- **MainWindow.xaml.cs:** Contains the code-behind file with event handlers and logic.
47+
48+
## Dependencies
49+
50+
- This application is built using WPF (Windows Presentation Foundation).
51+
52+
## Screenshots
53+
54+
![Application Screenshot](/screenshots/1.png)
55+
56+
## Contributing
57+
58+
Contributions are welcome! If you find any issues or have improvements, please open an issue or submit a pull request.
59+
60+
## License
61+
62+
This project is licensed under the [MIT License](LICENSE).

build/AzurePipelines.yaml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: UiaXpathTester.$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)
2+
3+
trigger:
4+
- main
5+
6+
pool:
7+
vmImage: 'windows-latest'
8+
9+
variables:
10+
solution: '**/*.sln'
11+
buildPlatform: 'any cpu'
12+
buildConfiguration: 'Release'
13+
14+
stages:
15+
- stage: 'Build'
16+
jobs:
17+
- job: 'BuildAndPublish'
18+
displayName: 'Build, Pack & Publish'
19+
steps:
20+
- task: NuGetToolInstaller@1
21+
displayName: 'Install NuGet Tools'
22+
23+
- task: NuGetCommand@2
24+
displayName: 'Restore Packages'
25+
inputs:
26+
restoreSolution: '$(solution)'
27+
28+
- task: VSBuild@1
29+
displayName: 'Build Solution'
30+
inputs:
31+
solution: '$(solution)'
32+
msbuildArgs: '/target:publish /p:Configuration=Release /p:DeployOnBuild=true /p:PublishDir=$(Build.BinariesDirectory)'
33+
platform: '$(buildPlatform)'
34+
configuration: '$(buildConfiguration)'
35+
clean: true
36+
37+
- task: ArchiveFiles@2
38+
displayName: 'Create Build Artifact'
39+
inputs:
40+
rootFolderOrFile: '$(Build.BinariesDirectory)/*.*'
41+
archiveType: 'zip'
42+
archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildNumber)-win-x64.zip'
43+
replaceExistingArchive: true
44+
45+
- task: PublishBuildArtifacts@1
46+
displayName: 'Publish Build Artifact'
47+
inputs:
48+
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
49+
ArtifactName: 'drop'
50+
publishLocation: 'Container'
51+
52+
- stage: 'PublishGit'
53+
dependsOn: 'Build'
54+
condition: succeeded()
55+
jobs:
56+
- job: 'CraeteRelease'
57+
displayName: 'Create a GitHub Release & Tag'
58+
steps:
59+
- checkout: none
60+
61+
- task: PowerShell@2
62+
displayName: 'Parse Build Version for GitHub Tag'
63+
inputs:
64+
targetType: 'inline'
65+
script: |
66+
# setup
67+
[regex]$pattern = '(\d+.?)+'
68+
$version = $pattern.Matches('$(Build.BuildNumber)') | foreach-object {$_.Value}
69+
# set value
70+
Write-Host "##vso[task.setvariable variable=buildVersion]$version"
71+
72+
- task: DownloadBuildArtifacts@1
73+
displayName: 'Download Build Artifacts'
74+
inputs:
75+
buildType: 'current'
76+
downloadType: 'specific'
77+
downloadPath: '$(System.ArtifactsDirectory)'
78+
cleanDestinationFolder: true
79+
80+
- task: GitHubRelease@1
81+
displayName: 'Create GitHub Tag'
82+
inputs:
83+
assets: $(Build.ArtifactStagingDirectory)/drop/*
84+
gitHubConnection: 'github.com'
85+
repositoryName: '$(Build.Repository.Name)'
86+
action: 'create'
87+
target: '$(Build.SourceVersion)'
88+
tagSource: 'userSpecifiedTag'
89+
tag: 'v$(buildVersion)'
90+
title: 'Production v$(buildVersion)'
91+
releaseNotesSource: 'inline'
92+
changeLogCompareToRelease: 'lastFullRelease'
93+
changeLogType: 'commitBased'

screenshots/1.png

73.3 KB
Loading

src/UiaXpathTester.sln

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.8.34330.188
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UiaXpathTester", "UiaXpathTester\UiaXpathTester.csproj", "{AC68C9C9-BA69-4802-BEC4-4BB5251BBCF6}"
7+
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".build", ".build", "{A5CC44D4-21D7-433B-A0D3-FDD21D217D64}"
9+
ProjectSection(SolutionItems) = preProject
10+
..\build\AzurePipelines.yaml = ..\build\AzurePipelines.yaml
11+
..\.github\workflows\GithubActions.yml = ..\.github\workflows\GithubActions.yml
12+
EndProjectSection
13+
EndProject
14+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{DE03615A-2D16-41EE-90B0-1E5BF72AEB1A}"
15+
ProjectSection(SolutionItems) = preProject
16+
..\.gitignore = ..\.gitignore
17+
..\LICENSE = ..\LICENSE
18+
..\README.md = ..\README.md
19+
EndProjectSection
20+
EndProject
21+
Global
22+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
23+
Debug|Any CPU = Debug|Any CPU
24+
Release|Any CPU = Release|Any CPU
25+
EndGlobalSection
26+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
27+
{AC68C9C9-BA69-4802-BEC4-4BB5251BBCF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
28+
{AC68C9C9-BA69-4802-BEC4-4BB5251BBCF6}.Debug|Any CPU.Build.0 = Debug|Any CPU
29+
{AC68C9C9-BA69-4802-BEC4-4BB5251BBCF6}.Release|Any CPU.ActiveCfg = Release|Any CPU
30+
{AC68C9C9-BA69-4802-BEC4-4BB5251BBCF6}.Release|Any CPU.Build.0 = Release|Any CPU
31+
EndGlobalSection
32+
GlobalSection(SolutionProperties) = preSolution
33+
HideSolutionNode = FALSE
34+
EndGlobalSection
35+
GlobalSection(ExtensibilityGlobals) = postSolution
36+
SolutionGuid = {A2BDEA46-36A4-4075-B7EB-30BC22BB5FBC}
37+
EndGlobalSection
38+
EndGlobal

src/UiaXpathTester/App.xaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Application x:Class="UiaXpathTester.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="clr-namespace:UiaXpathTester"
5+
StartupUri="MainWindow.xaml">
6+
<Application.Resources>
7+
8+
</Application.Resources>
9+
</Application>

src/UiaXpathTester/App.xaml.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System.Configuration;
2+
using System.Data;
3+
using System.Windows;
4+
5+
namespace UiaXpathTester
6+
{
7+
/// <summary>
8+
/// Interaction logic for App.xaml
9+
/// </summary>
10+
public partial class App : Application
11+
{
12+
}
13+
14+
}

src/UiaXpathTester/AssemblyInfo.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System.Windows;
2+
3+
[assembly: ThemeInfo(
4+
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5+
//(used if a resource is not found in the page,
6+
// or application resource dictionaries)
7+
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8+
//(used if a resource is not found in the page,
9+
// app, or any theme specific resource dictionaries)
10+
)]

0 commit comments

Comments
 (0)