diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 0000000..b4889fb --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,31 @@ +name: Build and Test PR + +on: + pull_request: + branches: + - main + +jobs: + build-and-test: + runs-on: windows-latest + permissions: + contents: read + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v2 + + - name: Setup NuGet + uses: nuget/setup-nuget@v2.0.0 + + - name: Restore NuGet packages + run: nuget restore src\SearchPlatAPI.sln + + - name: Build solution + run: msbuild src\SearchPlatAPI.sln /p:Configuration=Release /p:Platform=x64 + + - name: Run tests + run: vstest.console.exe src\x64\Release\test.dll diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..320d8fc --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,39 @@ +name: Release to NuGet + +on: + push: + branches: + - release + +jobs: + package-and-publish: + runs-on: windows-latest + permissions: + contents: read + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup NuGet + uses: nuget/setup-nuget@v2.0.0 + + - name: Get version from nuspec + id: get_version + shell: pwsh + run: | + [xml]$nuspec = Get-Content SearchPlatAPI.nuspec + $version = $nuspec.package.metadata.version + echo "version=$version" >> $env:GITHUB_OUTPUT + + - name: Pack NuGet package + run: nuget pack SearchPlatAPI.nuspec -Version ${{ steps.get_version.outputs.version }} + + - name: Push to NuGet + run: nuget push *.nupkg -Source https://api.nuget.org/v3/index.json -ApiKey ${{ secrets.NUGET_API_KEY }} -SkipDuplicate + + - name: Upload package as artifact + uses: actions/upload-artifact@v4 + with: + name: nuget-package + path: '*.nupkg' diff --git a/README.md b/README.md index 4c4c0a7..f401d71 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,28 @@ # Windows Search Platform APIs Public Wrappers for Common Windows Search Service Platform APIs -These APIs assist developers in programming against the Windows Search Service in a much easier fashion than today. APIs are pretty verbose, and spread across many different header files. This takes the most commonly used functionality and puts it in a simple to use header file for Win32 application developers. +These APIs assist developers in programming against the Windows Search Service in a much easier fashion than today. APIs are pretty verbose, and spread across many different header files. This takes the most commonly used functionality and puts it in a simple to use header file for Win32 application developers. + +## CI/CD Workflows + +This repository includes two GitHub Actions workflows: + +### Pull Request Workflow +- **Trigger**: Pull requests to the `main` branch +- **Purpose**: Builds the solution and runs tests to ensure code quality +- **Steps**: + - Restores NuGet packages + - Builds the solution using MSBuild (Release x64) + - Runs unit tests with VSTest + +### Release Workflow +- **Trigger**: Pushes to the `release` branch +- **Purpose**: Packages header files and publishes to NuGet +- **Steps**: + - Packages all header files from `src/api/` into a NuGet package + - Publishes to NuGet.org (requires `NUGET_API_KEY` secret) + - Uploads package as a build artifact + +## NuGet Package + +The header files are published as a NuGet package for easy consumption in C++ projects. The package includes all API headers from the `src/api/` directory. diff --git a/SearchPlatAPI.nuspec b/SearchPlatAPI.nuspec new file mode 100644 index 0000000..c742563 --- /dev/null +++ b/SearchPlatAPI.nuspec @@ -0,0 +1,20 @@ + + + + SearchPlatAPI + 1.0.0 + SearchPlatAPI Contributors + SearchPlatAPI + false + LICENSE + https://github.com/brflynn/searchplatapi + Public Wrappers for Common Windows Search Service Platform APIs. These APIs assist developers in programming against the Windows Search Service in a much easier fashion than today. + Initial release of SearchPlatAPI header files. + Copyright (c) SearchPlatAPI Contributors + windows search native cpp headers + + + + + +