-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: yuchen.cc <[email protected]>
- Loading branch information
1 parent
bbf5fc5
commit ac06d28
Showing
2 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Build Wheel | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
|
||
jobs: | ||
build: | ||
name: "Build Release" | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python: ["3.8", "3.9", "3.10", "3.11", "3.12"] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Login ghcr.io | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Setup buildx instance | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
use: true | ||
- name: Build | ||
shell: bash | ||
run: | | ||
RELEASE_VERSION=${{ github.ref }} | ||
RELEASE_VERSION="${RELEASE_VERSION#refs/tags/v}" | ||
echo "RELEASE_VERSION=${RELEASE_VERSION}" | ||
PYTHON_VERSION=${{ matrix.python }} | ||
PYTHON_VERSION=${PYTHON_VERSION//./} | ||
echo "PYTHON_VERSION=${PYTHON_VERSION}" | ||
BUILD_IMAGE="ghcr.io/${GITHUB_REPOSITORY,,}/connector_builder:base" | ||
echo "BUILD_IMAGE=${BUILD_IMAGE}" | ||
RELEASE_IMAGE="ghcr.io/${GITHUB_REPOSITORY,,}/connector_builder:${RELEASE_VERSION}" | ||
echo "RELEASE_IMAGE=${RELEASE_IMAGE}" | ||
docker buildx build --build-arg BUILD_IMAGE=${BUILD_IMAGE} --build-arg RELEASE_IMAGE=${RELEASE_IMAGE} --build-arg PYTHON_VERSION=${PYTHON_VERSION} -f .github/workflows/build_wheel/Dockerfile -o dist/ . | ||
ls -l dist/ | ||
- name: Upload | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: dist | ||
path: dist/osstorchconnector* | ||
|
||
release: | ||
name: "Tagged Release" | ||
runs-on: ubuntu-latest | ||
needs: [build] | ||
steps: | ||
- name: Download builds and release notes | ||
uses: actions/download-artifact@v3 | ||
- name: Display downloaded files | ||
shell: bash | ||
run: | | ||
ls -l dist | ||
releasever=${{ github.ref }} | ||
releasever="${releasever#refs/tags/}" | ||
echo "RELEASE_VERSION=${releasever}" >> $GITHUB_ENV | ||
- name: Create Release | ||
uses: "marvinpinto/action-automatic-releases@latest" | ||
with: | ||
repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
automatic_release_tag: "${{ env.RELEASE_VERSION }}" | ||
prerelease: false | ||
files: dist/osstorchconnector* |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
ARG RELEASE_IMAGE | ||
ARG BUILD_IMAGE | ||
FROM ${RELEASE_IMAGE} AS release | ||
|
||
FROM ${BUILD_IMAGE} AS builder | ||
WORKDIR /libosstorchconnector | ||
COPY --from=release /libosstorchconnector . | ||
COPY . . | ||
ARG PYTHON_VERSION | ||
ENV PY_VER=${PYTHON_VERSION} | ||
RUN source /root/miniconda3/etc/profile.d/conda.sh && \ | ||
export PATH="/root/miniconda3/bin:$PATH" && \ | ||
conda activate py${PY_VER} && \ | ||
echo -e "[build_ext]\nlibrary_path=oss_connector.cpython-${PY_VER}-x86_64-linux-gnu.so" > setup.cfg && \ | ||
python3 -u setup.py bdist_wheel | ||
|
||
FROM scratch | ||
COPY --from=builder /libosstorchconnector/dist/osstorchconnector* / |