fix(rtbot): wrong formating #78
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
| # Cut a release whenever a new tag is pushed to the repo. | ||
| # You should use an annotated tag, like `git tag -a v1.2.3` | ||
| # and put the release notes into the commit message for the tag. | ||
| name: Release | ||
| on: | ||
| push: | ||
| tags: | ||
| - "v*.*.*" | ||
| jobs: | ||
| tests: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - uses: pnpm/action-setup@v2.2.4 | ||
| with: | ||
| version: 8 | ||
| run_install: | | ||
| - args: [--no-frozen-lockfile] | ||
| - uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: 18.x | ||
| cache: pnpm | ||
| - uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: "3.11" | ||
| - name: Mount bazel caches | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: | | ||
| "~/.cache/bazel" | ||
| key: bazel-cache-${{ hashFiles('**/BUILD.bazel', '**/*.bzl', 'WORKSPACE', '**/*.cpp', '**/*.h', '**/*.rs') }} | ||
| restore-keys: bazel-cache- | ||
| - uses: bazelbuild/setup-bazelisk@v2 | ||
| - name: Test lib | ||
| run: | | ||
| bazelisk test //libs/core/test | ||
| - name: Test std | ||
| run: | | ||
| bazelisk test //libs/std/test | ||
| - name: Test api | ||
| run: | | ||
| bazelisk test //libs/api/test | ||
| - name: Test finance | ||
| run: | | ||
| bazelisk test //libs/finance/test | ||
| - name: Test python | ||
| run: | | ||
| bazelisk test --incompatible_use_python_toolchains=false --python_path=$(which python) //libs/wrappers/python:rtbot_test | ||
| - name: Test javascript | ||
| run: | | ||
| bazelisk test //libs/wrappers/javascript:test | ||
| build_npm: | ||
| name: Build npm package | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - uses: pnpm/action-setup@v2.2.4 | ||
| with: | ||
| version: 8 | ||
| run_install: | | ||
| - args: [--no-frozen-lockfile] | ||
| - name: Mount bazel caches | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: | | ||
| "~/.cache/bazel" | ||
| key: bazel-cache-${{ hashFiles('**/BUILD.bazel', '**/*.bzl', 'WORKSPACE', '**/*.cpp', '**/*.h', '**/*.rs') }} | ||
| restore-keys: bazel-cache- | ||
| - uses: bazelbuild/setup-bazelisk@v2 | ||
| - name: Build npm package | ||
| run: | | ||
| bazelisk build --stamp //libs/wrappers/javascript:js | ||
| - uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: npm-wasm.tar | ||
| path: dist/bin/libs/api/js | ||
| - uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: npm-rtbot.tar | ||
| path: dist/bin/libs/wrappers/javascript/js | ||
| - name: Generate jsonschema | ||
| run: | | ||
| bazelisk build //libs/api:jsonschema | ||
| - uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: jsonschema.tar | ||
| path: dist/bin/libs/api/jsonschema | ||
| build_wheels: | ||
| name: Build wheel on ${{ matrix.os }} Python ${{ matrix.python-version }} | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| matrix: | ||
| os: [ubuntu-20.04, macOS-12] | ||
| python-version: ["3.10", "3.11", "3.12", "3.13"] | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - uses: pnpm/action-setup@v2.2.4 | ||
| with: | ||
| version: 8 | ||
| run_install: | | ||
| - args: [--frozen-lockfile] | ||
| - uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| - name: Mount bazel caches | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: | | ||
| "~/.cache/bazel" | ||
| key: bazel-cache-${{ matrix.os }}-py${{ matrix.python-version }} | ||
| - uses: bazelbuild/setup-bazelisk@v2 | ||
| - name: Build wheel | ||
| run: | | ||
| bazelisk build --stamp //libs/wrappers/python:rtbot_wheel | ||
| - name: Rename wheel with platform tag | ||
| run: | | ||
| cd dist/bin/libs/wrappers/python/ | ||
| WHEEL_FILE="rtbot.whl" | ||
| if [ -f "$WHEEL_FILE" ]; then | ||
| # Extract version from wheel metadata | ||
| VERSION=$(python -c " | ||
| import zipfile, re | ||
| with zipfile.ZipFile('$WHEEL_FILE', 'r') as z: | ||
| for name in z.namelist(): | ||
| if '.dist-info/METADATA' in name: | ||
| # Extract version from rtbot-VERSION.dist-info/METADATA | ||
| dist_info_dir = name.split('/')[0] | ||
| version = dist_info_dir.replace('rtbot-', '').replace('.dist-info', '') | ||
| print(version) | ||
| break | ||
| ") | ||
| # Determine platform tag | ||
| if [ "${{ runner.os }}" = "Linux" ]; then | ||
| PLATFORM="manylinux2014_x86_64" | ||
| else | ||
| PLATFORM="macosx_10_9_x86_64" | ||
| fi | ||
| # Create properly named wheel | ||
| NEW_NAME="rtbot-${VERSION}-py3-none-${PLATFORM}.whl" | ||
| cp "$WHEEL_FILE" "$NEW_NAME" | ||
| echo "Created wheel: $NEW_NAME" | ||
| fi | ||
| - uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: wheel-${{ matrix.os }}-py${{ matrix.python-version }} | ||
| path: dist/bin/libs/wrappers/python/rtbot-*-py3-none-*.whl | ||
| publish: | ||
| needs: | ||
| - tests | ||
| - build_wheels | ||
| - build_npm | ||
| name: Publish | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - uses: pnpm/action-setup@v2.2.4 | ||
| with: | ||
| version: 8 | ||
| # Setup .npmrc file to publish to npm | ||
| - uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: "18.x" | ||
| registry-url: "https://registry.npmjs.org" | ||
| - name: Prepare release | ||
| run: .github/workflows/release_prep.sh ${{ env.GITHUB_REF_NAME }} > release_notes.txt | ||
| - name: Compute wheel version | ||
| id: version | ||
| run: | | ||
| GIT_TAG=${{ github.ref_name }} | ||
| echo "version=${GIT_TAG:1}" >> $GITHUB_OUTPUT | ||
| # Download all wheel artifacts | ||
| - name: Download all wheel artifacts | ||
| uses: actions/download-artifact@v3 | ||
| with: | ||
| path: wheels/ | ||
| pattern: wheel-* | ||
| - uses: actions/download-artifact@v3 | ||
| with: | ||
| name: npm-wasm.tar | ||
| path: npm-wasm | ||
| - uses: actions/download-artifact@v3 | ||
| with: | ||
| name: npm-rtbot.tar | ||
| path: npm-rtbot | ||
| - uses: actions/download-artifact@v3 | ||
| with: | ||
| name: jsonschema.tar | ||
| path: jsonschema | ||
| - name: Organize wheels for release | ||
| run: | | ||
| ls -la wheels/ | ||
| # Create directories for organizing wheels | ||
| mkdir -p wheel-organized | ||
| # Copy all wheels to organized directory | ||
| find wheels/ -name "*.whl" -exec cp {} wheel-organized/ \; | ||
| ls -la wheel-organized/ | ||
| # copy repo readme to main npm package | ||
| cp README.md ./npm-rtbot | ||
| # package npm files, which will be used on the github release | ||
| tar -zcvf wasm-npm-${{ github.ref_name }}.tar.gz npm-wasm | ||
| tar -zcvf rtbot-npm-${{ github.ref_name }}.tar.gz npm-rtbot | ||
| - name: Release Npm Packages | ||
| run: | | ||
| rm -rf node_modules package.json pnpm pnpm-lock.yaml | ||
| echo "See [@rtbot-dev/rtbot](https://www.npmjs.com/package/@rtbot-dev/rtbot)" > npm-wasm/README.md | ||
| cd npm-wasm && pnpm publish --no-git-checks --access=public && cd .. | ||
| cd npm-rtbot && pnpm publish --no-git-checks --access=public | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
| - name: Release GitHub | ||
| uses: softprops/action-gh-release@v1 | ||
| with: | ||
| # Use GH feature to populate the changelog automatically | ||
| generate_release_notes: true | ||
| body_path: release_notes.txt | ||
| files: | | ||
| *.tar.gz | ||
| jsonschema/* | ||
| wheel-organized/* | ||
| fail_on_unmatched_files: true | ||