|
1 | | -# This is a basic workflow to help you get started with Actions |
2 | | - |
3 | 1 | name: Build, Test & Publush |
4 | 2 |
|
5 | 3 | # Controls when the action will run. |
@@ -75,121 +73,15 @@ jobs: |
75 | 73 | python -m unittest discover -v -s tests -p '*.py' |
76 | 74 | shell: bash |
77 | 75 |
|
78 | | - build_bin_wheels: |
79 | | - needs: build_and_test_python |
80 | | - runs-on: ubuntu-latest |
| 76 | + build_wheels: |
81 | 77 | permissions: |
82 | 78 | packages: write |
83 | | - env: |
84 | | - PY_VER: ${{ matrix.python-version }} |
85 | | - BASE_IMAGE: quay.io/pypa/manylinux_${{ matrix.mnl-version }}:latest |
86 | | - GHCR_REPO: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }} |
87 | | - strategy: |
88 | | - fail-fast: false |
89 | | - matrix: |
90 | | - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] |
91 | | - mnl-version: ['2_28', '2_34'] |
92 | | - steps: |
93 | | - - name: Set up Python ${{ env.PY_VER }} |
94 | | - uses: actions/setup-python@v5 |
95 | | - with: |
96 | | - python-version: ${{ env.PY_VER }} |
97 | | - |
98 | | - - uses: actions/checkout@v4 |
99 | | - |
100 | | - - name: Set up QEMU |
101 | | - uses: docker/setup-qemu-action@v3 |
102 | | - |
103 | | - - name: Set up Docker Buildx |
104 | | - uses: docker/setup-buildx-action@v3 |
105 | | - |
106 | | - - name: Login to GitHub Container Registry |
107 | | - uses: docker/login-action@v3 |
108 | | - if: github.event_name != 'pull_request' |
109 | | - with: |
110 | | - registry: ghcr.io |
111 | | - username: ${{ github.repository_owner }} |
112 | | - password: ${{ secrets.GITHUB_TOKEN }} |
113 | | - |
114 | | - - name: Set dynamic environment |
115 | | - id: set-env |
116 | | - run: | |
117 | | - PLATFORMS="`docker manifest inspect ${{ env.BASE_IMAGE }} | \ |
118 | | - jq -r '.manifests[] | "\(.platform.os)/\(.platform.architecture)\(if .platform.variant != null then "/\(.platform.variant)" else "" end)"' | \ |
119 | | - sort -u | grep -v unknown | paste -sd ','`" |
120 | | - GIT_BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" |
121 | | - GIT_BRANCH="${GIT_BRANCH#refs/tags/}" |
122 | | - BUILD_IMAGE="${GHCR_REPO}:${GIT_BRANCH}-py${PY_VER}-mnl${{ matrix.mnl-version }}" |
123 | | - test "${{ github.event_name }}" != 'pull_request' && \ |
124 | | - CACHE_SPEC="type=registry,ref=${BUILD_IMAGE}-buildcache" || \ |
125 | | - CACHE_SPEC="gha" |
126 | | - echo "Platforms: ${PLATFORMS}" |
127 | | - echo "Build Image: ${BUILD_IMAGE}" |
128 | | - echo "PLATFORMS=${PLATFORMS}" >> $GITHUB_ENV |
129 | | - echo "CACHE_SPEC=${CACHE_SPEC}" >> $GITHUB_ENV |
130 | | -
|
131 | | - - name: Build Binary Wheels |
132 | | - uses: docker/build-push-action@v6 |
133 | | - with: |
134 | | - context: . |
135 | | - file: ./docker/Dockerfile.python_wheels |
136 | | - build-args: | |
137 | | - BASE_IMAGE=${{ env.BASE_IMAGE }} |
138 | | - PY_VER=${{ env.PY_VER }} |
139 | | - platforms: ${{ env.PLATFORMS }} |
140 | | - push: false |
141 | | - outputs: type=local,dest=dist_out |
142 | | - cache-from: ${{ env.CACHE_SPEC }} |
143 | | - cache-to: ${{ env.CACHE_SPEC }},mode=max |
144 | | - |
145 | | - - name: Collect Wheels |
146 | | - run: | |
147 | | - mkdir dist |
148 | | - mv `find dist_out -type f -name \*.whl` dist |
149 | | - rm -r dist_out |
150 | | -
|
151 | | - - name: Upload built wheels |
152 | | - uses: actions/upload-artifact@v4 |
153 | | - with: |
154 | | - name: dist-py${{ env.PY_VER }}-mnl${{ matrix.mnl-version }} |
155 | | - path: dist |
| 79 | + needs: build_and_test_python |
| 80 | + uses: sippy/cimagic/.github/workflows/BuildPythonWheels.yml@v1 |
156 | 81 |
|
157 | | - publish_pypi: |
158 | | - needs: build_bin_wheels |
159 | | - runs-on: ubuntu-latest |
160 | | - environment: |
161 | | - name: pypi |
162 | | - url: https://pypi.org/p/asyncproxy |
| 82 | + publish_all_wheels: |
| 83 | + needs: build_wheels |
163 | 84 | permissions: |
164 | | - id-token: write |
165 | 85 | actions: read |
166 | 86 | contents: read |
167 | | - steps: |
168 | | - - uses: actions/checkout@v4 |
169 | | - |
170 | | - - name: Download all wheel artifacts |
171 | | - uses: actions/download-artifact@v4 |
172 | | - with: |
173 | | - path: dist |
174 | | - pattern: dist-* |
175 | | - merge-multiple: true |
176 | | - |
177 | | - - name: Set up Python |
178 | | - uses: actions/setup-python@v5 |
179 | | - with: |
180 | | - python-version: '3.x' |
181 | | - |
182 | | - - name: Install dependencies |
183 | | - run: | |
184 | | - python -m pip install --upgrade pip |
185 | | - pip install --upgrade build setuptools wheel |
186 | | -
|
187 | | - - name: build |
188 | | - run: python setup.py build sdist |
189 | | - |
190 | | - - name: Show context tree |
191 | | - run: ls -lR dist |
192 | | - |
193 | | - - name: Publish package distributions to PyPI |
194 | | - if: github.event_name == 'release' && github.event.action == 'created' |
195 | | - uses: pypa/gh-action-pypi-publish@release/v1 |
| 87 | + uses: sippy/cimagic/.github/workflows/PublishWheels.yml@v1 |
0 commit comments