Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 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
File renamed without changes.
60 changes: 33 additions & 27 deletions .github/workflows/transformDataToViews.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ concurrency:

jobs:
transformAndPush:
runs-on: windows-latest
runs-on: ubuntu-latest
defaults:
run:
shell: bash
permissions:
contents: write
pull-requests: write
Expand All @@ -34,60 +37,63 @@ jobs:
path: views
ref: main
token: ${{ secrets.VIEWS_PUSH_TOKEN }}
Comment thread
seanbudd marked this conversation as resolved.
- name: Install system deps for lxml
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libxml2-dev libxslt1-dev zlib1g-dev
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: x86
- name: Install requirements and run transformation
run: |
set -euo pipefail
uv sync

# generate transformed data from this repository's addons metadata
Try { Remove-Item generated/ -Recurse -ErrorAction stop }
Catch [System.Management.Automation.ItemNotFoundException] { $null }
uv run --directory transform python -m src.transform --loglevel ${{ env.logLevel }} nvdaAPIVersions.json ../addons ../generated
rm -rf generated/
uv run --directory transform python -m src.transform --loglevel "${{ env.logLevel }}" nvdaAPIVersions.json ../addons ../generated

# replace generated data directories in addonstore-views
Try { Remove-Item views/addons/ -Recurse -ErrorAction stop }
Catch [System.Management.Automation.ItemNotFoundException] { $null }
Try { Remove-Item views/views/ -Recurse -ErrorAction stop }
Catch [System.Management.Automation.ItemNotFoundException] { $null }
Copy-Item generated/addons views/addons -Recurse
Copy-Item generated/views views/views -Recurse
rm -rf views/addons/ views/views/
cp -R generated/addons views/addons
cp -R generated/views views/views
env:
logLevel: ${{ runner.debug && 'DEBUG' || 'INFO' }}
- name: Copy files
run: |
copy ./transform/nvdaAPIVersions.json ./views/nvdaAPIVersions.json
copy ./transform/docs/output.md ./views/output.md
copy ./readme.md ./views/readme.md
set -euo pipefail
cp ./transform/nvdaAPIVersions.json ./views/nvdaAPIVersions.json
cp ./transform/docs/output.md ./views/output.md
cp ./README.md ./views/README.md
- name: Create PR and enable auto-merge
env:
GH_TOKEN: ${{ secrets.VIEWS_PUSH_TOKEN }}
run: |
set -euo pipefail
git log HEAD --pretty=format:"${{ env.COMMIT_FORMAT }}" -1 > commitMsg.txt
cd views
git config user.name github-actions
git config user.email github-actions@github.com
git add .
if (git diff --staged --quiet) {
Write-Host "No generated changes; skipping PR creation."
if git diff --staged --quiet; then
echo "No generated changes; skipping PR creation."
exit 0
}
fi

$branchName = "transformViews${{ github.run_id }}-${{ github.run_attempt }}"
git checkout -b $branchName
branchName="transformViews${{ github.run_id }}-${{ github.run_attempt }}"
git checkout -b "$branchName"
git commit -F ../commitMsg.txt
git push --set-upstream origin $branchName
git push --set-upstream origin "$branchName"

$prUrl = gh pr create `
--repo nvaccess/addonstore-views `
--base main `
--head $branchName `
--title "[Automated] Transform add-on data to views" `
--body-file ../commitMsg.txt
prUrl=$(gh pr create \
--repo nvaccess/addonstore-views \
--base main \
--head "$branchName" \
--title "[Automated] Transform add-on data to views" \
--body-file ../commitMsg.txt)

gh pr merge --repo nvaccess/addonstore-views --auto --squash --delete-branch $prUrl
gh pr merge --auto --squash --delete-branch "$prUrl"
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cpython-3.13-windows-x86_64-none
cpython-3.13
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ reportMissingTypeStubs = false

[tool.uv]
default-groups = "all"
environments = ["sys_platform == 'win32'"]
required-version = ">=0.8"

[tool.setuptools]
Expand Down
2 changes: 2 additions & 0 deletions transform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The output is designed to be published from a single branch.
For each NVDA version that needs to be supported by the add-on store, an entry must be added to [`nvdaAPIVersions.json`](./nvdaAPIVersions.json).
This includes patch versions.

This module should be run from linux, as symlinks are created for the server component.

## Overview

For each version of NVDA, the meta-data of the most recent (the highest version number) of each add-on is automatically
Expand Down
3 changes: 2 additions & 1 deletion transform/docs/output.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Output

The output for running the transformation is described as follows.
This is written to a given directory, and removes existing json data from the directory in the process.
This is written to a given directory that must be new/empty; the transformation creates this directory and fails if it already exists
Comment thread
seanbudd marked this conversation as resolved.
Outdated
Callers are responsible for deleting any previous output directory before running the transformation.

## Output file structure

Expand Down
45 changes: 45 additions & 0 deletions transform/src/tests/test_viewsGenerationSystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,4 +324,49 @@ def test_translation_view_symlink_points_to_translated_addon_data(self):
"2026.1.0",
targetPath="addons/UIANotificationSwitch/2026.1.0/ar.json",
),
ExpectedAddonVersion(
"views/ar/2019.1.1/UIANotificationSwitch/stable.json",
"2026.1.0",
targetPath="addons/UIANotificationSwitch/2026.1.0/ar.json",
),
ExpectedAddonVersion(
"views/ar/2019.2.0/UIANotificationSwitch/stable.json",
"2026.1.0",
targetPath="addons/UIANotificationSwitch/2026.1.0/ar.json",
),
ExpectedAddonVersion(
"views/ar/2019.2.1/UIANotificationSwitch/stable.json",
"2026.1.0",
targetPath="addons/UIANotificationSwitch/2026.1.0/ar.json",
),
ExpectedAddonVersion(
"views/ar/latest/UIANotificationSwitch/stable.json",
"2026.1.0",
targetPath="addons/UIANotificationSwitch/2026.1.0/ar.json",
),
ExpectedAddonVersion(
"views/en/2019.1.0/UIANotificationSwitch/stable.json",
"2026.1.0",
targetPath="addons/UIANotificationSwitch/2026.1.0/en.json",
),
ExpectedAddonVersion(
"views/en/2019.1.1/UIANotificationSwitch/stable.json",
"2026.1.0",
targetPath="addons/UIANotificationSwitch/2026.1.0/en.json",
),
ExpectedAddonVersion(
"views/en/2019.2.0/UIANotificationSwitch/stable.json",
"2026.1.0",
targetPath="addons/UIANotificationSwitch/2026.1.0/en.json",
),
ExpectedAddonVersion(
"views/en/2019.2.1/UIANotificationSwitch/stable.json",
"2026.1.0",
targetPath="addons/UIANotificationSwitch/2026.1.0/en.json",
),
ExpectedAddonVersion(
"views/en/latest/UIANotificationSwitch/stable.json",
"2026.1.0",
targetPath="addons/UIANotificationSwitch/2026.1.0/en.json",
),
)
70 changes: 32 additions & 38 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading