[NKI-628] make argument to register_alloc optional to be backward com… #2541
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Do not rename this file. It is used by name in the trusted publisher section | |
| # in pypi.org and test.pypi.org | |
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - '**' # For now, let's build all branches. Roll this back if it gets too slow or we exhaust our quota. | |
| tags: | |
| - 'v[0-9]+.[0-9]+.[0-9]+' # Build v1.2.3 tags as well. We'll use tags as the criteria for publishing | |
| # As long as we're building on all branch pushes, we do not need to run on pull requests. | |
| # If we stop that in the future, we'll want this back, so leaving in commented code. | |
| # pull_request: | |
| # branches: | |
| # - '**' # * does not match '/' like sm/my-feature | |
| workflow_dispatch: # For manually triggering a build: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#workflow_dispatch | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| # We mainly care about hardware rather than OS | |
| # macos-15 is x64 | |
| # macos-latest is arm64 | |
| # ubuntu-latest is x64 | |
| os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, macos-15] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install C libraries on Ubuntu | |
| if: startsWith(matrix.os, 'ubuntu') | |
| run: sudo apt-get update && sudo apt-get install -y zlib1g-dev libarchive-dev | |
| - name: Install C libraries on macOS | |
| if: startsWith(matrix.os, 'macos') | |
| run: brew install zlib libarchive | |
| # Build (and test) Lean. Tests are all via #guard macros | |
| # now so you can't really build without testing. | |
| - uses: leanprover/lean-action@v1 | |
| # Leaving in this workaround for some spurious crashes during the build, due to a bug in lean-action, | |
| # in case it's not really fixed. | |
| # https://github.com/leanprover/lean-action/issues/116#issuecomment-2663316227 | |
| # with: | |
| # use-github-cache: false | |
| - name: Run Lean tests | |
| run: lake exe klr | |
| - name: List library dependencies | |
| run: ./bin/check-libs ./.lake/build/bin/klr | |
| # temporarily disabled until after prod release | |
| #- name: Install Python | |
| # uses: actions/setup-python@v5 | |
| # with: | |
| # python-version: '3.x' | |
| # cache: 'pip' | |
| #- name: Install dependencies | |
| # working-directory: ./interop | |
| # run: | | |
| # python -m pip install --upgrade pip | |
| # pip install -r requirements.txt | |
| # temporarily disabled until we fix klr gather | |
| #- name: Run pytest | |
| # working-directory: ./interop | |
| # run: | | |
| # pytest | |
| # temporarily disabled until after prod release | |
| #- name: Make a wheel | |
| # # https://github.com/pypa/cibuildwheel | |
| # # Hit this: https://github.com/pypa/cibuildwheel/discussions/1926 | |
| # env: | |
| # # https://github.com/leanprover/lean4/pull/6631/files | |
| # MACOSX_DEPLOYMENT_TARGET: 99.0 | |
| # CIBW_BUILD_VERBOSITY: 1 | |
| # run: | | |
| # pip install cibuildwheel build | |
| # bin/make-wheel | |
| #- uses: actions/upload-artifact@v4 | |
| # with: | |
| # name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} | |
| # path: ./.wheel/wheelhouse/*.whl | |
| # Only upload sdist from an x64 linux machine. | |
| # In a normal python package the sdist would be identical regardless of which | |
| # platform/arch generated it. But we want to include klr.bin, which is | |
| # platform specific and currently built outside the normal python tool ecosystem. | |
| # So let's include the one platform-arch that's most useful to us right now. | |
| #- name: Upload sdist (Ubuntu x64 only) | |
| # if: matrix.os == 'ubuntu-latest' | |
| # uses: actions/upload-artifact@v4 | |
| # with: | |
| # name: sdist-${{ matrix.os }}-${{ strategy.job-index }} | |
| # path: ./.wheel/wheelhouse/*.tar.gz | |
| # Mostly followed guides here: | |
| # - https://github.com/pypa/gh-action-pypi-publish?tab=readme-ov-file | |
| # - https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ | |
| # NB: I needed to set the trusted publisher to repo NKL, not KLR, since that was its original name. Scary detail! No idea how I'd figure that out without knowing the original name. | |
| publish-to-testpypi: | |
| name: Publish Python 🐍 distribution 📦 to TestPyPI | |
| needs: | |
| - build | |
| if: startsWith(github.ref, 'refs/tags/') # only publish to pypi on tag pushes | |
| runs-on: ubuntu-latest | |
| # The `environment` just restricts the scope of trusted publishing. You | |
| # add this to the things you trust in the pypi UI. | |
| environment: | |
| name: testpypi | |
| permissions: | |
| id-token: write # IMPORTANT: mandatory for trusted publishing | |
| steps: | |
| - uses: actions/checkout@v4 # for scripts | |
| - name: Download all the dists | |
| uses: actions/download-artifact@v4 | |
| with: | |
| # name: python-package-distributions | |
| # # unpacks all CIBW artifacts into dist/ | |
| # pattern: cibw-* | |
| path: dist/ | |
| merge-multiple: true | |
| - name: List the wheels | |
| run: | | |
| ls -1 dist/ | |
| - name: Rename OSX wheels | |
| working-directory: ./dist | |
| run: ../bin/rename-wheels # .. because we are starting in ./dist | |
| - name: Publish distribution 📦 to TestPyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| verbose: true | |
| skip-existing: true | |
| # For this step to succeed, you must have bumped the klr version in interop/pyproject.toml | |
| publish-to-pypi: | |
| name: Publish Python 🐍 distribution 📦 to PyPI | |
| needs: | |
| - build | |
| if: startsWith(github.ref, 'refs/tags/') # only publish to pypi on tag pushes | |
| runs-on: ubuntu-latest | |
| # The `environment` just restricts the scope of trusted publishing. You | |
| # add this to the things you trust in the pypi UI. | |
| environment: | |
| name: pypi | |
| permissions: | |
| id-token: write # IMPORTANT: mandatory for trusted publishing | |
| steps: | |
| - uses: actions/checkout@v4 # for scripts | |
| - name: Download all the dists | |
| uses: actions/download-artifact@v4 | |
| with: | |
| # name: python-package-distributions | |
| # # unpacks all CIBW artifacts into dist/ | |
| # pattern: cibw-* | |
| path: dist/ | |
| merge-multiple: true | |
| - name: List the wheels | |
| run: | | |
| ls -1 dist/ | |
| - name: Rename OSX wheels | |
| working-directory: ./dist | |
| run: ../bin/rename-wheels # .. because we are starting in ./dist | |
| - name: Publish distribution 📦 to TestPyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| verbose: true |