Repository navigation
Merge pull request #1196 from QueryaHub/issue/1147-erd-source #1534
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [ main, dev, '**-connector', '**-connection-pull' ] | |
| tags: | |
| - '*.*.*' | |
| - 'v*' | |
| pull_request: | |
| branches: [ main, dev ] | |
| jobs: | |
| # The suite is split into independent sections (scripts/ci/test_sections.sh) | |
| # that run as parallel jobs. A test in a directory no section lists still runs | |
| # in the `rest` section. | |
| test-sections: | |
| name: Tests (${{ matrix.section }}) | |
| timeout-minutes: 30 | |
| # Self-hosted when the repository variable CI_RUNS_ON is set (see | |
| # docs/ci-runners.md); pull requests from forks always run on GitHub-hosted | |
| # runners, never on our own machines. | |
| runs-on: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) && fromJSON('"ubuntu-latest"') || fromJSON(vars.CI_RUNS_ON || '"ubuntu-latest"') }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| section: | |
| - core-data | |
| - core-extensions | |
| - core-theme | |
| - core-ui | |
| - features-workspace | |
| - features-nosql | |
| - features-app | |
| - rest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: '3.41.6' | |
| channel: 'stable' | |
| cache: true | |
| - name: Install Linux dependencies (plugins) | |
| if: runner.environment == 'github-hosted' | |
| # A stuck package mirror used to hold a job for tens of minutes. | |
| timeout-minutes: 8 | |
| run: | | |
| APT="-o Acquire::Retries=3 -o Acquire::http::Timeout=20 -o Acquire::https::Timeout=20" | |
| sudo apt-get $APT update | |
| sudo apt-get $APT install -y libsecret-1-dev | |
| - name: Get dependencies | |
| run: flutter pub get | |
| - name: Run tests (${{ matrix.section }}) | |
| run: | | |
| set -euo pipefail | |
| mapfile -t paths < <(./scripts/ci/test_sections.sh paths "${{ matrix.section }}") | |
| if [ "${#paths[@]}" -eq 0 ]; then | |
| echo "No tests in section ${{ matrix.section }}" | |
| exit 0 | |
| fi | |
| # Several runners share one machine, so cap the test processes each | |
| # job starts. | |
| flutter test --exclude-tags=golden \ | |
| --concurrency="${{ runner.environment == 'self-hosted' && '2' || '4' }}" \ | |
| "${paths[@]}" | |
| # Single required check for the whole suite: passes only when every section did. | |
| test: | |
| name: Run Tests | |
| if: always() | |
| needs: [test-sections, test-coverage] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: All test sections passed | |
| run: | | |
| echo "sections: ${{ needs.test-sections.result }}" | |
| echo "coverage: ${{ needs.test-coverage.result }}" | |
| [ "${{ needs.test-sections.result }}" = "success" ] && [ "${{ needs.test-coverage.result }}" = "success" ] | |
| # Every test file must belong to exactly one section. | |
| test-coverage: | |
| name: Test sections cover all tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - run: ./scripts/ci/test_sections.sh check | |
| analyze: | |
| name: Code Analysis | |
| timeout-minutes: 20 | |
| runs-on: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) && fromJSON('"ubuntu-latest"') || fromJSON(vars.CI_RUNS_ON || '"ubuntu-latest"') }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: '3.41.6' | |
| channel: 'stable' | |
| cache: true | |
| - name: Get dependencies | |
| run: flutter pub get | |
| - name: Analyze code | |
| run: flutter analyze | |
| # packages/ is excluded above: the bridge is its own dependency-free | |
| # package and must keep compiling to a single static binary. | |
| - name: Analyze and build querya-mcp | |
| run: | | |
| cd packages/querya_mcp_bridge | |
| dart pub get | |
| dart analyze --fatal-infos | |
| dart compile exe bin/querya_mcp.dart -o "$RUNNER_TEMP/querya-mcp" | |
| "$RUNNER_TEMP/querya-mcp" --help | grep -q "Usage: querya-mcp" | |
| # Release smoke build: runs after tests + analyze only when the workflow was | |
| # triggered by a version tag (semver X.Y.Z or legacy v*), not on branch/PR pushes. | |
| build-linux-release: | |
| name: Build Linux (release) | |
| needs: [test, analyze] | |
| if: startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Linux dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev libsecret-1-dev | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: '3.41.6' | |
| channel: 'stable' | |
| cache: true | |
| - name: Get dependencies | |
| run: flutter pub get | |
| - name: Build Linux (release) | |
| run: flutter build linux --release | |
| - name: Splice in vsync-patched Linux engine (querya-desktop#980) | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: ./scripts/linux/apply_patched_engine.sh |