From 29f8b783b91183224ebf8968c2ad45e76f88abae Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 22 Sep 2026 21:34:20 +0000 Subject: [PATCH 1/3] Initial plan From c0a9743eb00ff0edbfea6088088cc45db6b613f2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 22 Sep 2026 21:39:09 +0000 Subject: [PATCH 2/3] fix: build addin in CI Co-authored-by: danmaps <10421813+danmaps@users.noreply.github.com> --- .github/workflows/ci.yml | 62 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 61 ++++++++++++++++++++++++++++++++++ README.md | 7 ++-- 3 files changed, 128 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4483a7e..ca3bd4f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,8 +32,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 @@ -48,6 +101,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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3997af8..f84df6f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,8 +5,60 @@ on: types: [published] 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 @@ -19,6 +71,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 diff --git a/README.md b/README.md index 71c4fac..a041886 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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) ``` From 34bd797a6d271b54e77e483d6694d6567da87d9d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 22 Sep 2026 21:39:56 +0000 Subject: [PATCH 3/3] fix: restrict workflow token permissions Co-authored-by: danmaps <10421813+danmaps@users.noreply.github.com> --- .github/workflows/ci.yml | 3 +++ .github/workflows/release.yml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca3bd4f..2456955 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,9 @@ on: pull_request: branches: [main] +permissions: + contents: read + jobs: test: name: Test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f84df6f..eec5a75 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,9 @@ on: release: types: [published] +permissions: + contents: read + jobs: build_addin: name: Build add-in