|
| 1 | +name: PR Validation |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [main] |
| 6 | + |
| 7 | +concurrency: |
| 8 | + group: pr-${{ github.event.pull_request.number }} |
| 9 | + cancel-in-progress: true |
| 10 | + |
| 11 | +env: |
| 12 | + NODE_OPTIONS: "--max-old-space-size=4096" |
| 13 | + GO_VERSION: "1.26" |
| 14 | + NODE_VERSION: "20" |
| 15 | + PNPM_VERSION: "10" |
| 16 | + |
| 17 | +jobs: |
| 18 | + # ───────────────────────────────────────────────────────────────────────────── |
| 19 | + # E2E Tests — Playwright against wails dev |
| 20 | + # ───────────────────────────────────────────────────────────────────────────── |
| 21 | + e2e-tests: |
| 22 | + runs-on: ubuntu-latest |
| 23 | + timeout-minutes: 20 |
| 24 | + steps: |
| 25 | + - name: Checkout |
| 26 | + uses: actions/checkout@v4 |
| 27 | + with: |
| 28 | + submodules: recursive |
| 29 | + |
| 30 | + - name: Install system dependencies |
| 31 | + run: | |
| 32 | + sudo apt-get update |
| 33 | + sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev xvfb |
| 34 | +
|
| 35 | + - name: Setup Node |
| 36 | + uses: actions/setup-node@v4 |
| 37 | + with: |
| 38 | + node-version: ${{ env.NODE_VERSION }} |
| 39 | + |
| 40 | + - name: Setup pnpm |
| 41 | + uses: pnpm/action-setup@v4 |
| 42 | + with: |
| 43 | + version: ${{ env.PNPM_VERSION }} |
| 44 | + run_install: | |
| 45 | + - args: [] |
| 46 | + - args: [--global, typescript] |
| 47 | +
|
| 48 | + - name: Setup Go |
| 49 | + uses: actions/setup-go@v5 |
| 50 | + with: |
| 51 | + go-version: ${{ env.GO_VERSION }} |
| 52 | + cache: true |
| 53 | + cache-dependency-path: "go.sum" |
| 54 | + |
| 55 | + - name: Install Wails |
| 56 | + run: go install github.com/wailsapp/wails/v2/cmd/wails@v2.11.0 |
| 57 | + |
| 58 | + - name: Build workspace packages |
| 59 | + run: make packages |
| 60 | + |
| 61 | + - name: Install Playwright browsers |
| 62 | + working-directory: e2e |
| 63 | + run: pnpm exec playwright install --with-deps chromium |
| 64 | + |
| 65 | + - name: Start wails dev |
| 66 | + run: | |
| 67 | + xvfb-run wails dev -loglevel Error -tags webkit2_41 -nosyncgomod -m -noreload -skipbindings & |
| 68 | + echo "Waiting for Wails dev server..." |
| 69 | + for i in $(seq 1 150); do |
| 70 | + if curl -sf http://localhost:34115 > /dev/null 2>&1; then |
| 71 | + echo "Wails dev server is ready (${i}s)" |
| 72 | + exit 0 |
| 73 | + fi |
| 74 | + sleep 2 |
| 75 | + done |
| 76 | + echo "Timed out waiting for Wails dev server" |
| 77 | + exit 1 |
| 78 | +
|
| 79 | + - name: Run Playwright tests |
| 80 | + working-directory: e2e |
| 81 | + run: pnpm test |
| 82 | + |
| 83 | + - name: Upload test report |
| 84 | + if: always() |
| 85 | + uses: actions/upload-artifact@v4 |
| 86 | + with: |
| 87 | + name: playwright-report |
| 88 | + path: | |
| 89 | + e2e/playwright-report/ |
| 90 | + e2e/test-results/ |
| 91 | + retention-days: 7 |
| 92 | + |
| 93 | + # ───────────────────────────────────────────────────────────────────────────── |
| 94 | + # Build Artifacts — downloadable binaries for manual testing |
| 95 | + # ───────────────────────────────────────────────────────────────────────────── |
| 96 | + build-artifacts: |
| 97 | + strategy: |
| 98 | + fail-fast: false |
| 99 | + matrix: |
| 100 | + include: |
| 101 | + - os: macos-latest |
| 102 | + platform: darwin/universal |
| 103 | + artifact-name: pr-build-macos |
| 104 | + extra-flags: "" |
| 105 | + - os: ubuntu-latest |
| 106 | + platform: linux/amd64 |
| 107 | + artifact-name: pr-build-linux |
| 108 | + extra-flags: "-tags webkit2_41" |
| 109 | + - os: windows-latest |
| 110 | + platform: windows/amd64 |
| 111 | + artifact-name: pr-build-windows |
| 112 | + extra-flags: "" |
| 113 | + runs-on: ${{ matrix.os }} |
| 114 | + timeout-minutes: 30 |
| 115 | + steps: |
| 116 | + - name: Checkout |
| 117 | + uses: actions/checkout@v4 |
| 118 | + with: |
| 119 | + submodules: recursive |
| 120 | + |
| 121 | + - name: Install system dependencies (Linux) |
| 122 | + if: runner.os == 'Linux' |
| 123 | + run: | |
| 124 | + sudo apt-get update |
| 125 | + sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev |
| 126 | +
|
| 127 | + - name: Setup Node |
| 128 | + uses: actions/setup-node@v4 |
| 129 | + with: |
| 130 | + node-version: ${{ env.NODE_VERSION }} |
| 131 | + |
| 132 | + - name: Setup pnpm |
| 133 | + uses: pnpm/action-setup@v4 |
| 134 | + with: |
| 135 | + version: ${{ env.PNPM_VERSION }} |
| 136 | + run_install: | |
| 137 | + - args: [] |
| 138 | + - args: [--global, typescript] |
| 139 | +
|
| 140 | + - name: Setup Go |
| 141 | + uses: actions/setup-go@v5 |
| 142 | + with: |
| 143 | + go-version: ${{ env.GO_VERSION }} |
| 144 | + cache: true |
| 145 | + cache-dependency-path: "go.sum" |
| 146 | + |
| 147 | + - name: Install Wails |
| 148 | + shell: bash |
| 149 | + run: go install github.com/wailsapp/wails/v2/cmd/wails@v2.11.0 |
| 150 | + |
| 151 | + - name: Build workspace packages |
| 152 | + shell: bash |
| 153 | + run: make packages |
| 154 | + |
| 155 | + - name: Build Omniview |
| 156 | + shell: bash |
| 157 | + run: | |
| 158 | + wails build -platform ${{ matrix.platform }} \ |
| 159 | + ${{ matrix.extra-flags }} \ |
| 160 | + -webview2 download \ |
| 161 | + -ldflags "\ |
| 162 | + -X github.com/omniviewdev/omniview/internal/version.Version=0.0.0-pr.${{ github.event.pull_request.number }} \ |
| 163 | + -X github.com/omniviewdev/omniview/internal/version.GitCommit=${{ github.sha }} \ |
| 164 | + -X github.com/omniviewdev/omniview/internal/version.BuildDate=$(date -u +%Y-%m-%dT%H:%M:%SZ) \ |
| 165 | + -X github.com/omniviewdev/omniview/internal/version.Development=true" |
| 166 | +
|
| 167 | + - name: Prepare artifact (macOS) |
| 168 | + if: runner.os == 'macOS' |
| 169 | + run: | |
| 170 | + cd build/bin |
| 171 | + zip -r Omniview-pr${{ github.event.pull_request.number }}-macos.zip Omniview.app |
| 172 | +
|
| 173 | + - name: Prepare artifact (Linux) |
| 174 | + if: runner.os == 'Linux' |
| 175 | + working-directory: build/bin |
| 176 | + run: mv Omniview "Omniview-pr${{ github.event.pull_request.number }}-linux-amd64" |
| 177 | + |
| 178 | + - name: Prepare artifact (Windows) |
| 179 | + if: runner.os == 'Windows' |
| 180 | + working-directory: build/bin |
| 181 | + run: Rename-Item -Path "Omniview.exe" -NewName "Omniview-pr${{ github.event.pull_request.number }}-windows-amd64.exe" |
| 182 | + |
| 183 | + - name: Upload artifact |
| 184 | + uses: actions/upload-artifact@v4 |
| 185 | + with: |
| 186 | + name: ${{ matrix.artifact-name }} |
| 187 | + path: | |
| 188 | + build/bin/*.zip |
| 189 | + build/bin/Omniview-pr* |
| 190 | + if-no-files-found: error |
| 191 | + retention-days: 5 |
0 commit comments