Fix dockerfile (#3405) #1147
Workflow file for this run
This file contains hidden or 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
| name: release | |
| on: | |
| schedule: | |
| - cron: '0 13 * * *' # This schedule runs every 13:00:00Z(21:00:00+08:00) | |
| # https://github.com/orgs/community/discussions/26286?utm_source=chatgpt.com#discussioncomment-3251208 | |
| # "The create event does not support branch filter and tag filter." | |
| # The "create tags" trigger is specifically focused on the creation of new tags, while the "push tags" trigger is activated when tags are pushed, including both new tag creations and updates to existing tags. | |
| push: | |
| tags: | |
| - 'v*.*.*' # normal release | |
| permissions: | |
| contents: write | |
| actions: read | |
| checks: read | |
| statuses: read | |
| # https://docs.github.com/en/actions/using-jobs/using-concurrency | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| prepare: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| release_tag: ${{ steps.prepare.outputs.release_tag }} | |
| prerelease: ${{ steps.prepare.outputs.prerelease }} | |
| steps: | |
| - name: Prepare release info | |
| id: prepare | |
| run: | | |
| if [[ ${GITHUB_EVENT_NAME} != 'schedule' ]]; then | |
| RELEASE_TAG=${GITHUB_REF#refs/tags/} | |
| if [[ ${RELEASE_TAG} == v* ]]; then | |
| PRERELEASE=false | |
| else | |
| PRERELEASE=true | |
| fi | |
| echo "Workflow triggered by push tag: ${RELEASE_TAG}" | |
| else | |
| RELEASE_TAG=nightly | |
| PRERELEASE=true | |
| echo "Workflow triggered by schedule" | |
| fi | |
| echo "release_tag=${RELEASE_TAG}" >> ${GITHUB_OUTPUT} | |
| echo "prerelease=${PRERELEASE}" >> ${GITHUB_OUTPUT} | |
| build: | |
| needs: prepare | |
| strategy: | |
| matrix: | |
| include: | |
| # - target: x64-v1 | |
| # builder_image: infiniflow/infinity-x64-x64-v1-builder:latest | |
| - target: x64-v2 | |
| builder_image: infiniflow/infinity-x64-x64-v2-builder:latest | |
| - target: x64-v3 | |
| builder_image: infiniflow/infinity-x64-x64-v3-builder:latest | |
| - target: x64-v4 | |
| builder_image: infiniflow/infinity-x64-x64-v4-builder:latest | |
| - target: arm64 | |
| builder_image: infiniflow/infinity-x64-arm64-builder:latest | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| - name: Start builder container | |
| run: | | |
| BUILDER_CONTAINER=infinity_builder | |
| echo "BUILDER_CONTAINER=${BUILDER_CONTAINER}" >> ${GITHUB_ENV} | |
| TZ=$(readlink -f /etc/localtime | awk -F '/zoneinfo/' '{print $2}') | |
| docker run -d --name ${BUILDER_CONTAINER} -e TZ=${TZ} -e UV_INDEX=https://pypi.org/simple/ -v ${PWD}:/infinity ${{ matrix.builder_image }} | |
| - name: Create libstdc++ modules JSON for cross-compilation | |
| run: | | |
| case ${{ matrix.target }} in | |
| x64-v1 | x64-v2 | x64-v3 | x64-v4) docker exec ${BUILDER_CONTAINER} bash -c "cp /infinity/.github/workflows/x64-x64-libstdc++.modules.json /x86_64-linux-gnu/lib/gcc/x86_64-linux-gnu/15.2.0/libstdc++.modules.json";; | |
| arm64) docker exec ${BUILDER_CONTAINER} bash -c "cp /infinity/.github/workflows/x64-arm64-libstdc++.modules.json /x86_64-aarch64-none-linux-gnu-15.2.1/lib/gcc/aarch64-none-linux-gnu/15.2.1/libstdc++.modules.json";; | |
| esac | |
| - name: Build release version | |
| env: | |
| RELEASE_TAG: ${{ needs.prepare.outputs.release_tag }} | |
| run: | | |
| case ${{ matrix.target }} in | |
| x64-v1) | |
| export TRIPLET=x64-linux-v1 | |
| export SYS_ROOT=/x86_64-linux-gnu/x86_64-linux-gnu/sysroot/ | |
| export GCC_TOOLCHAIN=/x86_64-linux-gnu/ | |
| export DEB_ARCH=amd64 | |
| export RPM_ARCH=x86_64 | |
| export PACKAGE_SUFFIX=v1 | |
| export CHAINLOAD_TOOLCHAIN=x86_64-linux-v1.cmake | |
| export STDLIB_MODULES_JSON=/x86_64-linux-gnu/lib/gcc/x86_64-linux-gnu/15.2.0/libstdc++.modules.json | |
| ;; | |
| x64-v2) | |
| export TRIPLET=x64-linux-v2 | |
| export SYS_ROOT=/x86_64-linux-gnu/x86_64-linux-gnu/sysroot/ | |
| export GCC_TOOLCHAIN=/x86_64-linux-gnu/ | |
| export DEB_ARCH=amd64 | |
| export RPM_ARCH=x86_64 | |
| export PACKAGE_SUFFIX=v2 | |
| export CHAINLOAD_TOOLCHAIN=x86_64-linux-v2.cmake | |
| export STDLIB_MODULES_JSON=/x86_64-linux-gnu/lib/gcc/x86_64-linux-gnu/15.2.0/libstdc++.modules.json | |
| ;; | |
| x64-v3) | |
| export TRIPLET=x64-linux-v3 | |
| export SYS_ROOT=/x86_64-linux-gnu/x86_64-linux-gnu/sysroot/ | |
| export GCC_TOOLCHAIN=/x86_64-linux-gnu/ | |
| export DEB_ARCH=amd64 | |
| export RPM_ARCH=x86_64 | |
| export PACKAGE_SUFFIX=v3 | |
| export CHAINLOAD_TOOLCHAIN=x86_64-linux-v3.cmake | |
| export STDLIB_MODULES_JSON=/x86_64-linux-gnu/lib/gcc/x86_64-linux-gnu/15.2.0/libstdc++.modules.json | |
| ;; | |
| x64-v4) | |
| export TRIPLET=x64-linux-v4 | |
| export SYS_ROOT=/x86_64-linux-gnu/x86_64-linux-gnu/sysroot/ | |
| export GCC_TOOLCHAIN=/x86_64-linux-gnu/ | |
| export DEB_ARCH=amd64 | |
| export RPM_ARCH=x86_64 | |
| export PACKAGE_SUFFIX=v4 | |
| export CHAINLOAD_TOOLCHAIN=x86_64-linux-v4.cmake | |
| export STDLIB_MODULES_JSON=/x86_64-linux-gnu/lib/gcc/x86_64-linux-gnu/15.2.0/libstdc++.modules.json | |
| ;; | |
| arm64) | |
| export TRIPLET=arm64-linux | |
| export SYS_ROOT=/x86_64-aarch64-none-linux-gnu-15.2.1/aarch64-none-linux-gnu/libc/ | |
| export GCC_TOOLCHAIN=/x86_64-aarch64-none-linux-gnu-15.2.1/ | |
| export DEB_ARCH=arm64 | |
| export RPM_ARCH=aarch64 | |
| export PACKAGE_SUFFIX= | |
| export CHAINLOAD_TOOLCHAIN=arm64-linux.cmake | |
| export STDLIB_MODULES_JSON=/x86_64-aarch64-none-linux-gnu-15.2.1/lib/gcc/aarch64-none-linux-gnu/15.2.1/libstdc++.modules.json | |
| ;; | |
| esac | |
| docker exec ${BUILDER_CONTAINER} bash -c "apt-fast -y update && apt-fast install -y rpm" | |
| docker exec ${BUILDER_CONTAINER} bash -c " | |
| git config --global safe.directory \"*\" && \ | |
| cd /infinity && rm -fr cmake-build-reldeb && mkdir -p cmake-build-reldeb && \ | |
| SYS_ROOT=${SYS_ROOT} GCC_TOOLCHAIN=${GCC_TOOLCHAIN} cmake -G Ninja \ | |
| -DCMAKE_C_COMPILER=clang-20 \ | |
| -DCMAKE_CXX_COMPILER=clang++-20 \ | |
| -DCMAKE_TOOLCHAIN_FILE=\$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake \ | |
| -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=\$PWD/cmake/toolchains/${CHAINLOAD_TOOLCHAIN} \ | |
| -DVCPKG_OVERLAY_TRIPLETS=\$PWD/cmake/triplets \ | |
| -DVCPKG_TARGET_TRIPLET=${TRIPLET} \ | |
| -DCMAKE_CXX_STDLIB_MODULES_JSON=${STDLIB_MODULES_JSON} \ | |
| -DCMAKE_BUILD_TYPE=RelWithDebInfo \ | |
| -DCPACK_PACKAGE_VERSION=${RELEASE_TAG} \ | |
| -DPACKAGE_SUFFIX=${PACKAGE_SUFFIX} \ | |
| -DCPACK_DEBIAN_PACKAGE_ARCHITECTURE=${DEB_ARCH} \ | |
| -DCPACK_RPM_PACKAGE_ARCHITECTURE=${RPM_ARCH} \ | |
| -S /infinity -B /infinity/cmake-build-reldeb && \ | |
| cmake --build /infinity/cmake-build-reldeb --target infinity && \ | |
| cd /infinity/cmake-build-reldeb && cpack" | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release-${{ matrix.target }} | |
| path: | | |
| cmake-build-reldeb/infinity-*.deb | |
| cmake-build-reldeb/infinity-*.rpm | |
| cmake-build-reldeb/infinity-*.tar.gz | |
| retention-days: 1 | |
| - name: Set up QEMU | |
| if: matrix.target == 'arm64' | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| platforms: arm64 | |
| - name: Set up Docker Buildx | |
| if: matrix.target == 'arm64' | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push image | |
| env: | |
| RELEASE_TAG: ${{ needs.prepare.outputs.release_tag }} | |
| run: | | |
| docker login --username infiniflow --password-stdin <<< ${{ secrets.DOCKERHUB_TOKEN }} | |
| if [[ "${{ matrix.target }}" == "arm64" ]]; then | |
| docker buildx build \ | |
| --platform linux/arm64 \ | |
| -t infiniflow/infinity:${RELEASE_TAG}-arm64 \ | |
| -f scripts/Dockerfile_infinity \ | |
| --push . | |
| else | |
| docker build \ | |
| -t infiniflow/infinity:${RELEASE_TAG}-${{ matrix.target }} \ | |
| -f scripts/Dockerfile_infinity . | |
| docker push infiniflow/infinity:${RELEASE_TAG}-${{ matrix.target }} | |
| fi | |
| release: | |
| needs: [prepare, build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| # - name: Download x64-v1 artifacts | |
| # uses: actions/download-artifact@v4 | |
| # with: | |
| # name: release-x64-v1 | |
| # path: artifacts/x64-v1 | |
| - name: Download x64-v2 artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: release-x64-v2 | |
| path: artifacts/x64-v2 | |
| - name: Download x64-v3 artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: release-x64-v3 | |
| path: artifacts/x64-v3 | |
| - name: Download x64-v4 artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: release-x64-v4 | |
| path: artifacts/x64-v4 | |
| - name: Download arm64 artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: release-arm64 | |
| path: artifacts/arm64 | |
| - name: Prepare release body | |
| env: | |
| RELEASE_TAG: ${{ needs.prepare.outputs.release_tag }} | |
| PRERELEASE: ${{ needs.prepare.outputs.prerelease }} | |
| run: | | |
| RELEASE_DATETIME=$(date --rfc-3339=seconds) | |
| cat <<EOF > release_body.md | |
| Release ${RELEASE_TAG} created from ${GITHUB_SHA} at ${RELEASE_DATETIME} | |
| EOF | |
| - name: Create release | |
| uses: softprops/action-gh-release@v2 | |
| env: | |
| RELEASE_TAG: ${{ needs.prepare.outputs.release_tag }} | |
| PRERELEASE: ${{ needs.prepare.outputs.prerelease }} | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| prerelease: ${{ env.PRERELEASE }} | |
| tag_name: ${{ env.RELEASE_TAG }} | |
| body_path: release_body.md | |
| files: | | |
| # artifacts/x64-v1/* | |
| artifacts/x64-v2/* | |
| artifacts/x64-v3/* | |
| artifacts/x64-v4/* | |
| artifacts/arm64/* | |
| tag: | |
| needs: [prepare, release] | |
| if: github.event_name == 'schedule' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-tags: true | |
| - name: Create mutable tag | |
| env: | |
| RELEASE_TAG: ${{ needs.prepare.outputs.release_tag }} | |
| run: | | |
| git tag -f ${RELEASE_TAG} ${GITHUB_SHA} | |
| git push -f origin ${RELEASE_TAG}:refs/tags/${RELEASE_TAG} | |
| # manifest: | |
| # needs: [prepare, build] | |
| # runs-on: ubuntu-latest | |
| # steps: | |
| # - name: Create and push multi-arch manifest | |
| # env: | |
| # RELEASE_TAG: ${{ needs.prepare.outputs.release_tag }} | |
| # run: | | |
| # docker login --username infiniflow --password-stdin <<< ${{ secrets.DOCKERHUB_TOKEN }} | |
| # docker manifest create infiniflow/infinity:${RELEASE_TAG} \ | |
| # infiniflow/infinity:${RELEASE_TAG}-x64-v1 \ | |
| # infiniflow/infinity:${RELEASE_TAG}-x64-v2 \ | |
| # infiniflow/infinity:${RELEASE_TAG}-x64-v3 \ | |
| # infiniflow/infinity:${RELEASE_TAG}-x64-v4 \ | |
| # infiniflow/infinity:${RELEASE_TAG}-arm64 | |
| # docker manifest push infiniflow/infinity:${RELEASE_TAG} | |
| infinity-sdk: | |
| needs: [prepare, release] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| - name: Build and push infinity-sdk | |
| run: | | |
| uv run --python 3.11 python/infinity_sdk/prepare_huqie.py && uv build && uv publish --token ${{ secrets.PYPI_API_TOKEN }} |