Use uv to run build python scripts #323
Workflow file for this run
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
| name: Build Pythia | |
| on: [push] | |
| env: | |
| PYTHON_VERSION: 3.10.13 | |
| jobs: | |
| Create-Interpreters: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [windows-2019, ubuntu-22.04] | |
| steps: | |
| - name: Cache interpreters | |
| uses: actions/cache@v3 | |
| id: cache | |
| with: | |
| path: python-${{ env.PYTHON_VERSION }}-${{ runner.os }}.tar | |
| key: interpreters-${{ env.PYTHON_VERSION }}-${{ runner.os }}-${{ secrets.CACHE_VERSION }} | |
| - name: Check out repository code | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| uses: actions/checkout@v3 | |
| - name: Install uv | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: "0.9.17" | |
| ignore-empty-workdir: true | |
| enable-cache: false | |
| - name: Create interpreters | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: uv run tools/build.py create_interpreters ${{ env.PYTHON_VERSION }} --dest . | |
| - name: Tar interpreters | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: tar cvf python-${{ env.PYTHON_VERSION }}-${{ runner.os }}.tar python-*-embed-* | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: _Internal_Python_Interpreters-${{ runner.os }} | |
| path: python-*.tar | |
| if-no-files-found: error | |
| retention-days: 1 | |
| Build-Binaries: | |
| needs: Create-Interpreters | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [windows-2019, ubuntu-22.04] | |
| arch: [x64, x86] | |
| steps: | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: "0.9.17" | |
| ignore-empty-workdir: true | |
| enable-cache: false | |
| - name: Check out repository code | |
| uses: actions/checkout@v3 | |
| - name: Create the directory | |
| run: mkdir "@Pythia" | |
| - name: Download the interpreters | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: _Internal_Python_Interpreters-${{ runner.os }} | |
| - name: Untar the interpreter | |
| run: tar xf ../python-${{ env.PYTHON_VERSION }}-${{ runner.os }}.tar | |
| working-directory: "@Pythia" | |
| # Build the extension | |
| - uses: ilammy/msvc-dev-cmd@v1 | |
| if: ${{ runner.os == 'Windows' }} | |
| with: | |
| arch: ${{ matrix.arch }} | |
| - name: Perform build | |
| run: uv run tools/build.py build_binaries ${{ env.PYTHON_VERSION }} ${{ matrix.arch }} ${{ runner.os }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: _Internal_Pythia_Binaries-${{ runner.os }}-${{ matrix.arch }} | |
| path: | | |
| @Pythia/*.dll | |
| @Pythia/*.so | |
| @Pythia/*.exe | |
| @Pythia/PythiaTester* | |
| if-no-files-found: error | |
| retention-days: 1 | |
| Build-PBO: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: "0.9.17" | |
| ignore-empty-workdir: true | |
| enable-cache: false | |
| - name: Check out repository code | |
| uses: actions/checkout@v3 | |
| - name: Cache tools | |
| uses: actions/cache@v3 | |
| with: | |
| path: tools/cache | |
| key: tools_cache | |
| # Build PBOs and pack | |
| - name: Install Mikero's tools | |
| uses: arma-actions/mikero-tools@bec8b18fc507ee3180cadeaf35249d3f2702b1ff | |
| - run: uv run tools/build.py build_pbos | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: _Internal_Pythia_PBOs | |
| path: | | |
| @Pythia/addons | |
| @Pythia/keys | |
| if-no-files-found: error | |
| retention-days: 1 | |
| Test-Binaries: | |
| needs: Build-Binaries | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [windows-2019, ubuntu-22.04] | |
| arch: [x64, x86] | |
| steps: | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: "0.9.17" | |
| ignore-empty-workdir: true | |
| enable-cache: false | |
| - name: Check out repository code | |
| uses: actions/checkout@v3 | |
| - name: Create the directory | |
| run: mkdir "@Pythia" | |
| - name: Download the interpreters | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: _Internal_Python_Interpreters-${{ runner.os }} | |
| - name: Untar the interpreter | |
| run: tar xf ../python-${{ env.PYTHON_VERSION }}-${{ runner.os }}.tar | |
| working-directory: "@Pythia" | |
| - name: Download the binaries | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: _Internal_Pythia_Binaries-${{ runner.os }}-${{ matrix.arch }} | |
| path: "@Pythia" | |
| - name: Set testers permissions | |
| run: chmod a+x @Pythia/PythiaTester* | |
| - name: Install multilib for compiling 32bit Cython extensions (in tests) | |
| if: runner.os == 'Linux' && matrix.arch == 'x86' | |
| run: sudo apt install -y gcc-multilib | |
| - name: Copy templates | |
| run: uv run tools/build.py copy_templates ${{ env.PYTHON_VERSION }} | |
| - name: Run basic tests | |
| run: uv run tools/build.py run_tests ${{ env.PYTHON_VERSION }} ${{ matrix.arch }} ${{ runner.os }} | |
| Consolidate: | |
| needs: | |
| - Create-Interpreters | |
| - Build-Binaries | |
| - Build-PBO | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: "0.9.17" | |
| ignore-empty-workdir: true | |
| enable-cache: false | |
| - name: Check out repository code | |
| uses: actions/checkout@v3 | |
| - name: Download the binaries | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: _Internal_Pythia_Binaries-* | |
| path: "@Pythia" | |
| merge-multiple: true | |
| - name: Download the PBOs | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: _Internal_Pythia_PBOs | |
| path: "@Pythia" | |
| - name: Download the interpreters | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: _Internal_Python_Interpreters-* | |
| merge-multiple: true | |
| - name: Set testers permissions | |
| run: chmod a+x @Pythia/PythiaTester* | |
| - name: Copy templates | |
| run: uv run tools/build.py copy_templates ${{ env.PYTHON_VERSION }} | |
| - name: Unpack interpreters | |
| run: for i in python-*.tar; do tar xf "$i" --directory "@Pythia"; done | |
| - run: uv run tools/build.py safety_checks ${{ env.PYTHON_VERSION }} | |
| - name: Remove linux 32bit Pythia | |
| run: rm -rf @Pythia/python-*-embed-linux32 @Pythia/Pythia.so @Pythia/PythiaSetPythonPath.so @Pythia/PythiaTester @Pythia/install_requirements32.sh | |
| - run: tar -jcf "@Pythia.tbz" "@Pythia" | |
| - uses: actions/upload-artifact@v4 | |
| # if: ${{ github.ref == 'refs/heads/master' }} | |
| with: | |
| name: Pythia | |
| path: "@Pythia.tbz" | |
| if-no-files-found: error | |
| retention-days: 8 | |
| # Deploy-dev: | |
| # needs: | |
| # - Consolidate | |
| # runs-on: ubuntu-latest | |
| # environment: Dev-deploy | |
| # steps: | |
| # - name: Download the release | |
| # uses: actions/download-artifact@v4 | |
| # with: | |
| # name: Pythia | |
| # | |
| # - name: Unpack the release | |
| # run: tar xf @Pythia.tbz | |
| # | |
| # - name: Upload to Workshop as Pythia-dev | |
| # uses: arma-actions/workshop-upload@v1 | |
| # if: github.event_name == 'push' && github.actor != 'depbot' | |
| # with: | |
| # appId: '107410' # default | |
| # itemId: '2705521455' # ID of item to update | |
| # contentPath: '@Pythia' | |
| # changelog: 'Automatic push by CI' | |
| # env: | |
| # STEAM_USERNAME: ${{ secrets.STEAM_USERNAME }} | |
| # STEAM_PASSWORD: ${{ secrets.STEAM_PASSWORD }} |