-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (106 loc) · 5.08 KB
/
Copy pathbuild-deptry.yml
File metadata and controls
119 lines (106 loc) · 5.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# This workflow drives upstream's own wheel build (release.yml `linux` job, which calls
# PyO3/maturin-action) through cibuildwheel, narrowed to riscv64.
name: Build deptry wheels (riscv64)
on:
workflow_dispatch:
inputs:
version:
description: 'deptry version/tag to build (e.g. 0.25.1)'
required: true
default: '0.25.1'
pull_request:
paths:
- '.github/workflows/build-deptry.yml'
concurrency:
group: ${{ github.workflow }}-${{ inputs.version || '0.25.1' }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
env:
# `inputs.version` is empty on pull_request events; default to 0.25.1 there.
DEPTRY_VERSION: ${{ inputs.version || '0.25.1' }}
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
jobs:
setup:
uses: $/.github/workflows/_setup.yml
build_wheels:
needs: [setup]
name: Build deptry ${{ inputs.version || '0.25.1' }} cp310-abi3-manylinux_riscv64
runs-on: ubuntu-24.04-riscv
timeout-minutes: 360
steps:
- name: Checkout deptry ${{ env.DEPTRY_VERSION }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: osprey-oss/deptry
ref: ${{ env.DEPTRY_VERSION }}
persist-credentials: false
- name: Checkout python-wheels
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: python-wheels
sparse-checkout: patches/deptry
persist-credentials: false
- name: Apply patches
run: git apply -v python-wheels/patches/deptry/${{ env.DEPTRY_VERSION }}/*.patch
# pyproject.toml carries a stale placeholder version; upstream's own release
# job stamps the real one from the tag the same way (release.yml set-version).
- name: Set version from tag
run: |
sed -i "s/^version = \".*\"/version = \"${DEPTRY_VERSION}\"/" pyproject.toml
grep -qx "version = \"${DEPTRY_VERSION}\"" pyproject.toml
- name: Build wheels
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
with:
output-dir: wheelhouse/
env:
# Cargo.toml's pyo3 dependency carries abi3-py310 unconditionally
# (gotcha 181), so every interpreter below reuses the cp310 build
# ("Found previously built wheel ... Skipping build step").
CIBW_BUILD: >-
cp310-manylinux_riscv64 cp311-manylinux_riscv64 cp312-manylinux_riscv64
cp313-manylinux_riscv64 cp314-manylinux_riscv64
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
# deptry ships no [tool.cibuildwheel]; the Rust toolchain its maturin
# backend needs is installed in-container here (gotcha 10).
CIBW_BEFORE_ALL_LINUX: >-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
CIBW_ENVIRONMENT_LINUX: >-
PATH="$PATH:$HOME/.cargo/bin"
PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/
# poetry pulls keyring -> SecretStorage -> cryptography on Linux; without
# this pip resolves a cryptography release newer than our registry has a
# riscv64 wheel for and tries (and fails) to build it from source.
CIBW_TEST_ENVIRONMENT: PYTHONIOENCODING=utf-8 PIP_ONLY_BINARY=cryptography
# tests/unit/test_core.py's test_text_reporter_only/test_all_reporters
# run deptry against cwd's own pyproject.toml (mirroring upstream's
# `uv run deptry python` quality-job step), so it has to be staged too.
CIBW_TEST_SOURCES: tests pyproject.toml
CIBW_TEST_REQUIRES: >-
pytest==9.0.2 pytest-cov==7.0.0 "pytest-xdist[psutil]==3.8.0"
inline-snapshot==0.32.5 pdm==2.26.6 poetry==2.3.2 uv
# tests/functional's conftest normally rebuilds its own wheel with `uv
# build` to install into the poetry/pdm/uv/pip venv fixtures; our patch
# points it at the wheel cibuildwheel already built and repaired
# instead of paying for a second from-scratch native Rust compile.
CIBW_TEST_COMMAND: >-
python -c "import deptry.rust as m; assert m.__file__.endswith('.so'), m.__file__" &&
python -m pytest tests/unit -v &&
DEPTRY_PREBUILT_WHEEL={wheel} python -m pytest tests/functional -n auto --dist loadgroup -v
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: deptry-${{ env.DEPTRY_VERSION }}-cp310-abi3-manylinux_riscv64
path: wheelhouse/*.whl
if-no-files-found: error
publish:
name: Publish deptry ${{ inputs.version || '0.25.1' }}
needs: [setup, build_wheels]
permissions:
contents: write
pull-requests: write
uses: $/.github/workflows/_publish-wheel.yml
with:
artifact-pattern: deptry-${{ inputs.version || '0.25.1' }}-*-manylinux_riscv64