1- name : samplerate
1+ name : pyroomacoustics
22
33on :
44 push :
88 types : [opened, synchronize, reopened, labeled]
99 workflow_dispatch :
1010
11+ permissions :
12+ contents : read
13+
1114jobs :
15+ setup-sofa :
16+ runs-on : ubuntu-latest
17+ steps :
18+ - uses : actions/checkout@v4
19+ - name : Cache SOFA data
20+ uses : actions/cache@v4
21+ with :
22+ path : pyroomacoustics/data/sofa
23+ key : sofa-data-${{ hashFiles('pyroomacoustics/data/sofa_files.json') }}
24+
1225 build_sdist :
26+ needs : setup-sofa
1327 runs-on : ubuntu-latest
1428 steps :
1529 - uses : actions/checkout@v6
@@ -52,15 +66,22 @@ jobs:
5266 with :
5367 submodules : recursive
5468 fetch-depth : 0
69+ - name : Restore SOFA data
70+ uses : actions/cache/restore@v4
71+ with :
72+ path : pyroomacoustics/data/sofa
73+ key : sofa-data-${{ hashFiles('pyroomacoustics/data/sofa_files.json') }}
5574 - uses : pypa/cibuildwheel@v3.4.0
5675 env :
5776 CIBW_BUILD : ${{ matrix.cibw_build }}
5877 CIBW_ARCHS : ${{ matrix.cibw_archs }}
5978 CIBW_MANYLINUX_X86_64_IMAGE : manylinux_2_28
6079 CIBW_TEST_REQUIRES : " pytest numpy scipy matplotlib python-sofa soxr"
6180 CIBW_TEST_COMMAND : " pytest {project}/tests"
81+ CIBW_ENVIRONMENT : PYROOMACOUSTICS_DATA_PATH={project}/pyroomacoustics/data/sofa
6282
6383 build_wheels :
84+ needs : setup-sofa
6485 if : >-
6586 github.event_name == 'push' ||
6687 github.event_name == 'workflow_dispatch' ||
@@ -69,71 +90,97 @@ jobs:
6990 strategy :
7091 fail-fast : false
7192 matrix :
72- os : [ubuntu-latest, macos-latest, windows-latest]
93+ include :
94+ # Linux x86_64
95+ - { os: ubuntu-latest, python: "cp39-*", arch: "x86_64" }
96+ - { os: ubuntu-latest, python: "cp310-*", arch: "x86_64" }
97+ - { os: ubuntu-latest, python: "cp311-*", arch: "x86_64" }
98+ - { os: ubuntu-latest, python: "cp312-*", arch: "x86_64" }
99+ - { os: ubuntu-latest, python: "cp313-*", arch: "x86_64" }
100+ - { os: ubuntu-latest, python: "cp314-*", arch: "x86_64" }
101+ # Linux aarch64
102+ - { os: ubuntu-latest, python: "cp311-*", arch: "aarch64" }
103+ - { os: ubuntu-latest, python: "cp312-*", arch: "aarch64" }
104+ - { os: ubuntu-latest, python: "cp313-*", arch: "aarch64" }
105+ - { os: ubuntu-latest, python: "cp314-*", arch: "aarch64" }
106+ # MacOS (universal2 builds both x86_64 and arm64)
107+ - { os: macos-latest, python: "cp39-*", arch: "universal2" }
108+ - { os: macos-latest, python: "cp310-*", arch: "universal2" }
109+ - { os: macos-latest, python: "cp311-*", arch: "universal2" }
110+ - { os: macos-latest, python: "cp312-*", arch: "universal2" }
111+ - { os: macos-latest, python: "cp313-*", arch: "universal2" }
112+ - { os: macos-latest, python: "cp314-*", arch: "universal2" }
113+ # Windows
114+ - { os: windows-latest, python: "cp39-*", arch: "AMD64" }
115+ - { os: windows-latest, python: "cp310-*", arch: "AMD64" }
116+ - { os: windows-latest, python: "cp311-*", arch: "AMD64" }
117+ - { os: windows-latest, python: "cp312-*", arch: "AMD64" }
118+ - { os: windows-latest, python: "cp313-*", arch: "AMD64" }
119+ - { os: windows-latest, python: "cp314-*", arch: "AMD64" }
73120 steps :
74121 - uses : actions/checkout@v6
75122 with :
76123 submodules : recursive
77124 fetch-depth : 0
78125 - name : Set up QEMU
79- if : runner.os == 'Linux'
126+ if : runner.os == 'Linux' && matrix.arch == 'aarch64'
80127 uses : docker/setup-qemu-action@v3
81128 with :
82129 platforms : all
130+ - name : Restore SOFA data
131+ uses : actions/cache/restore@v4
132+ with :
133+ path : pyroomacoustics/data/sofa
134+ key : sofa-data-${{ hashFiles('pyroomacoustics/data/sofa_files.json') }}
83135 - uses : pypa/cibuildwheel@v3.4.0
84136 env :
85- CIBW_BUILD : " cp39-* cp310-* cp311-* cp312-* cp313-* cp314-*"
86- CIBW_SKIP : " *-musllinux_* cp39-*aarch64 cp310-*aarch64"
87- CIBW_ARCHS_LINUX : " x86_64 aarch64"
88- CIBW_ARCHS_MACOS : " universal2"
89- CIBW_ARCHS_WINDOWS : " AMD64"
137+ CIBW_BUILD : ${{ matrix.python }}
138+ CIBW_ARCHS : ${{ matrix.arch }}
139+ CIBW_SKIP : " *-musllinux_*"
90140 CIBW_MANYLINUX_X86_64_IMAGE : manylinux_2_28
91141 CIBW_MANYLINUX_AARCH64_IMAGE : manylinux_2_28
92142 CIBW_TEST_REQUIRES : " pytest numpy scipy matplotlib python-sofa soxr"
93143 CIBW_TEST_COMMAND : " pytest {project}/tests"
94144 CIBW_TEST_SKIP : " cp314-*"
145+ CIBW_ENVIRONMENT : PYROOMACOUSTICS_DATA_PATH={project}/pyroomacoustics/data/sofa
95146 - uses : actions/upload-artifact@v6
96147 with :
97- name : wheels-${{ matrix.os }}
148+ name : cibw- wheels-${{ matrix.os }}-${{ matrix.arch }}-${{ strategy.job-index }}
98149 path : wheelhouse/*.whl
99150
100151 publish :
101152 needs : [build_sdist, build_wheels]
102153 runs-on : ubuntu-latest
103154 if : github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
155+ environment : pypi
156+ permissions :
157+ id-token : write # MANDATORY for OIDC publishing
104158 steps :
105- - uses : actions/download-artifact@v8
159+ - uses : actions/download-artifact@v4
106160 with :
107161 path : dist
108162 merge-multiple : true
109- - name : Validate wheels
110- run : |
111- pip install --upgrade twine packaging
112- twine check dist/*
113163 - name : Publish to PyPI
114- env :
115- TWINE_USERNAME : ${{ secrets.PYPI_USERNAME }}
116- TWINE_PASSWORD : ${{ secrets.PYPI_PASSWORD }}
117- run : |
118- twine upload --skip-existing dist/*
164+ uses : pypa/gh-action-pypi-publish@release/v1
165+ with :
166+ verbose : true
167+ attestations : false
119168
120169 publish-test :
121170 needs : [build_sdist, build_wheels]
122171 runs-on : ubuntu-latest
123172 if : github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/test-')
173+ environment : testpypi
174+ permissions :
175+ id-token : write # MANDATORY for OIDC publishing
124176 steps :
125- - uses : actions/download-artifact@v8
177+ - uses : actions/download-artifact@v4
126178 with :
127179 path : dist
128180 merge-multiple : true
129- - name : Validate wheels
130- run : |
131- pip install --upgrade twine packaging
132- twine check dist/*
133181 - name : Publish to PyPI Test
134- env :
135- TWINE_USERNAME : ${{ secrets.PYPITEST_USERNAME }}
136- TWINE_PASSWORD : ${{ secrets.PYPITEST_PASSWORD }}
137- TWINE_REPOSITORY_URL : https://test.pypi.org/legacy/
138- run : |
139- twine upload --skip-existing dist/*
182+ uses : pypa/gh-action-pypi-publish@release/v1
183+ with :
184+ repository-url : https://test.pypi.org/legacy/
185+ verbose : true
186+ attestations : false
0 commit comments