|
1 | | -name: Publish PyDP |
2 | | - |
3 | | -on: |
4 | | - release: |
5 | | - types: [published] |
6 | | - |
7 | | -jobs: |
8 | | - deploy: |
9 | | - strategy: |
10 | | - fail-fast: false |
11 | | - max-parallel: 12 |
12 | | - matrix: |
13 | | - # TODO: fix for Mac and Windows. |
14 | | - os: [ubuntu-latest, macos-latest] |
15 | | - python-version: [3.11, 3.12, 3.13, 3.14] |
16 | | - runs-on: ${{ matrix.os }} |
17 | | - |
18 | | - steps: |
19 | | - - uses: actions/checkout@v4 |
20 | | - with: |
21 | | - submodules: true |
22 | | - |
23 | | - - name: Set up Python ${{ matrix.python-version }} |
24 | | - uses: actions/setup-python@v5 |
25 | | - with: |
26 | | - python-version: ${{ matrix.python-version }} |
27 | | - |
28 | | - - name: Setup msbuild Windows |
29 | | - if: runner.os == 'Windows' |
30 | | - uses: microsoft/setup-msbuild@v1.0.2 |
31 | | - |
32 | | - - name: Fix Paths Windows |
33 | | - # Make sure that tar.exe from Git is used not from Windows |
34 | | - if: runner.os == 'Windows' |
35 | | - run: | |
36 | | - @("C:\Program Files\Git\usr\bin") + (Get-Content $env:GITHUB_PATH) | Set-Content $env:GITHUB_PATH -Encoding utf8 |
37 | | -
|
38 | | - - name: Update environment variables Windows |
39 | | - if: runner.os == 'Windows' |
40 | | - # See: |
41 | | - # - On Bazel cache: https://docs.bazel.build/versions/master/output_directories.html |
42 | | - run: | |
43 | | - echo "BAZEL_CACHE_DIR=$env:USERPROFILE\_bazel_$env:USERNAME" >> $env:GITHUB_ENV |
44 | | -
|
45 | | - - name: Cache Bazel Windows |
46 | | - if: runner.os == 'Windows' |
47 | | - # https://stackoverflow.com/questions/66870002/github-actions-cache-maven-m2-repository-on-windows-environment-c-users-run |
48 | | - uses: actions/cache@v4 |
49 | | - with: |
50 | | - path: | |
51 | | - ./bazel-cache |
52 | | - key: ${{ runner.os }}-bazel-${{ hashFiles('WORKSPACE') }} |
53 | | - |
54 | | - - name: Build Google DP and wheel on Linux |
55 | | - if: runner.os == 'Linux' |
56 | | - timeout-minutes: 20 |
57 | | - shell: bash |
58 | | - run: | |
59 | | - pip install cibuildwheel |
60 | | - export CIBW_PLATFORM=linux |
61 | | - # Set for which Python version to build. |
62 | | - system_python_version=${{ matrix.python-version }} |
63 | | - py_version=${system_python_version//.} # 3.11 -> 311 |
64 | | - export CIBW_BUILD=cp${py_version}-manylinux_x86_64 |
65 | | - export CIBW_BUILD_VERBOSITY=1 |
66 | | - export CIBW_BEFORE_ALL_LINUX="yum install -y openssl-devel || dnf install -y openssl-devel || apt-get install -y libssl-dev" |
67 | | - # Build wheel |
68 | | - echo "Building ${CIBW_BUILD} wheel" |
69 | | - python -m cibuildwheel --output-dir dist . |
70 | | - - name: Archive Linux build artifacts |
71 | | - # more details https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts |
72 | | - if: runner.os == 'Linux' |
73 | | - uses: actions/upload-artifact@v4 |
74 | | - with: |
75 | | - name: dist-linux-py${{ matrix.python-version }} |
76 | | - path: | |
77 | | - dist |
78 | | - retention-days: 2 |
79 | | - |
80 | | - - name: Build Google DP Mac |
81 | | - if: runner.os == 'macOS' |
82 | | - timeout-minutes: 20 |
83 | | - run: | |
84 | | - bash build_PyDP.sh |
85 | | -
|
86 | | - - name: Build Google DP Windows |
87 | | - if: runner.os == 'Windows' |
88 | | - timeout-minutes: 20 |
89 | | - run: | |
90 | | - $PYTHONHOME=$(python -c 'import sys; print(sys.executable);').replace('\', '/') |
91 | | - $PYTHONPATH=$(python -c "import sys; print([x for x in sys.path if 'site-packages' in x][0]);").replace('\', '/') |
92 | | - echo "PYTHONHOME=$PYTHONHOME" |
93 | | - echo "PYTHONPATH=$PYTHONPATH" |
94 | | - echo "Running: ${{ matrix.os }}" |
95 | | - bazel.exe --output_base ./bazel-cache build src/python:pydp --config windows --verbose_failures --action_env=PYTHON_BIN_PATH=$PYTHONHOME --action_env=PYTHON_LIB_PATH=$PYTHONPATH |
96 | | - copy ./bazel-bin/src/bindings/_pydp.so ./src/pydp/_pydp.pyd |
97 | | -
|
98 | | - - name: Upgrade pip |
99 | | - run: | |
100 | | - pip install --upgrade --user pip |
101 | | -
|
102 | | - - name: Install Poetry |
103 | | - run: | |
104 | | - pip install poetry |
105 | | -
|
106 | | - - name: Get poetry cache dir |
107 | | - id: poetry-cache |
108 | | - run: | |
109 | | - echo \"dir=$(poetry config cache-dir)\" >> $GITHUB_OUTPUT |
110 | | -
|
111 | | - - name: poetry cache |
112 | | - uses: actions/cache@v4 |
113 | | - with: |
114 | | - path: ${{ steps.poetry-cache.outputs.dir }} |
115 | | - key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }} |
116 | | - restore-keys: | |
117 | | - ${{ runner.os }}-pip-py${{ matrix.python-version }}- |
118 | | -
|
119 | | - - name: Install dependencies |
120 | | - run: | |
121 | | - poetry install |
122 | | -
|
123 | | - - name: Build PyDP macOS wheel |
124 | | - if: runner.os == 'macOS' |
125 | | - run: | |
126 | | - poetry run python setup.py build bdist_wheel |
127 | | -
|
128 | | - - name: Build PyDP Windows wheel |
129 | | - if: runner.os == 'Windows' |
130 | | - run: | |
131 | | - poetry run python setup.py build bdist_wheel |
132 | | -
|
133 | | - - name: Install Wheel Unix |
134 | | - if: runner.os != 'Windows' |
135 | | - run: | |
136 | | - pip install `find -L ./ -name "*.whl"` |
137 | | -
|
138 | | - - name: Install Wheel Windows |
139 | | - if: runner.os == 'Windows' |
140 | | - run: | |
141 | | - Get-ChildItem -Path ./ -Filter "*.whl" -Recurse -File | foreach {pip install $_.FullName} |
142 | | -
|
143 | | - - name: Import Package |
144 | | - run: | |
145 | | - python -c "import pydp; print(pydp.__version__)" |
146 | | -
|
147 | | - - name: Run Pytest |
148 | | - if: runner.os != 'Linux' |
149 | | - # TODO(dvadym): fix tests. |
150 | | - run: | |
151 | | - poetry run pytest tests -n auto |
152 | | -
|
153 | | - - name: Check Wheel Unix |
154 | | - if: runner.os != 'Windows' |
155 | | - run: | |
156 | | - poetry run twine check `find -L ./ -name "*.whl"` |
157 | | -
|
158 | | - - name: Check Wheel Windows |
159 | | - if: runner.os == 'Windows' |
160 | | - run: | |
161 | | - Get-ChildItem -Path ./ -Filter "*.whl" -Recurse -File | foreach {poetry run twine check $_.FullName} |
162 | | -
|
163 | | - - name: Publishing the wheel |
164 | | - env: |
165 | | - TWINE_USERNAME: __token__ |
166 | | - TWINE_PASSWORD: ${{ secrets.TOKEN }} |
167 | | - run: | |
168 | | - poetry run twine upload --skip-existing dist/*.whl |
| 1 | +name: Publish PyDP |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + |
| 7 | +jobs: |
| 8 | + deploy: |
| 9 | + strategy: |
| 10 | + fail-fast: false |
| 11 | + max-parallel: 12 |
| 12 | + matrix: |
| 13 | + # TODO: fix for Mac and Windows. |
| 14 | + os: [ubuntu-latest] |
| 15 | + python-version: [3.11, 3.12, 3.13, 3.14] |
| 16 | + runs-on: ${{ matrix.os }} |
| 17 | + |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v2 |
| 20 | + with: |
| 21 | + submodules: true |
| 22 | + |
| 23 | + - name: Set up Python ${{ matrix.python-version }} |
| 24 | + uses: actions/setup-python@v2 |
| 25 | + with: |
| 26 | + python-version: ${{ matrix.python-version }} |
| 27 | + |
| 28 | + - name: Setup msbuild Windows |
| 29 | + if: runner.os == 'Windows' |
| 30 | + uses: microsoft/setup-msbuild@v1.0.2 |
| 31 | + |
| 32 | + - name: Fix Paths Windows |
| 33 | + # Make sure that tar.exe from Git is used not from Windows |
| 34 | + if: runner.os == 'Windows' |
| 35 | + run: | |
| 36 | + @("C:\Program Files\Git\usr\bin") + (Get-Content $env:GITHUB_PATH) | Set-Content $env:GITHUB_PATH -Encoding utf8 |
| 37 | +
|
| 38 | + - name: Update environment variables Windows |
| 39 | + if: runner.os == 'Windows' |
| 40 | + # See: |
| 41 | + # - On Bazel cache: https://docs.bazel.build/versions/master/output_directories.html |
| 42 | + run: | |
| 43 | + echo "BAZEL_CACHE_DIR=$env:USERPROFILE\_bazel_$env:USERNAME" >> $env:GITHUB_ENV |
| 44 | +
|
| 45 | + - name: Cache Bazel Windows |
| 46 | + if: runner.os == 'Windows' |
| 47 | + # https://stackoverflow.com/questions/66870002/github-actions-cache-maven-m2-repository-on-windows-environment-c-users-run |
| 48 | + uses: actions/cache@v4 |
| 49 | + with: |
| 50 | + path: | |
| 51 | + ./bazel-cache |
| 52 | + key: ${{ runner.os }}-bazel-${{ hashFiles('WORKSPACE') }} |
| 53 | + |
| 54 | + - name: Build Google DP and wheel on Linux |
| 55 | + if: runner.os == 'Linux' |
| 56 | + timeout-minutes: 20 |
| 57 | + shell: bash |
| 58 | + run: | |
| 59 | + pip install cibuildwheel |
| 60 | + export CIBW_PLATFORM=linux |
| 61 | + # Set for which Python version to build. |
| 62 | + system_python_version=${{ matrix.python-version }} |
| 63 | + py_version=${system_python_version//.} # 3.11 -> 311 |
| 64 | + export CIBW_BUILD=cp${py_version}-manylinux_x86_64 |
| 65 | + export CIBW_BUILD_VERBOSITY=1 |
| 66 | + export CIBW_BEFORE_ALL_LINUX="yum install -y openssl-devel || dnf install -y openssl-devel || apt-get install -y libssl-dev" |
| 67 | + # Build wheel |
| 68 | + echo "Building ${CIBW_BUILD} wheel" |
| 69 | + python -m cibuildwheel --output-dir dist . |
| 70 | + - name: Archive Linux build artifacts |
| 71 | + # more details https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts |
| 72 | + if: runner.os == 'Linux' |
| 73 | + uses: actions/upload-artifact@v4 |
| 74 | + with: |
| 75 | + name: dist-linux-py${{ matrix.python-version }} |
| 76 | + path: | |
| 77 | + dist |
| 78 | + retention-days: 2 |
| 79 | + |
| 80 | + - name: Build Google DP Mac |
| 81 | + if: runner.os == 'macOS' |
| 82 | + timeout-minutes: 20 |
| 83 | + run: | |
| 84 | + bash build_PyDP.sh |
| 85 | +
|
| 86 | + - name: Build Google DP Windows |
| 87 | + if: runner.os == 'Windows' |
| 88 | + timeout-minutes: 20 |
| 89 | + run: | |
| 90 | + $PYTHONHOME=$(python -c 'import sys; print(sys.executable);').replace('\', '/') |
| 91 | + $PYTHONPATH=$(python -c "import sys; print([x for x in sys.path if 'site-packages' in x][0]);").replace('\', '/') |
| 92 | + echo "PYTHONHOME=$PYTHONHOME" |
| 93 | + echo "PYTHONPATH=$PYTHONPATH" |
| 94 | + echo "Running: ${{ matrix.os }}" |
| 95 | + bazel.exe --output_base ./bazel-cache build src/python:pydp --config windows --verbose_failures --action_env=PYTHON_BIN_PATH=$PYTHONHOME --action_env=PYTHON_LIB_PATH=$PYTHONPATH |
| 96 | + copy ./bazel-bin/src/bindings/_pydp.so ./src/pydp/_pydp.pyd |
| 97 | +
|
| 98 | + - name: Upgrade pip |
| 99 | + run: | |
| 100 | + pip install --upgrade --user pip |
| 101 | +
|
| 102 | + - name: Install Poetry |
| 103 | + run: | |
| 104 | + pip install poetry |
| 105 | +
|
| 106 | + - name: Get poetry cache dir |
| 107 | + id: poetry-cache |
| 108 | + run: | |
| 109 | + echo "::set-output name=dir::$(poetry config cache-dir)" |
| 110 | +
|
| 111 | + - name: poetry cache |
| 112 | + uses: actions/cache@v4 |
| 113 | + with: |
| 114 | + path: ${{ steps.poetry-cache.outputs.dir }} |
| 115 | + key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }} |
| 116 | + restore-keys: | |
| 117 | + ${{ runner.os }}-pip-py${{ matrix.python-version }}- |
| 118 | +
|
| 119 | + - name: Install dependencies |
| 120 | + run: | |
| 121 | + poetry install |
| 122 | +
|
| 123 | + - name: Build PyDP macOS wheel |
| 124 | + if: runner.os == 'macOS' |
| 125 | + run: | |
| 126 | + poetry run python setup.py build bdist_wheel --plat-name macosx_10_14_x86_64 |
| 127 | +
|
| 128 | + - name: Build PyDP Windows wheel |
| 129 | + if: runner.os == 'Windows' |
| 130 | + run: | |
| 131 | + poetry run python setup.py build bdist_wheel |
| 132 | +
|
| 133 | + - name: Install Wheel Unix |
| 134 | + if: runner.os != 'Windows' |
| 135 | + run: | |
| 136 | + pip install `find -L ./ -name "*.whl"` |
| 137 | +
|
| 138 | + - name: Install Wheel Windows |
| 139 | + if: runner.os == 'Windows' |
| 140 | + run: | |
| 141 | + Get-ChildItem -Path ./ -Filter "*.whl" -Recurse -File | foreach {pip install $_.FullName} |
| 142 | +
|
| 143 | + - name: Import Package |
| 144 | + run: | |
| 145 | + python -c "import pydp; print(pydp.__version__)" |
| 146 | +
|
| 147 | + - name: Run Pytest |
| 148 | + if: runner.os != 'Linux' |
| 149 | + # TODO(dvadym): fix tests. |
| 150 | + run: | |
| 151 | + poetry run pytest tests -n auto |
| 152 | +
|
| 153 | + - name: Check Wheel Unix |
| 154 | + if: runner.os != 'Windows' |
| 155 | + run: | |
| 156 | + poetry run twine check `find -L ./ -name "*.whl"` |
| 157 | +
|
| 158 | + - name: Check Wheel Windows |
| 159 | + if: runner.os == 'Windows' |
| 160 | + run: | |
| 161 | + Get-ChildItem -Path ./ -Filter "*.whl" -Recurse -File | foreach {poetry run twine check $_.FullName} |
| 162 | +
|
| 163 | + - name: Publishing the wheel |
| 164 | + env: |
| 165 | + TWINE_USERNAME: __token__ |
| 166 | + TWINE_PASSWORD: ${{ secrets.TOKEN }} |
| 167 | + run: | |
| 168 | + poetry run twine upload --skip-existing dist/*.whl |
0 commit comments