|
| 1 | +name: Test Integration |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + paths: |
| 7 | + - "scripts/**" |
| 8 | + - ".github/workflows/build.yml" |
| 9 | + - ".github/workflows/release.yml" |
| 10 | + - ".github/workflows/test-integration.yml" |
| 11 | + pull_request: |
| 12 | + branches: [main] |
| 13 | + paths: |
| 14 | + - "scripts/**" |
| 15 | + - ".github/workflows/build.yml" |
| 16 | + - ".github/workflows/release.yml" |
| 17 | + - ".github/workflows/test-integration.yml" |
| 18 | + workflow_dispatch: |
| 19 | + |
| 20 | +jobs: |
| 21 | + test-build-integration: |
| 22 | + runs-on: windows-latest |
| 23 | + |
| 24 | + steps: |
| 25 | + - name: Checkout repository |
| 26 | + uses: actions/checkout@v4 |
| 27 | + |
| 28 | + - name: Create mock build artifacts |
| 29 | + run: | |
| 30 | + echo "Creating mock build artifacts to test integration..." |
| 31 | +
|
| 32 | + # Create artifacts directory structure like the real build would |
| 33 | + mkdir -p artifacts/zed-release |
| 34 | + mkdir -p artifacts/zed-release-opengl |
| 35 | +
|
| 36 | + # Create mock executables |
| 37 | + echo "mock vulkan zed executable content" > artifacts/zed-release/zed.exe |
| 38 | + echo "mock opengl zed executable content" > artifacts/zed-release-opengl/zed.exe |
| 39 | +
|
| 40 | + echo "Mock artifacts created:" |
| 41 | + Get-ChildItem -Path artifacts -Force | Format-List |
| 42 | +
|
| 43 | + - name: Upload mock artifacts (to test download step) |
| 44 | + uses: actions/upload-artifact@v4 |
| 45 | + with: |
| 46 | + name: zed-release |
| 47 | + path: artifacts/zed-release/zed.exe |
| 48 | + |
| 49 | + - name: Upload mock OpenGL artifacts |
| 50 | + uses: actions/upload-artifact@v4 |
| 51 | + with: |
| 52 | + name: zed-release-opengl |
| 53 | + path: artifacts/zed-release-opengl/zed.exe |
| 54 | + |
| 55 | + test-release-integration: |
| 56 | + runs-on: ubuntu-latest |
| 57 | + needs: test-build-integration |
| 58 | + |
| 59 | + steps: |
| 60 | + - name: Checkout repository |
| 61 | + uses: actions/checkout@v4 |
| 62 | + |
| 63 | + - name: Download mock artifacts |
| 64 | + uses: actions/download-artifact@v4 |
| 65 | + with: |
| 66 | + path: artifacts |
| 67 | + continue-on-error: true |
| 68 | + |
| 69 | + - name: Verify downloaded artifacts |
| 70 | + run: | |
| 71 | + echo "Downloaded artifacts:" |
| 72 | + find artifacts -type f -name "*.exe" -exec ls -la {} \; |
| 73 | +
|
| 74 | + # Check if Vulkan build exists |
| 75 | + if [ ! -f "artifacts/zed-release/zed.exe" ]; then |
| 76 | + echo "❌ FAIL: Vulkan artifact not downloaded" |
| 77 | + exit 1 |
| 78 | + fi |
| 79 | +
|
| 80 | + if [ ! -f "artifacts/zed-release-opengl/zed.exe" ]; then |
| 81 | + echo "❌ FAIL: OpenGL artifact not downloaded" |
| 82 | + exit 1 |
| 83 | + fi |
| 84 | +
|
| 85 | + echo "✅ All artifacts downloaded successfully" |
| 86 | +
|
| 87 | + - name: Test release preparation with downloaded artifacts |
| 88 | + run: | |
| 89 | + chmod +x scripts/prepare-release.sh |
| 90 | + ./scripts/prepare-release.sh |
| 91 | +
|
| 92 | + echo "Release files after artifact download:" |
| 93 | + ls -la release/ |
| 94 | +
|
| 95 | + - name: Verify release files |
| 96 | + run: | |
| 97 | + # Check that all expected files exist |
| 98 | + EXPECTED_FILES=("zed.exe" "zed.zip" "zed-opengl.exe" "zed-opengl.zip" "sha256sums.txt") |
| 99 | +
|
| 100 | + for file in "${EXPECTED_FILES[@]}"; do |
| 101 | + if [ ! -f "release/$file" ]; then |
| 102 | + echo "❌ FAIL: Missing expected file: $file" |
| 103 | + exit 1 |
| 104 | + fi |
| 105 | + echo "✅ Found: $file" |
| 106 | + done |
| 107 | +
|
| 108 | + # Verify checksums |
| 109 | + cd release |
| 110 | + if ! sha256sum -c sha256sums.txt; then |
| 111 | + echo "❌ FAIL: Checksum verification failed" |
| 112 | + exit 1 |
| 113 | + fi |
| 114 | +
|
| 115 | + echo "✅ All checksums verified successfully" |
| 116 | +
|
| 117 | + test-partial-failure-scenarios: |
| 118 | + runs-on: ubuntu-latest |
| 119 | + |
| 120 | + strategy: |
| 121 | + matrix: |
| 122 | + scenario: |
| 123 | + - name: "vulkan-only" |
| 124 | + create_vulkan: true |
| 125 | + create_opengl: false |
| 126 | + expected_files: 3 |
| 127 | + - name: "opengl-only" |
| 128 | + create_vulkan: false |
| 129 | + create_opengl: true |
| 130 | + expected_files: 3 |
| 131 | + - name: "both-builds" |
| 132 | + create_vulkan: true |
| 133 | + create_opengl: true |
| 134 | + expected_files: 5 |
| 135 | + |
| 136 | + steps: |
| 137 | + - name: Checkout repository |
| 138 | + uses: actions/checkout@v4 |
| 139 | + |
| 140 | + - name: Create scenario-specific artifacts |
| 141 | + run: | |
| 142 | + echo "Testing scenario: ${{ matrix.scenario.name }}" |
| 143 | +
|
| 144 | + if [ "${{ matrix.scenario.create_vulkan }}" = "true" ]; then |
| 145 | + echo "Creating Vulkan artifacts..." |
| 146 | + mkdir -p artifacts/zed-release |
| 147 | + echo "vulkan executable for ${{ matrix.scenario.name }}" > artifacts/zed-release/zed.exe |
| 148 | + fi |
| 149 | +
|
| 150 | + if [ "${{ matrix.scenario.create_opengl }}" = "true" ]; then |
| 151 | + echo "Creating OpenGL artifacts..." |
| 152 | + mkdir -p artifacts/zed-release-opengl |
| 153 | + echo "opengl executable for ${{ matrix.scenario.name }}" > artifacts/zed-release-opengl/zed.exe |
| 154 | + fi |
| 155 | +
|
| 156 | + echo "Created artifacts:" |
| 157 | + find artifacts -type f -name "*.exe" -exec ls -la {} \; || echo "No artifacts created" |
| 158 | +
|
| 159 | + - name: Test release preparation |
| 160 | + run: | |
| 161 | + chmod +x scripts/prepare-release.sh |
| 162 | + ./scripts/prepare-release.sh |
| 163 | +
|
| 164 | + echo "Release files for scenario ${{ matrix.scenario.name }}:" |
| 165 | + ls -la release/ |
| 166 | +
|
| 167 | + - name: Verify expected file count |
| 168 | + run: | |
| 169 | + ACTUAL_COUNT=$(ls -1 release/ | wc -l) |
| 170 | + EXPECTED_COUNT=${{ matrix.scenario.expected_files }} |
| 171 | +
|
| 172 | + if [ "$ACTUAL_COUNT" -ne "$EXPECTED_COUNT" ]; then |
| 173 | + echo "❌ FAIL: Expected $EXPECTED_COUNT files, got $ACTUAL_COUNT" |
| 174 | + echo "Files found:" |
| 175 | + ls -la release/ |
| 176 | + exit 1 |
| 177 | + fi |
| 178 | +
|
| 179 | + echo "✅ Correct file count for scenario ${{ matrix.scenario.name }}: $EXPECTED_COUNT files" |
| 180 | +
|
| 181 | + - name: Verify checksums |
| 182 | + run: | |
| 183 | + cd release |
| 184 | + if ! sha256sum -c sha256sums.txt; then |
| 185 | + echo "❌ FAIL: Checksum verification failed for scenario ${{ matrix.scenario.name }}" |
| 186 | + exit 1 |
| 187 | + fi |
| 188 | +
|
| 189 | + echo "✅ Checksums verified for scenario ${{ matrix.scenario.name }}" |
| 190 | +
|
| 191 | + test-no-artifacts-failure: |
| 192 | + runs-on: ubuntu-latest |
| 193 | + |
| 194 | + steps: |
| 195 | + - name: Checkout repository |
| 196 | + uses: actions/checkout@v4 |
| 197 | + |
| 198 | + - name: Test script fails with no artifacts |
| 199 | + run: | |
| 200 | + chmod +x scripts/prepare-release.sh |
| 201 | +
|
| 202 | + echo "Testing that script fails when no artifacts are present..." |
| 203 | + if ./scripts/prepare-release.sh; then |
| 204 | + echo "❌ FAIL: Script should have failed with no artifacts" |
| 205 | + exit 1 |
| 206 | + else |
| 207 | + echo "✅ Script correctly failed when no artifacts present" |
| 208 | + fi |
| 209 | +
|
| 210 | + integration-summary: |
| 211 | + runs-on: ubuntu-latest |
| 212 | + needs: |
| 213 | + [ |
| 214 | + test-build-integration, |
| 215 | + test-release-integration, |
| 216 | + test-partial-failure-scenarios, |
| 217 | + test-no-artifacts-failure, |
| 218 | + ] |
| 219 | + if: always() |
| 220 | + |
| 221 | + steps: |
| 222 | + - name: Report test results |
| 223 | + run: | |
| 224 | + echo "🧪 Integration Test Summary:" |
| 225 | + echo "==========================" |
| 226 | + echo "" |
| 227 | + echo "✅ Build Integration: ${{ needs.test-build-integration.result }}" |
| 228 | + echo "✅ Release Integration: ${{ needs.test-release-integration.result }}" |
| 229 | + echo "✅ Partial Failure Scenarios: ${{ needs.test-partial-failure-scenarios.result }}" |
| 230 | + echo "✅ No Artifacts Failure: ${{ needs.test-no-artifacts-failure.result }}" |
| 231 | + echo "" |
| 232 | +
|
| 233 | + if [ "${{ needs.test-build-integration.result }}" = "success" ] && \ |
| 234 | + [ "${{ needs.test-release-integration.result }}" = "success" ] && \ |
| 235 | + [ "${{ needs.test-partial-failure-scenarios.result }}" = "success" ] && \ |
| 236 | + [ "${{ needs.test-no-artifacts-failure.result }}" = "success" ]; then |
| 237 | + echo "🎉 All integration tests passed!" |
| 238 | + echo "The build and release workflows are properly integrated." |
| 239 | + else |
| 240 | + echo "❌ Some integration tests failed. Check the job logs above." |
| 241 | + exit 1 |
| 242 | + fi |
0 commit comments