Internal Change #169
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: Valdi CI | |
| on: | |
| pull_request: | |
| paths: | |
| - '**/*.bzl' | |
| - '**/BUILD.bazel' | |
| - '**/BUILD' | |
| - 'MODULE.bazel' | |
| - 'registry/**' | |
| - 'tools/ci/**' | |
| - 'npm_modules/cli/test/**' | |
| - '.github/workflows/bzl-changes.yml' | |
| - '**/*.cpp' | |
| - '**/*.hpp' | |
| - '**/*.h' | |
| - '**/*.c' | |
| - 'third-party/**' | |
| - 'src/**/*.ts' | |
| - 'src/**/*.tsx' | |
| - 'compiler/**' | |
| - 'apps/snapshot_tests/**' | |
| - 'snap_drawing/**' | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - '**/*.bzl' | |
| - '**/BUILD.bazel' | |
| - '**/BUILD' | |
| - 'MODULE.bazel' | |
| - 'registry/**' | |
| - 'tools/ci/**' | |
| - 'npm_modules/cli/test/**' | |
| - '.github/workflows/bzl-changes.yml' | |
| - '**/*.cpp' | |
| - '**/*.hpp' | |
| - '**/*.h' | |
| - '**/*.c' | |
| - 'third-party/**' | |
| - 'src/**/*.ts' | |
| - 'src/**/*.tsx' | |
| - 'compiler/**' | |
| - 'apps/snapshot_tests/**' | |
| - 'snap_drawing/**' | |
| # Workflow-level permissions: id-token: write needed for GCP WIF auth on push events. | |
| # For fork PRs, GitHub automatically downgrades to read-only — the auth step | |
| # has continue-on-error so builds proceed without remote cache. | |
| permissions: | |
| contents: read | |
| id-token: write | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| smoke-test: | |
| name: Valdi Smoke Tests | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| - name: Configure Bazel cache | |
| uses: ./.github/actions/bazel-cache | |
| with: | |
| gcp_project_id: ${{ vars.GCP_PROJECT_ID }} | |
| workload_identity_provider: ${{ vars.WORKLOAD_IDENTITY_PROVIDER }} | |
| service_account: ${{ vars.GCP_SERVICE_ACCOUNT }} | |
| cache_bucket: ${{ vars.BAZEL_CACHE_BUCKET }} | |
| cache_key: smoke-test | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Setup Java 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'zulu' | |
| java-version: '17' | |
| - name: Install Bazel and watchman | |
| run: | | |
| brew install bazelisk watchman | |
| bazel --version | |
| watchman --version | |
| - name: Install Valdi CLI | |
| run: | | |
| cd npm_modules/cli | |
| npm run cli:install | |
| - name: Run smoke tests | |
| run: ./tools/ci/bootstrap_app.sh | |
| env: | |
| OPEN_SOURCE_DIR: ${{ github.workspace }} | |
| PROJECT_ROOT: /tmp/valdi_app | |
| - name: Upload test results | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-macos | |
| path: | | |
| /tmp/valdi_app/*.log | |
| /tmp/valdi_app/config.yaml | |
| /tmp/valdi_app/WORKSPACE | |
| /tmp/valdi_app/.bazelrc | |
| retention-days: 5 | |
| # Note: Linux CLI distribution tests moved to dedicated workflow: | |
| # .github/workflows/test-cli-linux.yml | |
| # This avoids duplication and provides better test organization. | |
| linux-ci: | |
| name: "Linux: ${{ matrix.name }}" | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: C++ Tests | |
| task: test-cpp | |
| - name: Build & Export | |
| task: build-export | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| - name: Setup Java 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'zulu' | |
| java-version: '17' | |
| - name: Configure Bazel cache | |
| uses: ./.github/actions/bazel-cache | |
| with: | |
| gcp_project_id: ${{ vars.GCP_PROJECT_ID }} | |
| workload_identity_provider: ${{ vars.WORKLOAD_IDENTITY_PROVIDER }} | |
| service_account: ${{ vars.GCP_SERVICE_ACCOUNT }} | |
| cache_bucket: ${{ vars.BAZEL_CACHE_BUCKET }} | |
| cache_key: ${{ matrix.task }} | |
| - name: Setup Linux environment | |
| run: source ./tools/ci/setup_linux_env.sh | |
| - name: Setup environment and install Valdi CLI | |
| if: matrix.task == 'build-export' | |
| run: | | |
| mkdir -p ~/.npm-global/lib | |
| npm config set prefix '~/.npm-global' | |
| npm install -g npm@8 | |
| export PATH=~/.npm-global/bin:$PATH | |
| cd npm_modules/cli | |
| npm run cli:install | |
| valdi --help | |
| - name: "Run: C++ Tests" | |
| if: matrix.task == 'test-cpp' | |
| run: ./tools/ci/run_tests.sh | |
| - name: "Run: Build & Export" | |
| if: matrix.task == 'build-export' | |
| run: | | |
| export PATH=~/.npm-global/bin:$PATH | |
| ./tools/ci/build_core_targets.sh | |
| ./tools/ci/test_exported_lib.sh | |
| ./tools/ci/bootstrap_app.sh | |
| env: | |
| OPEN_SOURCE_DIR: ${{ github.workspace }} | |
| PROJECT_ROOT: /tmp/valdi_app | |
| snapshot-tests: | |
| name: Snapshot Tests | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| - name: Configure Bazel cache | |
| uses: ./.github/actions/bazel-cache | |
| with: | |
| gcp_project_id: ${{ vars.GCP_PROJECT_ID }} | |
| workload_identity_provider: ${{ vars.WORKLOAD_IDENTITY_PROVIDER }} | |
| service_account: ${{ vars.GCP_SERVICE_ACCOUNT }} | |
| cache_bucket: ${{ vars.BAZEL_CACHE_BUCKET }} | |
| cache_key: snapshot-tests | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Setup Java 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'zulu' | |
| java-version: '17' | |
| - name: Install Bazel and watchman | |
| run: | | |
| brew install bazelisk watchman | |
| bazel --version | |
| - name: Run snapshot tests | |
| run: ./tools/ci/snapshot_tests.sh /tmp/valdi-snapshots | |
| - name: Upload diff images | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: snapshot-diffs | |
| path: /tmp/valdi-snapshots/diffs/ | |
| retention-days: 5 | |
| comment-results: | |
| name: Comment Test Results | |
| needs: [smoke-test, linux-ci, snapshot-tests] | |
| if: always() | |
| uses: ./.github/workflows/comment-test-results.yml | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| with: | |
| workflow_name: "Bazel & CI Test Results" | |
| success_message: "**All Bazel configuration and CI tests passed!** ✨\n\nThe build system and core tooling are working correctly." | |
| additional_info: "🚀 _Bazel remote cache is now enabled - future builds will be faster!_" |