Skip to content

G

G #10

Workflow file for this run

name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [main]
pull_request:
branches: [main]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Bazelisk will download bazel to here, ensure it is cached between runs.
env:
XDG_CACHE_HOME: ~/.cache/bazel-repo
jobs:
# matrix-prep-* steps dynamically generate a bit of JSON depending on whether our action has
# access to repository secrets. When running on a pull_request from a fork, the author is
# untrusted so the secret will be absent. Insanely complex for how simple this requirement is...
# inspired from
# https://stackoverflow.com/questions/65384420/how-to-make-a-github-action-matrix-element-conditional
matrix-prep-os:
# Prepares the 'os' axis of the test matrix
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: linux
run: echo "os=ubuntu-latest" >> $GITHUB_OUTPUT
- id: macos
run: echo "os=macos-latest" >> $GITHUB_OUTPUT
# Only run on main branch (not PRs) to minimize macOS minutes (billed at 10X)
# https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#included-storage-and-minutes
if: ${{ github.ref == 'refs/heads/main' }}
outputs:
# Will look like ["ubuntu-latest", "macos-latest"]
os: ${{ toJSON(steps.*.outputs.os) }}
test:
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
needs:
- matrix-prep-os
strategy:
fail-fast: false
matrix:
os: ${{ fromJSON(needs.matrix-prep-os.outputs.os) }}
folder:
- 'angular'
- 'angular-ngc'
- 'bazelrc'
- 'bzlmod'
- 'check-npm-determinism'
- 'directory_path'
# TODO: intentionally fails
# - 'eager-fetch'
- 'git_push'
- 'go_workspaces'
- 'jest'
- 'nestjs'
- 'oci_go_image'
- 'oci_python_image'
- 'pnpm-workspaces'
- 'prisma'
- 'protobufjs'
- 'bufbuild'
- 'rules_nodejs_to_rules_js_migration'
- 'ts_project_transpiler'
- 'write_source_files'
steps:
- uses: actions/checkout@v3
- name: Mount bazel caches
uses: actions/cache@v3
with:
path: |
"~/.cache/bazel"
"~/.cache/bazel-repo"
key: bazel-cache-${{ matrix.folder }}-${{ hashFiles('**/BUILD.bazel', '**/*.bzl', 'WORKSPACE') }}
restore-keys: bazel-cache-
- name: Test Type
id: has_test_sh
uses: andstor/file-existence-action@v1
with:
files: '${{ matrix.folder }}/test.sh'
- name: test.sh
working-directory: ${{ matrix.folder }}
if: steps.has_test_sh.outputs.files_exists == 'true'
run: ./test.sh
shell: bash
- name: bazel test //...
working-directory: ${{ matrix.folder }}
if: steps.has_test_sh.outputs.files_exists != 'true'
run: |
bazel \
--bazelrc=$GITHUB_WORKSPACE/bazelrc/.aspect/bazelrc/ci.bazelrc \
--bazelrc=$GITHUB_WORKSPACE/.github/workflows/ci.bazelrc \
test //...