diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ec70bffd..875d99461 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,12 +4,13 @@ name: CI on: push: - branches: [ main, develop ] + branches: [ main, develop, test/gcp-staging-ci ] pull_request: branches: [ main, earlgrey-hwe ] permissions: contents: read + id-token: write env: CARGO_TERM_COLOR: always @@ -18,7 +19,7 @@ env: jobs: presubmit: name: Presubmit Checks - runs-on: openprot-ci-runner + runs-on: openprot-ci-runner-staging steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 @@ -29,6 +30,23 @@ jobs: disk-cache: false repository-cache: false + - name: Authenticate to GCP (WIF) + uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3 + with: + workload_identity_provider: projects/205490233253/locations/global/workloadIdentityPools/github-actions-pool/providers/github-oidc + service_account: ${{ github.event_name == 'push' && github.ref == 'refs/heads/test/gcp-staging-ci' && 'bazel-cache-writer@openprot-ci-staging.iam.gserviceaccount.com' || 'bazel-cache-reader@openprot-ci-staging.iam.gserviceaccount.com' }} + + - name: Configure Bazel remote cache + run: | + cat < .bazelrc-site + build --remote_cache=https://storage.googleapis.com/openprot-ci-staging-bazel-cache + build --google_default_credentials=true + build --remote_upload_local_results=${{ github.event_name == 'push' && github.ref == 'refs/heads/test/gcp-staging-ci' }} + build --experimental_remote_cache_eviction_retries=5 + build --experimental_remote_cache_async + build --experimental_inprocess_symlink_creation=false + EOF + - name: Presubmit Checks # The presubmit workflow performs formatting checks, a MODULE.bazel.lock # up-to-date check, license checks, C/C++ include checks and clippy lints. @@ -38,7 +56,7 @@ jobs: test: name: Test needs: presubmit - runs-on: openprot-ci-runner + runs-on: openprot-ci-runner-staging steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 @@ -49,6 +67,23 @@ jobs: disk-cache: false repository-cache: false + - name: Authenticate to GCP (WIF) + uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3 + with: + workload_identity_provider: projects/205490233253/locations/global/workloadIdentityPools/github-actions-pool/providers/github-oidc + service_account: ${{ github.event_name == 'push' && github.ref == 'refs/heads/test/gcp-staging-ci' && 'bazel-cache-writer@openprot-ci-staging.iam.gserviceaccount.com' || 'bazel-cache-reader@openprot-ci-staging.iam.gserviceaccount.com' }} + + - name: Configure Bazel remote cache + run: | + cat < .bazelrc-site + build --remote_cache=https://storage.googleapis.com/openprot-ci-staging-bazel-cache + build --google_default_credentials=true + build --remote_upload_local_results=${{ github.event_name == 'push' && github.ref == 'refs/heads/test/gcp-staging-ci' }} + build --experimental_remote_cache_eviction_retries=5 + build --experimental_remote_cache_async + build --experimental_inprocess_symlink_creation=false + EOF + - name: Run tests # See workflows.json for the `ci` definition. run: ./pw ci @@ -56,7 +91,7 @@ jobs: build: name: Build Targets needs: test - runs-on: openprot-ci-runner + runs-on: openprot-ci-runner-staging steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 @@ -68,6 +103,23 @@ jobs: disk-cache: false repository-cache: false + - name: Authenticate to GCP (WIF) + uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3 + with: + workload_identity_provider: projects/205490233253/locations/global/workloadIdentityPools/github-actions-pool/providers/github-oidc + service_account: ${{ github.event_name == 'push' && github.ref == 'refs/heads/test/gcp-staging-ci' && 'bazel-cache-writer@openprot-ci-staging.iam.gserviceaccount.com' || 'bazel-cache-reader@openprot-ci-staging.iam.gserviceaccount.com' }} + + - name: Configure Bazel remote cache + run: | + cat < .bazelrc-site + build --remote_cache=https://storage.googleapis.com/openprot-ci-staging-bazel-cache + build --google_default_credentials=true + build --remote_upload_local_results=${{ github.event_name == 'push' && github.ref == 'refs/heads/test/gcp-staging-ci' }} + build --experimental_remote_cache_eviction_retries=5 + build --experimental_remote_cache_async + build --experimental_inprocess_symlink_creation=false + EOF + - name: Build # See workflows.json for the `default` definition. run: ./pw default