From ba99a8e54e93a3bb9c5e18fee2541b6d44390f7e Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Wed, 13 Mar 2024 14:54:15 -0700 Subject: [PATCH] [ci][dartpy] Initial setup --- .github/workflows/publish_dartpy.yml | 200 +++++++++++++++++++++++++++ 1 file changed, 200 insertions(+) create mode 100644 .github/workflows/publish_dartpy.yml diff --git a/.github/workflows/publish_dartpy.yml b/.github/workflows/publish_dartpy.yml new file mode 100644 index 0000000000000..77cbd14bd4f73 --- /dev/null +++ b/.github/workflows/publish_dartpy.yml @@ -0,0 +1,200 @@ +name: Publish dartpy + +on: + push: + branches: + - "**" + schedule: + - cron: "0 10 * * 0,3" + +# This workflow will install Python dependencies, run tests and lint with a +# variety of Python versions. For more information see: +# - https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions +# - https://github.com/pypa/cibuildwheel/blob/main/examples/github-deploy.yml +jobs: + check_format: + name: Check format + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: 3.11 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install black -U + pip install isort -U + + - name: Check format + run: | + black --check --diff . + + - name: Check import + run: | + isort --check --diff . + + build_wheels: + name: ${{ matrix.os }}-${{ matrix.build }} + runs-on: ${{ matrix.os }} + continue-on-error: ${{ matrix.experimental }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + build: ["cp37-manylinux_x86_64"] + toolchain_file: [""] + experimental: [false] + release_only: [true] + + include: + - os: ubuntu-latest + build: "cp38-manylinux_x86_64" + toolchain_file: "" + experimental: false + release_only: true + + - os: ubuntu-latest + build: "cp39-manylinux_x86_64" + toolchain_file: "" + experimental: false + release_only: true + + - os: ubuntu-latest + build: "cp310-manylinux_x86_64" + toolchain_file: "" + experimental: false + release_only: true + + - os: ubuntu-latest + build: "cp311-manylinux_x86_64" + toolchain_file: "" + experimental: false + release_only: false + + - os: macos-latest + build: "cp38-macosx_x86_64" + toolchain_file: "" + experimental: false + release_only: true + + - os: macos-latest + build: "cp39-macosx_x86_64" + toolchain_file: "" + experimental: false + release_only: true + + - os: macos-latest + build: "cp310-macosx_x86_64" + toolchain_file: "" + experimental: false + release_only: true + + - os: macos-latest + build: "cp311-macosx_x86_64" + toolchain_file: "" + experimental: false + release_only: false + + - os: windows-latest + build: "cp38-win_amd64" + toolchain_file: C:/.dartsim/vcpkg/scripts/buildsystems/vcpkg.cmake + experimental: false + release_only: true + + - os: windows-latest + build: "cp39-win_amd64" + toolchain_file: C:/.dartsim/vcpkg/scripts/buildsystems/vcpkg.cmake + experimental: false + release_only: true + + - os: windows-latest + build: "cp310-win_amd64" + toolchain_file: C:/.dartsim/vcpkg/scripts/buildsystems/vcpkg.cmake + experimental: false + release_only: true + + - os: windows-latest + build: "cp311-win_amd64" + toolchain_file: C:/.dartsim/vcpkg/scripts/buildsystems/vcpkg.cmake + experimental: false + release_only: false + + - os: windows-latest + build: "cp311-win_arm64" + toolchain_file: C:/.dartsim/vcpkg/scripts/buildsystems/vcpkg.cmake + experimental: true + release_only: false + + env: + CIBW_BUILD: ${{ matrix.build }} + + steps: + - uses: actions/checkout@v4 + + - uses: johnwason/vcpkg-action@v6 + with: + pkgs: assimp ccd eigen3 fcl fmt spdlog bullet3 coin-or-ipopt freeglut glfw3 nlopt ode opengl osg pagmo2 pybind11 tinyxml2 urdfdom + triplet: x64-windows + revision: "2024.02.14" + github-binarycache: true + token: ${{ github.token }} + + - name: Build wheels + if: ${{ matrix.release_only == false || github.ref == 'refs/heads/main' }} + uses: pypa/cibuildwheel@v2.16.2 + env: + # Common + DART_IN_CI: ON + + # macOS + MACOSX_DEPLOYMENT_TARGET: 10.15 + + # Windows + CMAKE_TOOLCHAIN_FILE: ${{ matrix.toolchain_file }} + + - uses: actions/upload-artifact@v4 + with: + path: ./wheelhouse/*.whl + + # TODO: Disabled because installing from source doesn't work when the deps are not + # installed in the system + # build_sdist: + # name: Build source distribution + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v4 + + # - name: Build SDist + # run: pipx run build --sdist + + # - uses: actions/upload-artifact@v4 + # with: + # path: dist/*.tar.gz + + upload_pypi: + # needs: [build_wheels, build_sdist] + needs: [build_wheels] + runs-on: ubuntu-latest + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + # upload to PyPI on every tag starting with 'release-' + # if: github.event_name == 'push' && startsWith(github.ref, 'release-') + # alternatively, to publish when a GitHub Release is created, use the following rule: + # if: github.event_name == 'release' && github.event.action == 'published' + steps: + - uses: actions/download-artifact@v4 + with: + # unpacks default artifact into dist/ + # if `name: artifact` is omitted, the action will create extra parent dir + name: artifact + path: dist + + - uses: pypa/gh-action-pypi-publish@v1.8.11 + with: + user: __token__ + password: ${{ secrets.PYPI_TOKEN }} + # To test: repository_url: https://test.pypi.org/legacy/ + skip_existing: true