Show a tested full end-to-end example #11
Workflow file for this run
This file contains 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 | |
# 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: | |
jobs: | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
# builds on windows fail | |
# https://github.com/bazelbuild/rules_docker/issues/1524 | |
# https://github.com/bazelbuild/rules_docker/issues/1438 | |
# - windows-latest | |
bazel: [4.2.4, 5.4.1, 6.2.0] | |
# The type of runner that the job will run on | |
runs-on: ${{ matrix.os }} | |
name: test-on-${{ matrix.os }}-with-bazel-${{ matrix.bazel }} | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v2 | |
- uses: bazelbuild/setup-bazelisk@v1 | |
- name: Mount bazel action cache | |
uses: actions/cache@v2 | |
with: | |
path: "~/.cache/bazel" | |
key: bazel | |
- name: Mount bazel repo cache | |
uses: actions/cache@v2 | |
with: | |
path: "~/.cache/bazel-repo" | |
key: bazel-repo | |
- name: Set Bazelisk Version ${{ matrix.bazel }} | |
run: echo ${{ matrix.bazel }} > .bazelversion | |
- name: Build | |
shell: bash | |
env: | |
# Bazelisk will download bazel to here | |
XDG_CACHE_HOME: ~/.cache/bazel-repo | |
run: bazel --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc build ... | |
- name: Test | |
shell: bash | |
env: | |
# Bazelisk will download bazel to here | |
XDG_CACHE_HOME: ~/.cache/bazel-repo | |
run: bazel --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc test ... | |
- name: Build examples to ensure functionality | |
# linux and latest | |
if: ${{ matrix.os == 'ubuntu-latest' && startsWith(matrix.bazel, '6.') }} | |
run: | | |
for d in $(find full-examples -name WORKSPACE -exec dirname {} \; ); do | |
echo "::group::example: ${d}" | |
echo ${{ matrix.bazel }} > ${d}/.bazelversion | |
case ${RUNNER_ENVIRONMENT}:${d} in | |
# opportunity to skip really big tests | |
# github-hosted:full-examples/huggingface_transformer_question_answering) echo "TOO big: skip in github-hosted" ;; | |
*) (cd ${d} && bazel --bazelrc=../../.github/workflows/ci.bazelrc --bazelrc=../../.bazelrc test ... && bazel clean );; | |
esac | |
echo "::endgroup::" | |
done |