ci: add linux buildkite tests

This commit is contained in:
Filipe Silva 2019-01-06 00:00:49 +00:00
parent 784453cf9d
commit 1dd11c99cc
5 changed files with 100 additions and 32 deletions

View File

@ -8,3 +8,7 @@ services:
build:
context: ../../
dockerfile: ./.buildkite/dockerfiles/windows-test.Dockerfile
linux-test:
build:
context: ../../
dockerfile: ./.buildkite/dockerfiles/linux-test.Dockerfile

View File

@ -1,32 +1,21 @@
ARG target=node:10.12
FROM $target
# Redeclare target ARG after FROM to inherit use value from the first ARG.
# https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact
ARG target
FROM node:10.12
# Install Bazel Ubuntu pre-requisites if it's the default target.
# Subsequent targets will already have it installed.
# Bazel Ubuntu pre-requisites.
# https://docs.bazel.build/versions/master/install-ubuntu.html
RUN if [ "$target" = "node:10.12" ] ; then apt-get update; apt-get -y install pkg-config zip g++ zlib1g-dev unzip python ; fi
# Chrome prerequisites
RUN if [ "$target" = "node:10.12" ] ; then apt-get -y install libx11-xcb1 libxrandr2 libasound2 libpangocairo-1.0-0 libatk1.0-0 libatk-bridge2.0-0 libgtk-3-0 libnss3 libxss1 ; fi
RUN apt-get update;
RUN apt-get -y install pkg-config zip g++ zlib1g-dev unzip python
# Setup files.
WORKDIR /src
COPY ./ /src
COPY .circleci/bazel.rc /etc/bazel.bazelrc
# Chrome prerequisites.
# Based on https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker
RUN apt-get install -y wget --no-install-recommends \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y google-chrome-unstable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst ttf-freefont \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get purge --auto-remove -y curl \
&& rm -rf /src/*.deb
# Workaround symlink when building image on Windows.
RUN rm /src/packages/upgrade/static/src
RUN ln -s ../src /src/packages/upgrade/static/src
# Install dependencies and run tests.
RUN yarn install --frozen-lockfile --non-interactive
# RUN yarn bazel test //tools/ts-api-guardian:all
RUN yarn bazel build //... --build_tag_filters=-ivy-only --test_tag_filters=-ivy-only,-local
# RUN yarn bazel build --define=compile=aot --build_tag_filters=-no-ivy-aot,-fixme-ivy-aot --test_tag_filters=-no-ivy-aot,-fixme-ivy-aot //...
# RUN yarn bazel test //... --build_tag_filters=-ivy-only --test_tag_filters=-ivy-only,-local
# RUN yarn test-ivy-aot //...
# docker build -t angular:latest .
# docker build . --build-arg target=angular:latest
# Work back from https://github.com/CircleCI-Public/circleci-dockerfiles/blob/master/node/images/10.12.0-jessie/Dockerfile to get Chrome working properly

View File

@ -0,0 +1,32 @@
FROM gcr.io/internal-200822/angular-linux:latest
USER root
# TODO: Delete the above once the bootstrap image is available.
WORKDIR /src
# Copy package.json and yarn.lock before the other files.
# This allows docker to cache these steps even if source files change.
COPY ./package.json /src/package.json
COPY ./yarn.lock /src/yarn.lock
COPY ./tools/yarn/check-yarn.js /src/tools/yarn/check-yarn.js
COPY ./tools/postinstall-patches.js /src/tools/postinstall-patches.js
RUN yarn install --frozen-lockfile --non-interactive --network-timeout 100000
# Setup files.
COPY ./ /src
COPY .circleci/bazel.rc /etc/bazel.bazelrc
# Workaround symlink when building image on Windows.
RUN rm /src/packages/upgrade/static/src
RUN ln -s ../src /src/packages/upgrade/static/src
# Run tests.
RUN yarn bazel test //tools/ts-api-guardian:all --noshow_progress
# RUN yarn bazel build //... --build_tag_filters=-ivy-only --test_tag_filters=-ivy-only,-local
# RUN yarn bazel build --define=compile=aot --build_tag_filters=-no-ivy-aot,-fixme-ivy-aot --test_tag_filters=-no-ivy-aot,-fixme-ivy-aot //...
# RUN yarn bazel test //... --build_tag_filters=-ivy-only --test_tag_filters=-ivy-only,-local
# RUN yarn test-ivy-aot //...
# docker build -t angular:latest .
# docker build . --build-arg target=angular:latest

View File

@ -8,12 +8,29 @@ steps:
- target=gcr.io/internal-200822/angular-windows:master
agents:
windows: true
- wait
- label: windows-update-image
branches: master
- label: linux-test
plugins:
- docker-compose#v2.6.0:
push: windows-test:gcr.io/internal-200822/angular-windows:master
build: linux-test
config: .buildkite/dockerfiles/docker-compose.yml
# args:
# - target=gcr.io/internal-200822/angular-linux:master
agents:
windows: true
linux: true
- wait
# - label: windows-update-image
# branches: master
# plugins:
# - docker-compose#v2.6.0:
# push: windows-test:gcr.io/internal-200822/angular-windows:master
# config: .buildkite/dockerfiles/docker-compose.yml
# agents:
# windows: true
# - label: linux-update-image
# # branches: master
# plugins:
# - docker-compose#v2.6.0:
# push: linux-test:gcr.io/internal-200822/angular-linux:master
# config: .buildkite/dockerfiles/docker-compose.yml
# agents:
# linux: true

View File

@ -0,0 +1,26 @@
Follow https://buildkite.com/docs/agent/v3/gcloud#running-the-agent-on-google-container-engine
but :
on the cluster creation chose n1-highcpu-16 instances, and give "read write" permissions to Storage
on the "Create a deployment to start an agent:" step use change
```
env:
- name: BUILDKITE_AGENT_TOKEN
valueFrom: {secretKeyRef: {name: buildkite-agent, key: token}}
```
to
```
env:
- name: BUILDKITE_AGENT_TOKEN
valueFrom: {secretKeyRef: {name: buildkite-agent, key: token}}
- name: BUILDKITE_AGENT_TAGS
value: "linux=true"
- name: BUILDKITE_TIMESTAMP_LINES
value: "true"
```
config kubernetes to access container registry
maybe just give write access to storage https://medium.com/google-cloud/updating-google-container-engine-vm-scopes-with-zero-downtime-50bff87e5f80
https://cloud.google.com/container-registry/docs/using-with-google-cloud-platform
https://container-solutions.com/using-google-container-registry-with-kubernetes/