|
| 1 | +name: Test VS Code Workflows Integration |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + test-repo: |
| 7 | + description: 'Repository to test with' |
| 8 | + required: false |
| 9 | + default: 'apex-language-support' |
| 10 | + type: choice |
| 11 | + options: |
| 12 | + - apex-language-support |
| 13 | + - salesforcedx-vscode |
| 14 | + |
| 15 | +jobs: |
| 16 | + test-package-workflow: |
| 17 | + name: Test Package Workflow |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - name: Checkout apex-language-support |
| 21 | + uses: actions/checkout@v6 |
| 22 | + with: |
| 23 | + repository: forcedotcom/apex-language-support |
| 24 | + path: test-repo |
| 25 | + |
| 26 | + - name: Setup Node.js |
| 27 | + uses: actions/setup-node@v6 |
| 28 | + with: |
| 29 | + node-version: '22.x' |
| 30 | + |
| 31 | + - name: Install dependencies |
| 32 | + working-directory: test-repo |
| 33 | + run: npm ci |
| 34 | + |
| 35 | + - name: Build and package extension |
| 36 | + working-directory: test-repo/packages/apex-lsp-vscode-extension |
| 37 | + run: | |
| 38 | + npm run vscode:package |
| 39 | + ls -la *.vsix |
| 40 | + echo "✓ VSIX packaging successful" |
| 41 | +
|
| 42 | + test-composite-actions: |
| 43 | + name: Test Composite Actions |
| 44 | + runs-on: ubuntu-latest |
| 45 | + steps: |
| 46 | + - name: Checkout github-workflows |
| 47 | + uses: actions/checkout@v6 |
| 48 | + path: toolkit |
| 49 | + |
| 50 | + - name: Checkout apex-language-support |
| 51 | + uses: actions/checkout@v6 |
| 52 | + with: |
| 53 | + repository: forcedotcom/apex-language-support |
| 54 | + path: test-repo |
| 55 | + |
| 56 | + - name: Setup Node.js |
| 57 | + uses: actions/setup-node@v6 |
| 58 | + with: |
| 59 | + node-version: '22.x' |
| 60 | + |
| 61 | + - name: Test npm-install-with-retries action |
| 62 | + uses: ./toolkit/.github/actions/vscode/npm-install-with-retries |
| 63 | + with: |
| 64 | + working-directory: test-repo |
| 65 | + |
| 66 | + - name: Test detect-packages action |
| 67 | + id: detect |
| 68 | + uses: ./toolkit/.github/actions/vscode/detect-packages |
| 69 | + with: |
| 70 | + working-directory: test-repo |
| 71 | + |
| 72 | + - name: Verify packages detected |
| 73 | + run: | |
| 74 | + echo "Packages: ${{ steps.detect.outputs.packages }}" |
| 75 | + echo "Extensions: ${{ steps.detect.outputs.extensions }}" |
| 76 | + if [ -z "${{ steps.detect.outputs.extensions }}" ]; then |
| 77 | + echo "Error: No extensions detected" |
| 78 | + exit 1 |
| 79 | + fi |
| 80 | + echo "✓ Package detection successful" |
| 81 | +
|
| 82 | + - name: Test calculate-artifact-name action |
| 83 | + id: artifact |
| 84 | + uses: ./toolkit/.github/actions/vscode/calculate-artifact-name |
| 85 | + with: |
| 86 | + extension-name: apex-lsp-vscode-extension |
| 87 | + mode: nightly |
| 88 | + |
| 89 | + - name: Verify artifact name |
| 90 | + run: | |
| 91 | + echo "Artifact: ${{ steps.artifact.outputs.artifact-name }}" |
| 92 | + if [ -z "${{ steps.artifact.outputs.artifact-name }}" ]; then |
| 93 | + echo "Error: No artifact name generated" |
| 94 | + exit 1 |
| 95 | + fi |
| 96 | + echo "✓ Artifact naming successful" |
| 97 | +
|
| 98 | + test-scripts: |
| 99 | + name: Test CLI Scripts |
| 100 | + runs-on: ubuntu-latest |
| 101 | + steps: |
| 102 | + - name: Checkout github-workflows |
| 103 | + uses: actions/checkout@v6 |
| 104 | + path: toolkit |
| 105 | + |
| 106 | + - name: Checkout apex-language-support |
| 107 | + uses: actions/checkout@v6 |
| 108 | + with: |
| 109 | + repository: forcedotcom/apex-language-support |
| 110 | + path: test-repo |
| 111 | + |
| 112 | + - name: Setup Node.js |
| 113 | + uses: actions/setup-node@v6 |
| 114 | + with: |
| 115 | + node-version: '22.x' |
| 116 | + |
| 117 | + - name: Build vscode-extension-ci package |
| 118 | + working-directory: toolkit/packages/vscode-extension-ci |
| 119 | + run: | |
| 120 | + npm install |
| 121 | + npm run build |
| 122 | +
|
| 123 | + - name: Test ext-package-selector |
| 124 | + working-directory: test-repo |
| 125 | + run: | |
| 126 | + node ../toolkit/packages/vscode-extension-ci/dist/cli.js ext-package-selector |
| 127 | + echo "✓ Package selector works" |
| 128 | +
|
| 129 | + - name: Test ext-build-type |
| 130 | + working-directory: test-repo |
| 131 | + run: | |
| 132 | + node ../toolkit/packages/vscode-extension-ci/dist/cli.js ext-build-type |
| 133 | + echo "✓ Build type detection works" |
| 134 | +
|
| 135 | + summary: |
| 136 | + name: Test Summary |
| 137 | + runs-on: ubuntu-latest |
| 138 | + needs: [test-package-workflow, test-composite-actions, test-scripts] |
| 139 | + if: always() |
| 140 | + steps: |
| 141 | + - name: Check results |
| 142 | + env: |
| 143 | + PACKAGE_RESULT: ${{ needs.test-package-workflow.result }} |
| 144 | + ACTIONS_RESULT: ${{ needs.test-composite-actions.result }} |
| 145 | + SCRIPTS_RESULT: ${{ needs.test-scripts.result }} |
| 146 | + run: | |
| 147 | + echo "Package Workflow: $PACKAGE_RESULT" |
| 148 | + echo "Composite Actions: $ACTIONS_RESULT" |
| 149 | + echo "CLI Scripts: $SCRIPTS_RESULT" |
| 150 | +
|
| 151 | + FAILED=0 |
| 152 | + if [ "$PACKAGE_RESULT" != "success" ]; then |
| 153 | + echo "❌ Package workflow failed" |
| 154 | + FAILED=1 |
| 155 | + fi |
| 156 | + if [ "$ACTIONS_RESULT" != "success" ]; then |
| 157 | + echo "❌ Composite actions failed" |
| 158 | + FAILED=1 |
| 159 | + fi |
| 160 | + if [ "$SCRIPTS_RESULT" != "success" ]; then |
| 161 | + echo "❌ CLI scripts failed" |
| 162 | + FAILED=1 |
| 163 | + fi |
| 164 | +
|
| 165 | + if [ $FAILED -eq 0 ]; then |
| 166 | + echo "✅ All integration tests passed!" |
| 167 | + else |
| 168 | + exit 1 |
| 169 | + fi |
0 commit comments