|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main, develop] |
| 6 | + pull_request: |
| 7 | + branches: [main, develop] |
| 8 | + workflow_dispatch: |
| 9 | + inputs: |
| 10 | + check_formatting: |
| 11 | + description: Check formatting |
| 12 | + required: false |
| 13 | + default: true |
| 14 | + type: boolean |
| 15 | + generate_api_docs: |
| 16 | + description: Generate API documentation |
| 17 | + required: false |
| 18 | + default: false |
| 19 | + type: boolean |
| 20 | + export_unitypackages: |
| 21 | + description: Export .unitypackage artifacts |
| 22 | + required: false |
| 23 | + default: false |
| 24 | + type: boolean |
| 25 | + |
| 26 | +permissions: |
| 27 | + contents: read |
| 28 | + |
| 29 | +concurrency: |
| 30 | + group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 31 | + cancel-in-progress: true |
| 32 | + |
| 33 | +env: |
| 34 | + ARTIFACTS_PATH: UnityPlugin_CI_artifacts |
| 35 | + PACKAGE_PATH_TRACKING: Packages/Tracking |
| 36 | + PACKAGE_PATH_TRACKING_PREVIEW: Packages/Tracking Preview |
| 37 | + |
| 38 | +jobs: |
| 39 | + check-formatting: |
| 40 | + name: Check Formatting |
| 41 | + runs-on: ubuntu-latest |
| 42 | + continue-on-error: true |
| 43 | + if: github.event_name != 'workflow_dispatch' || inputs.check_formatting |
| 44 | + steps: |
| 45 | + - name: Checkout Repository |
| 46 | + uses: actions/checkout@v6 |
| 47 | + with: |
| 48 | + fetch-depth: 0 |
| 49 | + |
| 50 | + - name: Check Formatting |
| 51 | + uses: ./.github/actions/check-formatting |
| 52 | + id: formatting |
| 53 | + |
| 54 | + - name: Upload Formatting Diff |
| 55 | + if: always() && steps.formatting.outputs.has_diff == 'true' |
| 56 | + uses: actions/upload-artifact@v7 |
| 57 | + with: |
| 58 | + name: UnityPlugin-${{ github.sha }}-format-diff |
| 59 | + path: ${{ env.ARTIFACTS_PATH }}/ |
| 60 | + if-no-files-found: error |
| 61 | + |
| 62 | + generate-api-docs: |
| 63 | + name: Generate API Docs |
| 64 | + runs-on: ubuntu-latest |
| 65 | + if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.generate_api_docs) |
| 66 | + steps: |
| 67 | + - name: Checkout Repository |
| 68 | + uses: actions/checkout@v6 |
| 69 | + |
| 70 | + - name: Install Doxygen |
| 71 | + run: | |
| 72 | + sudo apt-get update |
| 73 | + sudo apt-get install -y doxygen |
| 74 | +
|
| 75 | + - name: Generate API Documentation |
| 76 | + run: doxygen ./Doxyfile |
| 77 | + |
| 78 | + - name: Collect API Documentation |
| 79 | + run: | |
| 80 | + mkdir -p "$ARTIFACTS_PATH" |
| 81 | + mv docs/xml "$ARTIFACTS_PATH/unity_xml" |
| 82 | + mv docs/html "$ARTIFACTS_PATH/unity_html" |
| 83 | +
|
| 84 | + - name: Upload API Documentation |
| 85 | + uses: actions/upload-artifact@v7 |
| 86 | + with: |
| 87 | + name: UnityPlugin-${{ github.sha }}-api-docs |
| 88 | + path: ${{ env.ARTIFACTS_PATH }}/ |
| 89 | + if-no-files-found: error |
| 90 | + |
| 91 | + export-unitypackages: |
| 92 | + name: Export Unity Packages |
| 93 | + runs-on: ubuntu-latest |
| 94 | + if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.export_unitypackages) |
| 95 | + env: |
| 96 | + UNITYPLUGIN_ASSETS_PATH: Assets/ThirdParty/Ultraleap |
| 97 | + steps: |
| 98 | + - name: Checkout Repository |
| 99 | + uses: actions/checkout@v6 |
| 100 | + |
| 101 | + - name: Export Tracking Unity Package |
| 102 | + uses: ./.github/actions/export-unitypackage |
| 103 | + id: export_tracking |
| 104 | + with: |
| 105 | + package_root_path: ${{ env.PACKAGE_PATH_TRACKING }} |
| 106 | + package_import_path: ${{ env.UNITYPLUGIN_ASSETS_PATH }}/Tracking |
| 107 | + package_file_name: Ultraleap Tracking.unitypackage |
| 108 | + artifact_root_path: ${{ env.ARTIFACTS_PATH }} |
| 109 | + |
| 110 | + - name: Export Tracking Preview Unity Package |
| 111 | + uses: ./.github/actions/export-unitypackage |
| 112 | + id: export_tracking_preview |
| 113 | + with: |
| 114 | + package_root_path: ${{ env.PACKAGE_PATH_TRACKING_PREVIEW }} |
| 115 | + package_import_path: ${{ env.UNITYPLUGIN_ASSETS_PATH }}/Tracking Preview |
| 116 | + package_file_name: Ultraleap Tracking Preview.unitypackage |
| 117 | + artifact_root_path: ${{ env.ARTIFACTS_PATH }} |
| 118 | + package_output_path: ${{ steps.export_tracking.outputs.package_output_path }} |
| 119 | + |
| 120 | + - name: Upload Unity Packages |
| 121 | + uses: actions/upload-artifact@v7 |
| 122 | + with: |
| 123 | + name: UnityPlugin-${{ github.sha }}-unitypackage |
| 124 | + path: ${{ env.ARTIFACTS_PATH }}/ |
| 125 | + if-no-files-found: error |
0 commit comments