10000 feat: 更新 ffmpeg · loong64/pytorch@f86fd3c · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

build (torch)

build (torch) #105

Workflow file for this run

780F
name: build (torch)
on:
workflow_dispatch:
schedule:
- cron: 0 0 * * *
jobs:
check:
runs-on: ubuntu-latest
outputs:
create: ${{ steps.check_release.outputs.create }}
version: ${{ steps.get_version.outputs.version }}
strategy:
matrix:
app: ['torch']
repo: ['pytorch/pytorch']
steps:
- name: Check version
id: get_version
run: |
version=$(curl -s "https://api.github.com/repos/${{ matrix.repo }}/releases/latest" | jq -r .tag_name)
if [ -z "${version}" ] || [ "${version}" == "null" ]; then
echo "Failed to get version"
exit 1
fi
echo "version=${version}" >> $GITHUB_ENV
echo "version=${version}" >> $GITHUB_OUTPUT
echo ""
echo "========== Build Args =========="
echo "PyTorch current version: ${version}"
- name: Check release
id: check_release
run: |
gh release view ${version} -R ${{ github.repository }} >/dev/null 2>&1 || echo "create=1" >> $GITHUB_ENV
gh release view ${version} -R ${{ github.repository }} | grep ${{ matrix.app }}-.*.whl >/dev/null 2>&1 || echo "create=1" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
if: env.create == '1'
- name: Create tag
if: env.create == '1'
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git tag ${{ env.version }} || true
git push origin ${{ env.version }} || true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create release
if: env.create == '1'
run: |
gh release create ${{ env.version }} -R ${{ github.repository }} --title "PyTorch ${version/v/}" --notes "**Full Changelog**: [${{ env.version }}](https://github.com/${{ matrix.repo }}/releases/tag/${{ env.version }})" || true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
runs-on: ubuntu-latest
needs: check
if: needs.check.outputs.create == '1'
strategy:
fail-fast: false
matrix:
package: ['torch']
platform: ['cp39-manylinux_loongarch64', 'cp310-manylinux_loongarch64', 'cp311-manylinux_loongarch64', 'cp312-manylinux_loongarch64', 'cp313-manylinux_loongarch64']
steps:
- name: Checkout Code
run: |
app_version=${{ needs.check.outputs.version }}
wget -qO - https://github.com/pytorch/pytorch/releases/download/${app_version}/pytorch-${app_version}.tar.gz | tar xz --strip-components=1
if [ ! -f ".ci/docker/ci_commit_pins/nccl-cu12.txt" ]; then
mkdir -p .ci/docker/ci_commit_pins
wget -qO .ci/docker/ci_commit_pins/nccl-cu12.txt https://github.com/pytorch/pytorch/raw/refs/tags/${app_version}/.ci/docker/ci_commit_pins/nccl-cu12.txt || true
fi
cd third_party/sleef
wget -qO - https://github.com/loong64/pytorch/raw/refs/heads/main/sleef/sleef_loong64.patch | patch -p1
cd ../cpuinfo
wget -qO - https://github.com/loong64/pytorch/raw/refs/heads/main/cpuinfo/cpuinfo_loong64.patch | patch -p1
echo "PYTORCH_BUILD_NUMBER=1" >> $GITHUB_ENV
echo "PYTORCH_BUILD_VERSION=${app_version/v/}" >> $GITHUB_ENV
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Restore Cache
id: cache-restore
uses: actions/cache/restore@v4
with:
path: |
/home/runner/data/cache
key: ${{ matrix.package }}-${{ matrix.platform }}-${{ hashFiles('pyproject.toml') }}
restore-keys: ${{ matrix.package }}-${{ matrix.platform }}-
- name: Setup Cache
run: |
sudo mkdir -p /home/runner/data/cache/.cache
sudo chown -R root:docker /home/runner/data/cache
- name: Build wheels
uses: loong64/cibuildwheel@v2.23.2
env:
CIBW_MANYLINUX_LOONGARCH64_IMAGE: "ghcr.io/loong64/manylinuxloongarch64-builder:cpu-loongarch64"
CIBW_ARCHS: loongarch64
CIBW_BUILD: ${{ matrix.platform }}
CIBW_BUILD_VERBOSITY: 1
CIBW_BEFORE_ALL_LINUX: >
yum install -y ccache
CIBW_BEFORE_BUILD: >
pip install https://github.com/loong64/auditwheel/releases/download/6.2.0/auditwheel-6.2.0-py3-none-any.whl
CIBW_ENVIRONMENT_LINUX: >
BUILD_TEST=0
PYTORCH_BUILD_NUMBER=${{ env.PYTORCH_BUILD_NUMBER }}
PYTORCH_BUILD_VERSION=${{ env.PYTORCH_BUILD_VERSION }}
PIP_EXTRA_INDEX_URL="https://gitlab.com/api/v4/projects/65746188/packages/pypi/simple"
USE_CCACHE=1
PATH="/usr/lib64/ccache:$PATH"
CCACHE_DIR="/host/home/runner/data/cache/ccache"
CIBW_TEST_SKIP: "*"
- name: Cache permissions
if: always()
run: |
sudo chown -R runner:docker /home/runner/data/cache
- name: Save Cache
if: always()
id: cache-save
uses: actions/cache/save@v4
with:
path: /home/runner/data/cache
key: ${{ matrix.package }}-${{ matrix.platform }}-${{ hashFiles('pyproject.toml') }}
- name: Upload wheels
run: |
pip install twine==6.0.1
for file in wheelhouse/*.whl; do
twine upload --repository-url https://gitlab.com/api/v4/projects/65746188/packages/pypi $file || true
done
env:
TWINE_USERNAME: ${{ github.repository_owner }}
TWINE_PASSWORD: ${{ secrets.GL_TOKEN }}
- name: Upload release
run:
gh release upload ${{ needs.check.outputs.version }} -R ${{ github.repository }} wheelhouse/*.whl --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
0