From a80c4702e7af7e045c8dd7f5cf0eba39146dc916 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Tue, 13 Oct 2026 17:44:02 +0000 Subject: [PATCH 1/2] sqlfluffrs: Add version 4.3.0 --- .github/workflows/build-sqlfluffrs.yml | 185 +++++++++++++++++++++++++ docs/packages/sqlfluffrs.yaml | 5 + 2 files changed, 190 insertions(+) create mode 100644 .github/workflows/build-sqlfluffrs.yml create mode 100644 docs/packages/sqlfluffrs.yaml diff --git a/.github/workflows/build-sqlfluffrs.yml b/.github/workflows/build-sqlfluffrs.yml new file mode 100644 index 00000000000..2c9cf0a1a4f --- /dev/null +++ b/.github/workflows/build-sqlfluffrs.yml @@ -0,0 +1,185 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# Based on upstream's own wheel builder: +# https://github.com/sqlfluff/sqlfluff/blob/4.3.0/.github/workflows/publish-sqlfluffrs-release-to-pypi.yaml +# and the `-rust` test jobs of: +# https://github.com/sqlfluff/sqlfluff/blob/4.3.0/.github/workflows/ci-tests.yml +name: Build sqlfluffrs wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'Version glob to (re)build; empty builds every version of docs/packages/sqlfluffrs.yaml not released yet' + required: false + default: '' + pull_request: + branches: [main] + paths: + - '.github/workflows/build-sqlfluffrs.yml' + - 'docs/packages/sqlfluffrs.yaml' + push: + branches: [main] + paths: + - '.github/workflows/build-sqlfluffrs.yml' + - 'docs/packages/sqlfluffrs.yaml' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + with: + package: sqlfluffrs + version: ${{ inputs.version }} + + generate_rust_dialects: + needs: [setup] + if: needs.setup.outputs.versions != '[]' + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + name: Generate sqlfluffrs ${{ matrix.version }} Rust dialects + runs-on: ubuntu-latest + env: + SQLFLUFFRS_VERSION: ${{ matrix.version }} + + steps: + - name: Checkout sqlfluff ${{ env.SQLFLUFFRS_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: sqlfluff/sqlfluff + ref: ${{ env.SQLFLUFFRS_VERSION }} + persist-credentials: false + + - name: Install Python + uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 + with: + python-version: '3.14' + activate-environment: true + enable-cache: false + + - name: Generate Rust dialects + run: | + uv pip install -e . + python utils/rustify.py build + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: sqlfluffrs-${{ env.SQLFLUFFRS_VERSION }}-generated-rust-dialects + path: sqlfluffrs/sqlfluffrs_dialects/src/ + if-no-files-found: error + + build_wheel: + needs: [setup, generate_rust_dialects] + if: needs.setup.outputs.versions != '[]' + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + name: Build sqlfluffrs ${{ matrix.version }} cp310-abi3-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 360 + env: + SQLFLUFFRS_VERSION: ${{ matrix.version }} + + steps: + - name: Checkout sqlfluff ${{ env.SQLFLUFFRS_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: sqlfluff/sqlfluff + ref: ${{ env.SQLFLUFFRS_VERSION }} + persist-credentials: false + + - name: Download generated Rust dialects + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: sqlfluffrs-${{ env.SQLFLUFFRS_VERSION }}-generated-rust-dialects + path: sqlfluffrs/sqlfluffrs_dialects/src/ + + - name: Build wheel + uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0 + with: + target: riscv64gc-unknown-linux-gnu + args: --release -i python3.10 --out dist --manifest-path sqlfluffrs/Cargo.toml + manylinux: '2_39' + before-script-linux: git config --global --add safe.directory "*" + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: sqlfluffrs-${{ env.SQLFLUFFRS_VERSION }}-cp310-abi3-manylinux_riscv64 + path: dist/*.whl + if-no-files-found: error + + test_wheel: + needs: [setup, build_wheel] + if: needs.setup.outputs.versions != '[]' + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + python-version: ['3.12', '3.13', '3.14'] + name: Test sqlfluffrs ${{ matrix.version }} on Python ${{ matrix.python-version }} + runs-on: ubuntu-24.04-riscv + timeout-minutes: 180 + env: + SQLFLUFFRS_VERSION: ${{ matrix.version }} + UV_PYTHON_PREFERENCE: only-managed + UV_EXTRA_INDEX_URL: https://pypi.riseproject.dev/simple/ + UV_INDEX_STRATEGY: unsafe-best-match + + steps: + - name: Checkout sqlfluff ${{ env.SQLFLUFFRS_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: sqlfluff/sqlfluff + ref: ${{ env.SQLFLUFFRS_VERSION }} + persist-credentials: false + + - name: Download wheel + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: sqlfluffrs-${{ env.SQLFLUFFRS_VERSION }}-cp310-abi3-manylinux_riscv64 + path: dist/ + + - name: Install Python + uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 + with: + python-version: ${{ matrix.python-version }} + activate-environment: true + enable-cache: false + + # The tox `py3XX-rust` environment, minus requirements_dev.txt's linting, + # typing and docs tools. + - name: Install sqlfluff and the wheel + run: | + uv pip install . ./plugins/sqlfluff-plugin-example hypothesis pytest pytest-xdist + uv pip install --reinstall --no-deps --no-index --find-links dist/ sqlfluffrs + python -c "import sqlfluffrs.sqlfluffrs as m; assert m.__file__.endswith('.so'), m.__file__; print(m.__file__)" + + - name: Run tests + run: python -m pytest -rsfE -n auto test -m "not integration" --durations=16 --verbosity=0 + + publish: + name: Publish sqlfluffrs ${{ matrix.version }} + needs: [setup, build_wheel, test_wheel] + if: needs.setup.outputs.versions != '[]' + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + permissions: + contents: write + pull-requests: write + uses: $/.github/workflows/_publish-wheel.yml + secrets: + app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} + with: + artifact-pattern: sqlfluffrs-${{ matrix.version }}-*-manylinux_riscv64 diff --git a/docs/packages/sqlfluffrs.yaml b/docs/packages/sqlfluffrs.yaml new file mode 100644 index 00000000000..fe49375c0aa --- /dev/null +++ b/docs/packages/sqlfluffrs.yaml @@ -0,0 +1,5 @@ +package-name: sqlfluffrs +source-code: https://github.com/sqlfluff/sqlfluff +license: MIT +versions: +- version: 4.3.0 From b4bea6b12dc3cc51fb0ae7424947d74850c1dbd4 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Sat, 24 Oct 2026 04:29:17 +0000 Subject: [PATCH 2/2] sqlfluffrs: Backport upstream XDG_CONFIG_HOME test fixture fix All three test_wheel legs failed the same three cases of test/core/config/loader_test.py::test__config__get_user_config_dir_path. The failure is not riscv64-specific: sqlfluff 4.3.0's mock_xdg_home fixture sets XDG_CONFIG_HOME to the unexpanded "~/.config/my/special/path", and platformdirs 4.12.0 and later ignore a non-absolute XDG_CONFIG_HOME as the XDG Base Directory spec requires, so the XDG path is never consulted. It reproduces on x86_64 with platformdirs >= 4.12.0 and passes with 4.11.0. Upstream fixed the fixture in sqlfluff 4.4.0 (commit 2dd9c7c7, #8461). Carry that commit as a test-only patch applied in the test_wheel job; the build job and the wheel are unchanged. --- .github/workflows/build-sqlfluffrs.yml | 14 +++++++ ...ests-expand-XDG-config-home-variable.patch | 39 +++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 patches/sqlfluffrs/4.3.0/0001-fix-tests-expand-XDG-config-home-variable.patch diff --git a/.github/workflows/build-sqlfluffrs.yml b/.github/workflows/build-sqlfluffrs.yml index 2c9cf0a1a4f..2a9c730f9f3 100644 --- a/.github/workflows/build-sqlfluffrs.yml +++ b/.github/workflows/build-sqlfluffrs.yml @@ -19,11 +19,13 @@ on: paths: - '.github/workflows/build-sqlfluffrs.yml' - 'docs/packages/sqlfluffrs.yaml' + - 'patches/sqlfluffrs/**' push: branches: [main] paths: - '.github/workflows/build-sqlfluffrs.yml' - 'docs/packages/sqlfluffrs.yaml' + - 'patches/sqlfluffrs/**' concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} @@ -143,6 +145,18 @@ jobs: ref: ${{ env.SQLFLUFFRS_VERSION }} persist-credentials: false + - name: Checkout python-wheels + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + path: python-wheels + sparse-checkout: patches/sqlfluffrs + persist-credentials: false + + # Test-only backport: 4.3.0's loader_test sets a non-absolute + # XDG_CONFIG_HOME, which platformdirs >= 4.12.0 ignores per the XDG spec. + - name: Patch sqlfluff tests + run: git apply python-wheels/patches/sqlfluffrs/${{ env.SQLFLUFFRS_VERSION }}/*.patch + - name: Download wheel uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: diff --git a/patches/sqlfluffrs/4.3.0/0001-fix-tests-expand-XDG-config-home-variable.patch b/patches/sqlfluffrs/4.3.0/0001-fix-tests-expand-XDG-config-home-variable.patch new file mode 100644 index 00000000000..a2a8c6fcd60 --- /dev/null +++ b/patches/sqlfluffrs/4.3.0/0001-fix-tests-expand-XDG-config-home-variable.patch @@ -0,0 +1,39 @@ +From 2dd9c7c7efc53d4a87932be2cee96293ea58e744 Mon Sep 17 00:00:00 2001 +From: Tobias Ruby +Date: Wed, 9 Sep 2026 23:44:55 +0000 +Subject: [PATCH] fix(tests): expand XDG config home variable (#8461) + +Upstream-Status: Backport [https://github.com/sqlfluff/sqlfluff/commit/2dd9c7c7efc53d4a87932be2cee96293ea58e744] + +platformdirs 4.12.0 started ignoring a non-absolute XDG_CONFIG_HOME, as +the XDG Base Directory spec requires. The 4.3.0 test fixture sets it to +the unexpanded "~/.config/my/special/path", so with any platformdirs +>= 4.12.0 the three XDG cases of test__config__get_user_config_dir_path +fail on every architecture. Upstream fixed the fixture in 4.4.0; this is +that commit, applied to the test tree only (the wheel is unaffected). + +Co-authored-by: Tobias Ruby +--- + test/core/config/loader_test.py | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/test/core/config/loader_test.py b/test/core/config/loader_test.py +index 83950155..5011ad7d 100644 +--- a/test/core/config/loader_test.py ++++ b/test/core/config/loader_test.py +@@ -37,8 +37,10 @@ config_a = { + + @pytest.fixture + def mock_xdg_home(monkeypatch): +- """Sets the XDG_CONFIG_HOME variable.""" +- monkeypatch.setenv("XDG_CONFIG_HOME", "~/.config/my/special/path") ++ """Sets the XDG_CONFIG_HOME variable which must be an absolute path.""" ++ monkeypatch.setenv( ++ "XDG_CONFIG_HOME", os.path.expanduser("~/.config/my/special/path") ++ ) + + + def test__config__load_file_dir(): +-- +2.43.0 +