diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 496a58a4..4fed44a2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,11 +37,15 @@ jobs: - uses: actions/upload-artifact@v4 with: + name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} path: wheelhouse/*.whl build_wheels_macos: name: Build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash -el {0} strategy: fail-fast: false matrix: @@ -56,6 +60,11 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + + - uses: conda-incubator/setup-miniconda@v3 + with: + auto-update-conda: true + - name: Setup openmp for macOS run: | # Make sure to use a libomp version binary compatible with the oldest @@ -65,11 +74,13 @@ jobs: # supported macos version is: High Sierra / 10.13. When upgrading # this, be sure to update the MACOSX_DEPLOYMENT_TARGET environment # variable accordingly. Note that Darwin_17 == High Sierra / 10.13. - if [[ "$CIBW_ARCHS_MACOS" == arm64 ]]; then - # arm64 builds must cross compile because the CI instance is x86 - # This turns off the computation of the test program in - # tools/build_helpers.py - echo "PYTHON_CROSSENV=1" >> "$GITHUB_ENV" + if [[ "$CIBW_BUILD" == *-macosx_arm64 ]]; then + if [[ $(uname -m) == "x86_64" ]]; then + # arm64 builds must cross compile because the CI instance is x86 + # This turns off the computation of the test program in + # tools/build_helpers.py + echo "PYTHON_CROSSENV=1" >> "$GITHUB_ENV" + fi # SciPy requires 12.0 on arm to prevent kernel panics # https://github.com/scipy/scipy/issues/14688 @@ -84,18 +95,22 @@ jobs: # use conda to install llvm-openmp # Note that we do NOT activate the conda environment, we just add the # library install path to CFLAGS/CXXFLAGS/LDFLAGS below. - sudo conda create -n build $OPENMP_URL - PREFIX="/usr/local/miniconda/envs/build" - echo "CC=/usr/bin/clang" >> "$GITHUB_ENV" - echo "CPPFLAGS="$CPPFLAGS -Xpreprocessor -fopenmp"" >> "$GITHUB_ENV" - echo "CFLAGS="$CFLAGS -Wno-implicit-function-declaration -I$PREFIX/include"" >> "$GITHUB_ENV" - echo "LDFLAGS="$LDFLAGS -Wl,-S -Wl,-rpath,$PREFIX/lib -L$PREFIX/lib -lomp"" >> "$GITHUB_ENV" + conda create -n build $OPENMP_URL + PREFIX="$HOME/miniconda/envs/build" + + export CC=/usr/bin/clang + export CXX=/usr/bin/clang++ + export CPPFLAGS="$CPPFLAGS -Xpreprocessor -fopenmp" + export CFLAGS="$CFLAGS -I$PREFIX/include" + export CXXFLAGS="$CXXFLAGS -I$PREFIX/include" + export LDFLAGS="$LDFLAGS -Wl,-rpath,$PREFIX/lib -L$PREFIX/lib -lomp" - name: Build wheels uses: pypa/cibuildwheel@v2.22.0 - uses: actions/upload-artifact@v4 with: + name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} path: wheelhouse/*.whl build_sdist: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3a1c827d..ac54086c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,11 +15,9 @@ jobs: test: runs-on: ubuntu-latest strategy: - #max-parallel: 10 matrix: config: - python: "3.10" - - python: "3.11" - python: "3.12" split: [1, 2, 3, 4, 5, 6, 7, 8] @@ -49,10 +47,45 @@ jobs: - name: Test with pytest run: | - pytest --splits 8 --group ${{ matrix.split }} --durations-path tests/.test_durations tests + pytest --cov=smol --splits 8 --group ${{ matrix.split }} --durations-path tests/.test_durations tests - - if: ${{ matrix.config.python == '3.11' && github.event_name == 'push' }} - name: codacy-coverage-reporter + - name: Upload coverage + if: ${{ matrix.config.python == '3.12' && github.event_name == 'push' }} + uses: actions/upload-artifact@v4 + with: + include-hidden-files: true + name: .coverage${{ matrix.split }} + path: .coverage + if-no-files-found: error + + coverage: + runs-on: ubuntu-latest + needs: test + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: 3.12 + + - name: Install coverage + run: | + python -m pip install --upgrade pip + pip install coverage + + - name: Download all artifacts + # Downloads coverage1, coverage2, etc. + uses: actions/download-artifact@v4 + with: + pattern: .coverage* + merge-multiple: true + path: coverage + - name: Run coverage + run: | + coverage combine coverage/.coverage* + coverage xml + # coverage report --fail-under=85 + - name: codacy-coverage-reporter uses: codacy/codacy-coverage-reporter-action@v1 with: project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}