| # Configuration file for https://circleci.com/gh/bazelbuild/rules_typescript |
| |
| # Note: YAML anchors allow an object to be re-used, reducing duplication. |
| # The ampersand declares an alias for an object, then later the `<<: *name` |
| # syntax dereferences it. |
| # See http://blog.daemonl.com/2016/02/yaml.html |
| # To validate changes, use an online parser, eg. |
| # http://yaml-online-parser.appspot.com/ |
| |
| ## IMPORTANT |
| # If you change the `docker_image` version, also change the `cache_key` suffix |
| var_1: &docker_image angular/ngcontainer:0.1.0 |
| var_2: &cache_key rules_typescript-{{ checksum "yarn.lock" }}-0.1.0 |
| var_3: &setup-bazel-remote-cache |
| run: |
| name: Start up bazel remote cache proxy |
| command: ~/bazel-remote-proxy -backend circleci:// |
| background: true |
| |
| # Settings common to each job |
| anchor_1: &job_defaults |
| working_directory: ~/ts |
| # Use a docker image with bazel already installed |
| docker: |
| - image: *docker_image |
| |
| # After checkout, rebase on top of master. |
| # Similar to travis behavior, but not quite the same. |
| # See https://discuss.circleci.com/t/1662 |
| anchor_2: &post_checkout |
| post: git pull --ff-only origin "refs/pull/${CI_PULL_REQUEST//*pull\//}/merge" |
| |
| version: 2 |
| jobs: |
| build: |
| <<: *job_defaults |
| steps: |
| - checkout: |
| <<: *post_checkout |
| - run: .circleci/setup_cache.sh |
| - *setup-bazel-remote-cache |
| |
| - restore_cache: |
| key: *cache_key |
| - run: bazel info release |
| - run: bazel run @yarn//:yarn |
| - run: bazel build --config=ci ... |
| - run: bazel test --config=ci ... |
| |
| # This job tests the same stuff, but without the .bazelrc file. |
| # It disables worker mode, for example. |
| build_no_bazelrc: |
| <<: *job_defaults |
| steps: |
| - checkout: |
| <<: *post_checkout |
| - run: .circleci/setup_cache.sh |
| - *setup-bazel-remote-cache |
| |
| - restore_cache: |
| key: *cache_key |
| - run: bazel --bazelrc=/dev/null info release |
| - run: bazel --bazelrc=/dev/null run @yarn//:yarn |
| - run: bazel --bazelrc=/dev/null build --config=ci ... |
| - run: bazel --bazelrc=/dev/null test --config=ci ... |
| |
| - save_cache: |
| key: *cache_key |
| paths: |
| - "node_modules" |
| |
| # Runs end-to-end browser tests. |
| test: |
| <<: *job_defaults |
| steps: |
| - checkout: |
| <<: *post_checkout |
| - run: .circleci/setup_cache.sh |
| - *setup-bazel-remote-cache |
| - restore_cache: |
| key: *cache_key |
| - run: bazel run @yarn//:yarn |
| # Don't occupy the bazel server, as this test wants to run Bazel itself |
| - run: bazel run @yarn//:yarn test --script_path=yarn_test.sh |
| - run: xvfb-run -a ./yarn_test.sh |
| |
| lint: |
| <<: *job_defaults |
| steps: |
| - checkout: |
| <<: *post_checkout |
| - run: .circleci/setup_cache.sh |
| - *setup-bazel-remote-cache |
| # To get the skylint binary from the cache, we need to build with --config=ci |
| # Since we do the build in the preskylint step, we first need to explicitly |
| # run that with the --config bazel option. |
| - run: yarn preskylint --config=ci |
| # Now the execution of preskylint should get a local cache hit on the binary. |
| - run: yarn skylint |
| |
| workflows: |
| version: 2 |
| # Run the two builds in parallel, reporting separate status to github PRs. |
| default_workflow: |
| jobs: |
| - build |
| - build_no_bazelrc |
| - test |
| - lint |