|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + tags: [ '*' ] |
| 7 | + pull_request: |
| 8 | + branches: [ main ] |
| 9 | + workflow_dispatch: # Manual trigger from Actions tab |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: read |
| 13 | + pull-requests: write # Required to comment on PRs |
| 14 | + |
| 15 | +jobs: |
| 16 | + check-code-format: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + steps: |
| 19 | + - name: Checkout repository |
| 20 | + uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - name: Bootstrap |
| 23 | + uses: ./.github/actions/bootstrap |
| 24 | + |
| 25 | + - name: Check uv lock file |
| 26 | + run: uv lock --check |
| 27 | + |
| 28 | + - name: Run linting |
| 29 | + run: uv run --group dev poe lint |
| 30 | + |
| 31 | + build: |
| 32 | + strategy: |
| 33 | + matrix: |
| 34 | + os: [ubuntu-latest, windows-latest] |
| 35 | + runs-on: ${{ matrix.os }} |
| 36 | + steps: |
| 37 | + - name: Checkout repository |
| 38 | + uses: actions/checkout@v4 |
| 39 | + |
| 40 | + - name: Bootstrap |
| 41 | + uses: ./.github/actions/bootstrap |
| 42 | + |
| 43 | + - name: Update README |
| 44 | + run: uv run --group dev poe update-readme |
| 45 | + |
| 46 | + - name: Build package |
| 47 | + run: uv build |
| 48 | + |
| 49 | + - name: Restore README |
| 50 | + run: git restore README.md |
| 51 | + |
| 52 | + - name: Upload artifacts |
| 53 | + uses: actions/upload-artifact@v4 |
| 54 | + with: |
| 55 | + name: mujoco-usd-converter-dist-${{ matrix.os }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || format('{0}', github.ref_name) }} |
| 56 | + path: dist/ |
| 57 | + |
| 58 | + test: |
| 59 | + needs: build |
| 60 | + strategy: |
| 61 | + matrix: |
| 62 | + os: [ubuntu-latest, windows-latest] |
| 63 | + runs-on: ${{ matrix.os }} |
| 64 | + steps: |
| 65 | + - name: Checkout repository |
| 66 | + uses: actions/checkout@v4 |
| 67 | + |
| 68 | + - name: Bootstrap |
| 69 | + uses: ./.github/actions/bootstrap |
| 70 | + |
| 71 | + - name: Download artifacts |
| 72 | + uses: actions/download-artifact@v4 |
| 73 | + with: |
| 74 | + name: mujoco-usd-converter-dist-${{ matrix.os }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || format('{0}', github.ref_name) }} |
| 75 | + path: dist/ |
| 76 | + |
| 77 | + - name: Run tests |
| 78 | + run: uv run --group dev poe test-ci |
| 79 | + |
| 80 | + - name: Upload report artifacts |
| 81 | + uses: actions/upload-artifact@v4 |
| 82 | + with: |
| 83 | + name: mujoco-usd-converter-coverage-${{ matrix.os }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || format('{0}', github.ref_name) }} |
| 84 | + include-hidden-files: true |
| 85 | + path: | |
| 86 | + ${{ github.workspace }}/.coverage.xml |
| 87 | + ${{ github.workspace }}/.results.xml |
| 88 | +
|
| 89 | + - name: Upload test results to Codecov |
| 90 | + if: ${{ !cancelled() }} |
| 91 | + uses: codecov/test-results-action@v1 |
| 92 | + with: |
| 93 | + files: ${{ github.workspace }}/.results.xml |
| 94 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 95 | + |
| 96 | + - name: Upload coverage reports to Codecov |
| 97 | + uses: codecov/codecov-action@v4 |
| 98 | + with: |
| 99 | + files: ${{ github.workspace }}/.coverage.xml |
| 100 | + flags: unittests |
| 101 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 102 | + |
| 103 | + test-package: |
| 104 | + needs: build |
| 105 | + strategy: |
| 106 | + matrix: |
| 107 | + os: [ubuntu-latest, windows-latest] |
| 108 | + runs-on: ${{ matrix.os }} |
| 109 | + steps: |
| 110 | + - name: Checkout repository |
| 111 | + uses: actions/checkout@v4 |
| 112 | + |
| 113 | + - name: Bootstrap |
| 114 | + uses: ./.github/actions/bootstrap |
| 115 | + with: |
| 116 | + enable-uv-cache: 'false' |
| 117 | + |
| 118 | + - name: Download artifacts |
| 119 | + uses: actions/download-artifact@v4 |
| 120 | + with: |
| 121 | + name: mujoco-usd-converter-dist-${{ matrix.os }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || format('{0}', github.ref_name) }} |
| 122 | + path: dist/ |
| 123 | + |
| 124 | + - name: Test wheel installation (Linux) |
| 125 | + if: runner.os == 'Linux' |
| 126 | + run: | |
| 127 | + # Create a fresh virtual environment to test the wheel |
| 128 | + uv venv /tmp/wheel_test_env |
| 129 | + source /tmp/wheel_test_env/bin/activate |
| 130 | +
|
| 131 | + # Install the wheel directly using uv |
| 132 | + uv pip install --index-strategy unsafe-best-match dist/*.whl |
| 133 | +
|
| 134 | + # Test conversion |
| 135 | + mkdir -p /tmp/test_outputs |
| 136 | + mujoco_usd_converter tests/data/geoms.xml /tmp/test_outputs/geoms_output |
| 137 | +
|
| 138 | + - name: Test wheel installation (Windows) |
| 139 | + if: runner.os == 'Windows' |
| 140 | + shell: powershell |
| 141 | + run: | |
| 142 | + # Create a fresh virtual environment to test the wheel |
| 143 | + uv venv wheel_test_env |
| 144 | + wheel_test_env\Scripts\activate.ps1 |
| 145 | +
|
| 146 | + # Find and install the wheel file |
| 147 | + $wheelFile = Get-ChildItem -Path "dist" -Filter "*.whl" | Select-Object -First 1 |
| 148 | + uv pip install --index-strategy unsafe-best-match $wheelFile.FullName |
| 149 | +
|
| 150 | + # Test conversion |
| 151 | + New-Item -ItemType Directory -Force -Path test_outputs |
| 152 | + mujoco_usd_converter tests/data/geoms.xml test_outputs\geoms_output |
0 commit comments