diff --git a/.buildkite/dockerfiles/docker-compose.yml b/.buildkite/dockerfiles/docker-compose.yml new file mode 100644 index 0000000000..a28ee374eb --- /dev/null +++ b/.buildkite/dockerfiles/docker-compose.yml @@ -0,0 +1,10 @@ +version: '3' +services: + windows-env: + build: + context: ../../ + dockerfile: ./.buildkite/dockerfiles/windows-env.Dockerfile + windows-test: + build: + context: ../../ + dockerfile: ./.buildkite/dockerfiles/windows-test.Dockerfile diff --git a/.buildkite/fix-msys64.cmd b/.buildkite/dockerfiles/fix-msys64.cmd similarity index 100% rename from .buildkite/fix-msys64.cmd rename to .buildkite/dockerfiles/fix-msys64.cmd diff --git a/.buildkite/dockerfiles/linux-env.Dockerfile b/.buildkite/dockerfiles/linux-env.Dockerfile new file mode 100644 index 0000000000..6c3ce94c50 --- /dev/null +++ b/.buildkite/dockerfiles/linux-env.Dockerfile @@ -0,0 +1,32 @@ +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 + +# Install Bazel Ubuntu pre-requisites if it's the default target. +# Subsequent targets will already have it installed. +# 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 + +# Setup files. +WORKDIR /src +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 + +# 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 diff --git a/.buildkite/Dockerfile b/.buildkite/dockerfiles/windows-env.Dockerfile similarity index 100% rename from .buildkite/Dockerfile rename to .buildkite/dockerfiles/windows-env.Dockerfile diff --git a/.buildkite/dockerfiles/windows-test.Dockerfile b/.buildkite/dockerfiles/windows-test.Dockerfile new file mode 100644 index 0000000000..940319c5d3 --- /dev/null +++ b/.buildkite/dockerfiles/windows-test.Dockerfile @@ -0,0 +1,21 @@ +# Use the a previous image as source, or bootstrap to the default image. +ARG target=filipesilva/node-bazel-windows:0.0.2 +FROM $target +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 +RUN yarn install --frozen-lockfile --non-interactive --network-timeout 100000 + +# Copy files. +COPY ./ /src + +# Setup. +COPY .circleci/bazel.rc /etc/bazel.bazelrc +RUN del packages\upgrade\static\src +RUN mklink /d packages\upgrade\static\src ..\src + +# Run tests. +RUN yarn bazel test //tools/ts-api-guardian:all --noshow_progress diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 58dd597bc4..4ece462789 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -1,10 +1,19 @@ steps: - label: windows-test - commands: - - "yarn install --frozen-lockfile --non-interactive --network-timeout 100000" - - "yarn bazel test //tools/ts-api-guardian:all --noshow_progress" plugins: - - docker#v2.1.0: - image: "filipesilva/node-bazel-windows:0.0.2" + - docker-compose#v2.6.0: + build: windows-test + config: .buildkite/dockerfiles/docker-compose.yml + args: + - target=gcr.io/internal-200822/angular-windows:master + agents: + windows: 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 diff --git a/.buildkite/provision-windows-buildkite.ps1 b/.buildkite/provision/provision-windows-buildkite.ps1 similarity index 85% rename from .buildkite/provision-windows-buildkite.ps1 rename to .buildkite/provision/provision-windows-buildkite.ps1 index 56c84569b1..c4f6dd44d8 100644 --- a/.buildkite/provision-windows-buildkite.ps1 +++ b/.buildkite/provision/provision-windows-buildkite.ps1 @@ -8,6 +8,8 @@ # We recommend machine type n1-highcpu-16 (16 vCPUs, 14.4 GB memory). # Use a windows boot disk with container support such as # "Windows Server version 1803 Datacenter Core for Containers". +# Give it push access to the Container Registry by clicking "Set access for each API" and +# setting "Storage" to "Read Write". # Give it a name, then click "Create". # VM setup: @@ -56,6 +58,15 @@ Invoke-WebRequest -Uri https://github.com/git-for-windows/git/releases/download/ Add-Path "C:\git\bin" Remove-Item git.exe +# Install Docker Compose 1.23.2 +# https://docs.docker.com/compose/install/#install-compose +Invoke-WebRequest "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-Windows-x86_64.exe" -UseBasicParsing -OutFile $Env:ProgramFiles\docker\docker-compose.exe + +# Add the gcloud Docker credential helper to the local system account (used by NSSM) +# https://cloud.google.com/container-registry/docs/advanced-authentication +gcloud auth configure-docker --quiet +Copy-Item C:\Users\angular\.docker -Destination C:\Windows\System32\config\systemprofile\ -Recurse + # Download NSSM (https://nssm.cc/) to run the BuildKite agent as a service. Write-Host "Downloading NSSM." Invoke-WebRequest -Uri https://nssm.cc/ci/nssm-2.24-101-g897c7ad.zip -OutFile nssm.zip