name: GitHub Cache

on:
  push:
    branches: [trunk]
    paths:
      - 'MODULE.bazel'
      - 'multitool.lock.json'
      - 'pnpm-lock.yaml'
      - 'rust/Cargo.lock'
      - 'java/maven_install.json'
      - 'py/requirements_lock.txt'
      - 'rb/Gemfile.lock'
      - 'dotnet/paket.lock'
      - 'common/repositories.bzl'
      - 'common/browsers.bzl'
  schedule:
    - cron: '30 6 * * *'
  workflow_dispatch:

concurrency:
  group: gh-cache-${{ github.ref }}
  cancel-in-progress: true

permissions:
  contents: read

jobs:
  populate:
    name: Populate Cache
    strategy:
      fail-fast: false
      matrix:
        os: [macos, windows]
    uses: ./.github/workflows/bazel.yml
    with:
      name: ${{ matrix.os }}
      os: ${{ matrix.os }}
      cache-save: true
      run: >-
        bazel build --nobuild --build_tests_only --keep_going --pin_browsers=false
        //java/test/... //py:* //rb/spec/... //rust/tests/...
        //javascript/selenium-webdriver:* //dotnet/test/...
