diff --git a/.github/workflows/test-and-release.yml b/.github/workflows/test-and-release.yml index 92996f8..5ad3c27 100644 --- a/.github/workflows/test-and-release.yml +++ b/.github/workflows/test-and-release.yml @@ -11,17 +11,18 @@ jobs: matrix: os: [ ubuntu-latest ] py: [ '3.10', '3.11', '3.12', '3.13' ] - # On Windows, we select the configurations we test manually because we only have a few runners, - # and because the infrastructure is hard to maintain using limited resources. - include: - - { os: win-pcap, py: '3.12' } runs-on: ${{ matrix.os }} + defaults: + run: + working-directory: repo env: FORCE_COLOR: 1 steps: - uses: actions/checkout@v4 with: + path: repo submodules: true + clean: ${{ runner.os != 'Windows' }} - uses: actions/setup-python@v5 with: @@ -48,9 +49,42 @@ jobs: # The matrix is shown for convenience but this is fragile because the values may not be string-convertible. # Shall it break one day, feel free to remove the matrix from here. name: ${{github.job}}-#${{strategy.job-index}}-${{job.status}}-${{join(matrix.*, ',')}} - path: "**/*.log" + path: "repo/**/*.log" retention-days: 90 - include-hidden-files: true + include-hidden-files: ${{ runner.os != 'Windows' }} + + test_windows: + name: Test (win-pcap, 3.12) + if: github.event_name == 'push' + runs-on: win-pcap + defaults: + run: + working-directory: repo + env: + FORCE_COLOR: 1 + steps: + - uses: actions/checkout@v4 + with: + path: repo + submodules: true + clean: false + + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + + # Only one statement per step to ensure the error codes are not ignored by PowerShell. + - run: python -m pip install --upgrade attrs pip setuptools nox + - run: nox --non-interactive --session test --python 3.12 + - run: nox --non-interactive --session lint + + - uses: actions/upload-artifact@v4 + if: (success() || failure()) + with: + name: ${{github.job}}-${{job.status}}-win-pcap,3.12 + path: "repo/**/*.log" + retention-days: 90 + include-hidden-files: false release: name: Release @@ -58,7 +92,7 @@ jobs: if: > (github.event_name == 'push') && (contains(github.event.head_commit.message, '#release') || contains(github.ref, '/main')) - needs: test + needs: [test, test_windows] steps: - name: Check out uses: actions/checkout@v4 diff --git a/yakut/VERSION b/yakut/VERSION index 930e300..e867cc2 100644 --- a/yakut/VERSION +++ b/yakut/VERSION @@ -1 +1 @@ -0.14.1 +0.14.2 diff --git a/yakut/cmd/monitor/_view.py b/yakut/cmd/monitor/_view.py index a33b1fc..786b12d 100644 --- a/yakut/cmd/monitor/_view.py +++ b/yakut/cmd/monitor/_view.py @@ -314,9 +314,9 @@ def slice_req_rsp(m: _T) -> tuple[_T, _T]: byte_rates_by_node = byte_rates.sum(axis=1) for ii, node_id in enumerate(online_states): x = node_id if node_id is not None else N_NODES - sty = get_matrix_cell_style(None, None, int(xfer_delta_by_node[x]) > 0) - tbl[row_total + 1, ii + 1] = render_xfer_rate(float(xfer_rates_by_node[x])), sty - tbl[row_total + 2, ii + 1] = render_xfer_rate(float(byte_rates_by_node[x])), sty + sty = get_matrix_cell_style(None, None, int(xfer_delta_by_node[x, 0]) > 0) + tbl[row_total + 1, ii + 1] = render_xfer_rate(float(xfer_rates_by_node[x, 0])), sty + tbl[row_total + 2, ii + 1] = render_xfer_rate(float(byte_rates_by_node[x, 0])), sty # Sum the DS-wise vectors because they are usually faster due to being smaller. sty = get_matrix_cell_style(None, None, int(xfer_delta_by_ds.sum()) > 0) diff --git a/yakut/main.py b/yakut/main.py index b32fcbe..1e656e3 100644 --- a/yakut/main.py +++ b/yakut/main.py @@ -226,7 +226,11 @@ def main() -> None: # https://click.palletsprojects.com/en/8.1.x/exceptions/ status: Any = 1 # noinspection PyBroadException try: - status = _click_main.main(prog_name="yakut", standalone_mode=False) + status = _click_main.main( + args=_normalize_click_args(sys.argv[1:]), + prog_name="yakut", + standalone_mode=False, + ) except SystemExit as ex: status = ex.code @@ -256,6 +260,33 @@ def main() -> None: # https://click.palletsprojects.com/en/8.1.x/exceptions/ sys.exit(status) +def _normalize_click_args(args: list[str]) -> list[str]: + """ + Click 8.3 stopped accepting bare options with flag_value when a typed value is configured. + Preserve the documented behavior of ``yakut cmd --expect`` by rewriting it into an explicit empty value. + """ + if "--" in args: + effective_len = args.index("--") + else: + effective_len = len(args) + + cmd_index = next( + (idx for idx, tok in enumerate(args[:effective_len]) if tok in {"cmd", "execute-command"}), + None, + ) + if cmd_index is None: + return args + + out = list(args) + for idx in range(cmd_index + 1, effective_len): + if out[idx] not in {"--expect", "-e"}: + continue + next_arg = out[idx + 1] if idx + 1 < effective_len else None + if next_arg is None or next_arg.startswith("-"): + out[idx] = "--expect=" + return out + + subcommand: Callable[..., Callable[..., Any]] = _click_main.command # type: ignore