|
44 | 44 | repository: python/cpython |
45 | 45 | path: cpython |
46 | 46 | ref: "3.13" |
| 47 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 48 | + with: |
| 49 | + repository: numpy/numpy |
| 50 | + path: numpy |
| 51 | + submodules: true |
47 | 52 |
|
48 | 53 | - name: Restore cached CPython with TSAN |
49 | 54 | id: cache-cpython-tsan-restore |
|
67 | 72 | # Create archive to be used with bazel as hermetic python: |
68 | 73 | cd ${GITHUB_WORKSPACE} && tar -czpf python-tsan.tgz cpython-tsan |
69 | 74 |
|
70 | | - - name: Save CPython with TSAN |
| 75 | + - name: Save TSAN CPython |
71 | 76 | id: cache-cpython-tsan-save |
72 | 77 | if: steps.cache-cpython-tsan-restore.outputs.cache-hit != 'true' |
73 | 78 | uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 |
|
76 | 81 | ./python-tsan.tgz |
77 | 82 | key: ${{ runner.os }}-cpython-tsan-${{ hashFiles('cpython/configure.ac') }} |
78 | 83 |
|
| 84 | + - name: Get year & week number |
| 85 | + id: get-date |
| 86 | + run: echo "date=$(/bin/date "+%Y-%U")" >> $GITHUB_OUTPUT |
| 87 | + shell: bash -l {0} |
| 88 | + |
| 89 | + - name: Restore cached TSAN Numpy |
| 90 | + id: cache-numpy-tsan-restore |
| 91 | + uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 |
| 92 | + with: |
| 93 | + path: | |
| 94 | + ./wheelhouse |
| 95 | + key: ${{ runner.os }}-numpy-tsan-${{ hashFiles('numpy/pyproject.toml') }}-${{ steps.get-date.outputs.date }} |
| 96 | + |
| 97 | + - name: Build TSAN Numpy wheel |
| 98 | + if: steps.cache-numpy-tsan-restore.outputs.cache-hit != 'true' |
| 99 | + run: | |
| 100 | + cd numpy |
| 101 | +
|
| 102 | + # If we restored cpython from cache, we need to get python interpreter from python-tsan.tgz |
| 103 | + if [ ! -d ${GITHUB_WORKSPACE}/cpython-tsan/bin/ ]; then |
| 104 | + echo "Extract cpython from python-tsan.tgz" |
| 105 | + pushd . |
| 106 | + ls ${GITHUB_WORKSPACE}/python-tsan.tgz |
| 107 | + cd ${GITHUB_WORKSPACE} && tar -xzf python-tsan.tgz |
| 108 | + ls ${GITHUB_WORKSPACE}/cpython-tsan/bin/ |
| 109 | + popd |
| 110 | + fi |
| 111 | +
|
| 112 | + export PATH=${GITHUB_WORKSPACE}/cpython-tsan/bin/:$PATH |
| 113 | +
|
| 114 | + python3 -m pip install -r requirements/build_requirements.txt |
| 115 | + # Make sure to install a compatible Cython version (master branch is best for now) |
| 116 | + python3 -m pip install -U git+https://github.com/cython/cython |
| 117 | +
|
| 118 | + CC=clang-18 CXX=clang++-18 python3 -m pip wheel --wheel-dir dist -v . --no-build-isolation -Csetup-args=-Db_sanitize=thread -Csetup-args=-Dbuildtype=debugoptimized |
| 119 | +
|
| 120 | + # Create simple index and copy the wheel |
| 121 | + mkdir -p ${GITHUB_WORKSPACE}/wheelhouse/numpy |
| 122 | +
|
| 123 | + numpy_whl_name=($(cd dist && ls numpy*.whl)) |
| 124 | + if [ -z "${numpy_whl_name}" ]; then exit 1; fi |
| 125 | +
|
| 126 | + echo "Built TSAN Numpy wheel: ${numpy_whl_name}" |
| 127 | +
|
| 128 | + cp dist/${numpy_whl_name} ${GITHUB_WORKSPACE}/wheelhouse/numpy |
| 129 | +
|
| 130 | + cat << EOF > ${GITHUB_WORKSPACE}/wheelhouse/index.html |
| 131 | + <!DOCTYPE html><html><body> |
| 132 | + <a href="numpy">numpy></a></br> |
| 133 | + </body></html> |
| 134 | + EOF |
| 135 | +
|
| 136 | + cat << EOF > ${GITHUB_WORKSPACE}/wheelhouse/numpy/index.html |
| 137 | + <!DOCTYPE html><html><body> |
| 138 | + <a href="${numpy_whl_name}">${numpy_whl_name}</a></br> |
| 139 | + </body></html> |
| 140 | + EOF |
| 141 | +
|
| 142 | + - name: Save TSAN Numpy wheel |
| 143 | + id: cache-numpy-tsan-save |
| 144 | + if: steps.cache-numpy-tsan-restore.outputs.cache-hit != 'true' |
| 145 | + uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 |
| 146 | + with: |
| 147 | + path: | |
| 148 | + ./wheelhouse |
| 149 | + key: ${{ runner.os }}-numpy-tsan-${{ hashFiles('numpy/pyproject.toml') }}-${{ steps.get-date.outputs.date }} |
| 150 | + |
79 | 151 | - name: Build Jax and run tests |
80 | 152 | timeout-minutes: 120 |
81 | 153 | env: |
|
0 commit comments