Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
65 changes: 65 additions & 0 deletions .github/workflows/_build_windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build Windows Wheels

on: # yamllint disable-line rule:truthy
workflow_call:
inputs:
test-matrix:
type: string
required: true

defaults:
run:
shell: bash

jobs:
wheel:
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(inputs.test-matrix) }}

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Install dependencies
uses: ./.github/actions/setup
with:
python-version: ${{ matrix.python-version }}
torch-version: ${{ matrix.torch-version }}
cuda-version: ${{ matrix.cuda-version }}

- name: Set version
run: |
VERSION=`sed -n "s/^__version__ = '\(.*\)'/\1/p" pyg_lib/__init__.py`
TORCH_VERSION=`echo "pt${{ matrix.torch-version }}" | sed "s/..$//" | sed "s/\.//g"`
CUDA_VERSION=`echo ${{ matrix.cuda-version }}`
echo "New version name: $VERSION+$TORCH_VERSION$CUDA_VERSION"
sed -i "s/$VERSION/$VERSION+$TORCH_VERSION$CUDA_VERSION/" setup.py
sed -i "s/$VERSION/$VERSION+$TORCH_VERSION$CUDA_VERSION/" pyg_lib/__init__.py

- name: Build wheel
run: |
source ./.github/workflows/cuda/Windows-env.sh ${{ matrix.cuda-version }}
echo $TORCH_CUDA_ARCH_LIST
pip install build
python -m build --wheel --no-isolation --outdir dist

- name: Install wheel
run: |
cd dist
ls -lah
pip install *.whl
python -c "import pyg_lib; print('pyg-lib:', pyg_lib.__version__)"
python -c "import pyg_lib; print('CUDA:', pyg_lib.cuda_version())"
python -c "import pyg_lib.ops"
python -c "import pyg_lib.sampler"
cd ..

- name: Test wheel
run: |
pip install pytest pytest-cov
pytest --cov --cov-report=xml
42 changes: 41 additions & 1 deletion .github/workflows/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ jobs:
runs-on: ubuntu-latest
outputs:
linux-matrix: ${{ steps.set-matrix.outputs.linux-matrix }}
linux-trigger: ${{ steps.set-matrix.outputs.linux-trigger }}
macos-matrix: ${{ steps.set-matrix.outputs.macos-matrix }}
macos-trigger: ${{ steps.set-matrix.outputs.macos-trigger }}
windows-matrix: ${{ steps.set-matrix.outputs.windows-matrix }}
windows-trigger: ${{ steps.set-matrix.outputs.windows-trigger }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

# TODO: Filter out the matrix.json based on PR changes or labels.
- name: Configure matrix
id: set-matrix
run: |
Expand All @@ -34,20 +37,57 @@ jobs:
matrix=$(jq -c '[.[] | { "torch-version": .["torch-version"], "python-version": .["python-version"][], "cuda-version": .["cuda-version"][] }]' $filename)
echo "linux-matrix=$matrix" >> $GITHUB_OUTPUT
echo "linux-matrix=$matrix"
trigger=${{ contains(github.event.pull_request.labels.*.name, 'os: linux') }}
echo "linux-trigger=$trigger" >> $GITHUB_OUTPUT
echo "linux-trigger=$trigger"

# Set macOS matrix
matrix=$(jq -c '[.[] | { "torch-version": .["torch-version"], "python-version": .["python-version"][], "cuda-version": "cpu" }]' $filename)
echo "macos-matrix=$matrix" >> $GITHUB_OUTPUT
echo "macos-matrix=$matrix"
trigger=${{ contains(github.event.pull_request.labels.*.name, 'os: macos') }}
echo "macos-trigger=$trigger" >> $GITHUB_OUTPUT
echo "macos-trigger=$trigger"

# Set Windows matrix
matrix=$(jq -c '[.[] | { "torch-version": .["torch-version"], "python-version": .["python-version"][], "cuda-version": .["cuda-version"][] }]' $filename)
echo "windows-matrix=$matrix" >> $GITHUB_OUTPUT
echo "windows-matrix=$matrix"
trigger=${{ contains(github.event.pull_request.labels.*.name, 'os: windows') }}
echo "windows-trigger=$trigger" >> $GITHUB_OUTPUT
echo "windows-trigger=$trigger"

linux:
needs: [trigger]
if: ${{ github.event_name == 'pull_request' && needs.trigger.outputs.linux-trigger == 'true' }}
uses: ./.github/workflows/_build_linux.yml
with:
test-matrix: ${{ needs.trigger.outputs.linux-matrix }}

macos:
needs: [trigger]
if: ${{ github.event_name == 'pull_request' && needs.trigger.outputs.macos-trigger == 'true' }}
uses: ./.github/workflows/_build_macos.yml
with:
test-matrix: ${{ needs.trigger.outputs.macos-matrix }}

windows:
needs: [trigger]
if: ${{ github.event_name == 'pull_request' && needs.trigger.outputs.windows-trigger == 'true' }}
uses: ./.github/workflows/_build_windows.yml
with:
test-matrix: ${{ needs.trigger.outputs.windows-matrix }}

status:
needs: [linux, macos, windows]
runs-on: ubuntu-latest
if: always()
steps:
- name: Fail if any build failed or cancelled
if: ${{ contains(join(needs.*.result, ','), 'failure') || contains(join(needs.*.result, ','), 'cancelled') }}
run: |
echo "One or more builds failed or cancelled:"
echo "Linux: ${{ needs.linux.result }}"
echo "macOS: ${{ needs.macos.result }}"
echo "Windows: ${{ needs.windows.result }}"
exit 1
Loading