Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
pull_request:
branches: [main]

permissions:
contents: read

jobs:
test:
name: Test
Expand All @@ -32,8 +35,61 @@ jobs:
working-directory: cli
run: pytest -v --tb=short

build_addin:
name: Build add-in
runs-on: [self-hosted, windows, arcgispro]
steps:
- uses: actions/checkout@v4

- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"

- name: Locate MSBuild
id: msbuild
shell: pwsh
run: |
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
if (-not (Test-Path $vswhere)) {
throw "vswhere.exe not found at $vswhere"
}

$msbuild = & $vswhere -latest -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe | Select-Object -First 1
if (-not $msbuild) {
throw "MSBuild.exe not found"
}

"path=$msbuild" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append

- name: Build add-in
working-directory: ProExporter
shell: pwsh
run: |
& "${{ steps.msbuild.outputs.path }}" ProExporter.sln /restore /p:Configuration=Release

- name: Collect add-in
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path cli/arcgispro_cli/addin | Out-Null
$addin = Get-ChildItem -Path ProExporter -Filter *.esriAddinX -Recurse | Select-Object -First 1
if (-not $addin) {
throw "Built add-in (.esriAddinX) not found"
}

Copy-Item $addin.FullName cli/arcgispro_cli/addin/ProExporter.addin
Get-Item cli/arcgispro_cli/addin/ProExporter.addin | Format-List FullName, Length, LastWriteTime

- name: Upload add-in artifact
uses: actions/upload-artifact@v4
with:
name: proexporter-addin
path: cli/arcgispro_cli/addin/ProExporter.addin
retention-days: 1

build:
name: Build check
needs: [test, build_addin]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -48,6 +104,15 @@ jobs:
- name: Install build tools
run: pip install build

- name: Download built add-in
uses: actions/download-artifact@v4
with:
name: proexporter-addin
path: ${{ runner.temp }}/proexporter-addin

- name: Install built add-in
run: cp "${{ runner.temp }}/proexporter-addin/ProExporter.addin" cli/arcgispro_cli/addin/ProExporter.addin

- name: Build package
working-directory: cli
run: python -m build
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,64 @@ on:
release:
types: [published]

permissions:
contents: read

jobs:
build_addin:
name: Build add-in
runs-on: [self-hosted, windows, arcgispro]
steps:
- uses: actions/checkout@v4

- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"

- name: Locate MSBuild
id: msbuild
shell: pwsh
run: |
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
if (-not (Test-Path $vswhere)) {
throw "vswhere.exe not found at $vswhere"
}

$msbuild = & $vswhere -latest -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe | Select-Object -First 1
if (-not $msbuild) {
throw "MSBuild.exe not found"
}

"path=$msbuild" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append

- name: Build add-in
working-directory: ProExporter
shell: pwsh
run: |
& "${{ steps.msbuild.outputs.path }}" ProExporter.sln /restore /p:Configuration=Release

- name: Collect add-in
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path cli/arcgispro_cli/addin | Out-Null
$addin = Get-ChildItem -Path ProExporter -Filter *.esriAddinX -Recurse | Select-Object -First 1
if (-not $addin) {
throw "Built add-in (.esriAddinX) not found"
}

Copy-Item $addin.FullName cli/arcgispro_cli/addin/ProExporter.addin

- name: Upload add-in artifact
uses: actions/upload-artifact@v4
with:
name: proexporter-addin
path: cli/arcgispro_cli/addin/ProExporter.addin
retention-days: 1

build:
name: Build distribution
needs: build_addin
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -19,6 +74,15 @@ jobs:
- name: Install build tools
run: pip install build

- name: Download built add-in
uses: actions/download-artifact@v4
with:
name: proexporter-addin
path: ${{ runner.temp }}/proexporter-addin

- name: Install built add-in
run: cp "${{ runner.temp }}/proexporter-addin/ProExporter.addin" cli/arcgispro_cli/addin/ProExporter.addin

- name: Build package
working-directory: cli
run: python -m build
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ This happens if `C:\Program Files\ArcGIS\Pro\bin` is on your PATH. Options:

## Development

To build the add-in from source, you'll need:
The CLI test/build workflow now rebuilds the bundled add-in in CI on a self-hosted
Windows runner with ArcGIS Pro and the Pro SDK installed.

To build the add-in from source locally, you'll need:
- Visual Studio 2022 with ArcGIS Pro SDK extension
- .NET 8 SDK

Expand All @@ -113,7 +116,7 @@ git clone https://github.com/danmaps/arcgispro_cli.git
cd arcgispro_cli/cli
pip install -e .

# Build add-in in Visual Studio
# Build add-in in Visual Studio when testing add-in changes locally
# Open ProExporter/ProExporter.sln
# Build → Build Solution (Release)
```
Expand Down