Skip to content

Commit ad96483

Browse files
authored
no-defaults: Add version 2026.9.1 (#2647)
1 parent af1246e commit ad96483

2 files changed

Lines changed: 212 additions & 0 deletions

File tree

Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
# SPDX-FileCopyrightText: 2026 The RISE Project
2+
# SPDX-License-Identifier: MIT
3+
---
4+
# This workflow is based on the `build-wheels` job of
5+
# https://github.com/adamtheturtle/no-defaults/blob/2026.9.1/.github/workflows/release.yml
6+
name: Build no-defaults wheels (riscv64)
7+
8+
on:
9+
workflow_dispatch:
10+
inputs:
11+
version:
12+
description: 'Version glob to (re)build; empty builds every version of docs/packages/no-defaults.yaml not released yet'
13+
required: false
14+
default: ''
15+
pull_request:
16+
branches: [main]
17+
paths:
18+
- '.github/workflows/build-no-defaults.yml'
19+
- 'docs/packages/no-defaults.yaml'
20+
push:
21+
branches: [main]
22+
paths:
23+
- '.github/workflows/build-no-defaults.yml'
24+
- 'docs/packages/no-defaults.yaml'
25+
26+
concurrency:
27+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
28+
cancel-in-progress: true
29+
30+
permissions:
31+
contents: read # to fetch code (actions/checkout)
32+
33+
jobs:
34+
setup:
35+
uses: $/.github/workflows/_setup.yml
36+
with:
37+
package: no-defaults
38+
version: ${{ inputs.version }}
39+
40+
build_wheel:
41+
needs: [setup]
42+
if: needs.setup.outputs.versions != '[]'
43+
strategy:
44+
fail-fast: false
45+
matrix:
46+
version: ${{ fromJSON(needs.setup.outputs.versions) }}
47+
name: Build no-defaults ${{ matrix.version }} manylinux_riscv64
48+
runs-on: ubuntu-24.04-riscv
49+
timeout-minutes: 360
50+
51+
env:
52+
NO_DEFAULTS_VERSION: ${{ matrix.version }}
53+
54+
steps:
55+
# Upstream tags same-day re-releases as `<date>-post.<N>` (wheel version `<date>.post<N>`).
56+
- name: Resolve git tag
57+
id: tag
58+
run: echo "ref=${NO_DEFAULTS_VERSION/.post/-post.}" >> "$GITHUB_OUTPUT"
59+
60+
- name: Checkout no-defaults ${{ steps.tag.outputs.ref }}
61+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
62+
with:
63+
repository: adamtheturtle/no-defaults
64+
ref: ${{ steps.tag.outputs.ref }}
65+
persist-credentials: false
66+
67+
# No musl target: rustup.rs ships no riscv64 musl toolchain.
68+
- name: Build wheel
69+
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
70+
with:
71+
command: build
72+
target: riscv64gc-unknown-linux-gnu
73+
args: --release --out dist
74+
manylinux: '2_39'
75+
before-script-linux: git config --global --add safe.directory "*"
76+
77+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
78+
with:
79+
name: no-defaults-${{ env.NO_DEFAULTS_VERSION }}-manylinux_riscv64
80+
path: dist/*.whl
81+
if-no-files-found: error
82+
83+
test_wheel:
84+
name: Test no-defaults ${{ matrix.version }} on Python ${{ matrix.python-version }}
85+
needs: [setup, build_wheel]
86+
if: needs.setup.outputs.versions != '[]'
87+
runs-on: ubuntu-24.04-riscv
88+
timeout-minutes: 30
89+
env:
90+
NO_DEFAULTS_VERSION: ${{ matrix.version }}
91+
UV_PYTHON_PREFERENCE: only-managed
92+
strategy:
93+
fail-fast: false
94+
matrix:
95+
version: ${{ fromJSON(needs.setup.outputs.versions) }}
96+
python-version: ['3.12', '3.13', '3.14', '3.14t']
97+
98+
steps:
99+
- name: Resolve git tag
100+
id: tag
101+
run: echo "ref=${NO_DEFAULTS_VERSION/.post/-post.}" >> "$GITHUB_OUTPUT"
102+
103+
- name: Checkout no-defaults ${{ steps.tag.outputs.ref }} test fixtures
104+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
105+
with:
106+
repository: adamtheturtle/no-defaults
107+
ref: ${{ steps.tag.outputs.ref }}
108+
path: upstream
109+
sparse-checkout: tests/fixtures
110+
persist-credentials: false
111+
112+
- name: Download wheel
113+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
114+
with:
115+
name: no-defaults-${{ env.NO_DEFAULTS_VERSION }}-manylinux_riscv64
116+
path: dist
117+
118+
- name: Install Python
119+
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
120+
with:
121+
python-version: ${{ matrix.python-version }}
122+
activate-environment: true
123+
enable-cache: false
124+
125+
- name: Install wheel
126+
run: uv pip install --reinstall --find-links dist "no-defaults==${NO_DEFAULTS_VERSION}"
127+
128+
# Upstream's tests are a Rust integration suite (`cargo test`) that is never packaged;
129+
# drive the installed binary, which requires the `ty` it depends on, through the
130+
# suite's `real_project_uses_per_file_configuration` and
131+
# `fix_updates_call_sites_across_files` cases instead.
132+
- name: Test wheel
133+
run: |
134+
set -euo pipefail
135+
no-defaults --version
136+
ty version
137+
138+
set +e
139+
no-defaults --output-format json upstream/tests/fixtures/real_project > report.json
140+
rc=$?
141+
set -e
142+
[ "$rc" -eq 1 ]
143+
python - <<'PY'
144+
import json
145+
diagnostics = json.load(open("report.json"))
146+
text = json.dumps(diagnostics)
147+
assert len(diagnostics) == 2, diagnostics
148+
assert "_private" in text and "helper" in text, text
149+
assert "function `public`" not in text, text
150+
PY
151+
152+
work=$(mktemp -d)
153+
cat > "$work/api.py" <<'PY'
154+
from dataclasses import dataclass, field
155+
156+
def connect(host, timeout=30, *, retries=3):
157+
return host
158+
159+
@dataclass
160+
class Job:
161+
name: str
162+
tags: list = field(default_factory=list)
163+
164+
class Client:
165+
def fetch(self, url, verify=True):
166+
return url
167+
168+
def twice(self, url):
169+
return self.fetch(url)
170+
PY
171+
cat > "$work/caller.py" <<'PY'
172+
import api
173+
174+
api.connect("h")
175+
api.connect("h", 5, retries=1)
176+
api.Job("j")
177+
PY
178+
179+
no-defaults --fix "$work" | tee fix.log
180+
grep -q 'Updated 3 call sites.' fix.log
181+
cat > expected.py <<'PY'
182+
import api
183+
184+
api.connect("h", timeout=30, retries=3)
185+
api.connect("h", 5, retries=1)
186+
api.Job("j", tags=[])
187+
PY
188+
diff -u expected.py "$work/caller.py"
189+
grep -q 'self.fetch(url, verify=True)' "$work/api.py"
190+
no-defaults "$work"
191+
192+
publish:
193+
name: Publish no-defaults ${{ matrix.version }}
194+
needs: [setup, build_wheel, test_wheel]
195+
if: needs.setup.outputs.versions != '[]'
196+
strategy:
197+
fail-fast: false
198+
matrix:
199+
version: ${{ fromJSON(needs.setup.outputs.versions) }}
200+
permissions:
201+
contents: write
202+
pull-requests: write
203+
uses: $/.github/workflows/_publish-wheel.yml
204+
secrets:
205+
app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }}
206+
with:
207+
artifact-pattern: no-defaults-${{ matrix.version }}-manylinux_riscv64

‎docs/packages/no-defaults.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package-name: no-defaults
2+
source-code: https://github.com/adamtheturtle/no-defaults
3+
license: MIT
4+
versions:
5+
- version: 2026.9.1

0 commit comments

Comments
 (0)