mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-17 02:54:21 +08:00
ci: add circleci windows preview
This commit is contained in:
parent
a208cf4b31
commit
97970026f1
@ -23,6 +23,12 @@ anchor_1: &defaults
|
||||
working_directory: ~/ng
|
||||
docker:
|
||||
- image: *default_docker_image
|
||||
anchor_1_win: &defaults_win
|
||||
working_directory: ~/ng
|
||||
resource_class: windows.medium
|
||||
shell: powershell.exe -ExecutionPolicy Bypass
|
||||
machine:
|
||||
image: windows-server-2019
|
||||
|
||||
# After checkout, rebase on top of target branch.
|
||||
anchor_2: &post_checkout
|
||||
@ -38,6 +44,14 @@ anchor_2: &post_checkout
|
||||
else
|
||||
echo "This build is not over a PR, nothing to do."
|
||||
fi
|
||||
anchor_2_win: &post_checkout_win
|
||||
run:
|
||||
name: Rebase PR on target branch
|
||||
command: >
|
||||
if (Test-Path env:CIRCLE_PR_NUMBER) {
|
||||
git config user.name "angular-ci"
|
||||
git config user.email "angular-ci"
|
||||
node tools\rebase-pr.js angular/angular-cli $env:CIRCLE_PR_NUMBER }
|
||||
anchor_3: &restore_cache
|
||||
restore_cache:
|
||||
keys:
|
||||
@ -46,9 +60,15 @@ anchor_3: &restore_cache
|
||||
- angular_devkit-0.7.0-
|
||||
anchor_4: &attach_options
|
||||
at: .
|
||||
anchor_5: &env_win
|
||||
run:
|
||||
# Need to install node and yarn before, as the base windows image doesn't have anything.
|
||||
# TODO: remove when CircleCI provides preconfigured node images/VMs.
|
||||
name: Setup windows node environment
|
||||
command: ./.circleci/windows-env.ps1
|
||||
|
||||
# Job definitions
|
||||
version: 2
|
||||
version: 2.1
|
||||
jobs:
|
||||
install:
|
||||
<<: *defaults
|
||||
@ -202,6 +222,45 @@ jobs:
|
||||
command: |
|
||||
npm run admin -- publish --verbose
|
||||
|
||||
# Windows jobs
|
||||
# CircleCI support for Windows jobs is still in preview.
|
||||
# Docs: https://github.com/CircleCI-Public/windows-preview-docs
|
||||
test-win:
|
||||
<<: *defaults_win
|
||||
# Skipping cache and workspace for now because it takes 10x longer than on linux.
|
||||
# TODO: when/if CircleCI makes them faster, use cache and workspaces fully.
|
||||
# Notes:
|
||||
# - windows needs its own cache key because binaries in node_modules are different.
|
||||
# - windows might need its own workspace for the same reason.
|
||||
# - get cache dir on windows via `yarn cache dir` (was `C:\Users\circleci\AppData\Local\Yarn\Cache\v4` last time)
|
||||
steps:
|
||||
- checkout
|
||||
- *env_win
|
||||
- *post_checkout_win
|
||||
- run: node --version
|
||||
- run: yarn --version
|
||||
- run: yarn install --frozen-lockfile
|
||||
# Build and test should be on their own jobs, but restoring workspaces is too slow
|
||||
# so we do it here.
|
||||
- run: npm run admin -- build
|
||||
- run: npm run test -- --full
|
||||
# Run partial e2e suite on PRs only. Master will run the full e2e suite with sharding.
|
||||
- run: if (Test-Path env:CIRCLE_PR_NUMBER) { node tests\legacy-cli\run_e2e.js "--glob=tests/{basic,ivy}/**" }
|
||||
|
||||
e2e-cli-win:
|
||||
<<: *defaults_win
|
||||
parallelism: 4
|
||||
steps:
|
||||
- checkout
|
||||
- *env_win
|
||||
# TODO: remove commands other than the e2e runner when workspaces on windows are well supported.
|
||||
- *post_checkout_win
|
||||
- run: node --version
|
||||
- run: yarn --version
|
||||
- run: yarn install --frozen-lockfile
|
||||
- run: npm run admin -- build
|
||||
- run: node tests\legacy-cli\run_e2e.js --nb-shards=$env:CIRCLE_NODE_TOTAL --shard=$env:CIRCLE_NODE_INDEX
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
default_workflow:
|
||||
@ -237,7 +296,7 @@ workflows:
|
||||
- build
|
||||
- e2e-cli-ivy:
|
||||
requires:
|
||||
- build
|
||||
- build
|
||||
- snapshot_publish_docs:
|
||||
requires:
|
||||
- install
|
||||
@ -248,6 +307,16 @@ workflows:
|
||||
- e2e-cli-ng-snapshots:
|
||||
requires:
|
||||
- build
|
||||
- test-win:
|
||||
requires:
|
||||
- test
|
||||
- e2e-cli-win:
|
||||
requires:
|
||||
- e2e-cli
|
||||
filters:
|
||||
branches:
|
||||
ignore:
|
||||
- /pull\/.*/
|
||||
- snapshot_publish:
|
||||
requires:
|
||||
- test
|
||||
|
9
.circleci/windows-env.ps1
Normal file
9
.circleci/windows-env.ps1
Normal file
@ -0,0 +1,9 @@
|
||||
# Install nodejs and yarn via Chocolatey.
|
||||
choco install nodejs --version 12.1.0 --no-progress
|
||||
choco install yarn --version 1.16.0 --no-progress
|
||||
|
||||
# Add PATH modifications to the Powershell profile. This is the win equivalent of .bash_profile.
|
||||
# https://docs.microsoft.com/en-us/previous-versions//bb613488(v=vs.85)
|
||||
new-item -path $profile -itemtype file -force
|
||||
# Paths for nodejs, npm, and yarn. Use single quotes to prevent interpolation.
|
||||
Add-Content $profile '$Env:path += ";C:\Program Files\nodejs\;C:\Users\circleci\AppData\Roaming\npm\;C:\Program Files (x86)\Yarn\bin\;"'
|
6
lib/bootstrap-local.js
vendored
6
lib/bootstrap-local.js
vendored
@ -87,12 +87,12 @@ const oldRequireTs = require.extensions['.ts'];
|
||||
require.extensions['.ts'] = function (m, filename) {
|
||||
// If we're in node module, either call the old hook or simply compile the
|
||||
// file without transpilation. We do not touch node_modules/**.
|
||||
// We do touch `Angular DevK` files anywhere though.
|
||||
if (!filename.match(/@angular\/cli\b/) && filename.match(/node_modules/)) {
|
||||
// To account for Yarn workspaces symlinks, we much check the real path.
|
||||
if (fs.realpathSync(filename).match(/node_modules/)) {
|
||||
if (oldRequireTs) {
|
||||
return oldRequireTs(m, filename);
|
||||
}
|
||||
return m._compile(fs.readFileSync(filename), filename);
|
||||
return m._compile(fs.readFileSync(filename).toString(), filename);
|
||||
}
|
||||
|
||||
debugBuildTs(filename);
|
||||
|
@ -43,7 +43,7 @@
|
||||
"url": "https://github.com/angular/angular-cli.git"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.9.0 <11.0.0",
|
||||
"node": ">=10.9.0 <13.0.0",
|
||||
"yarn": ">=1.9.0 <2.0.0"
|
||||
},
|
||||
"author": "Angular Authors",
|
||||
|
@ -164,7 +164,7 @@ describe('Universal Schematic', () => {
|
||||
const filePath = '/projects/bar/src/main.ts';
|
||||
const contents = tree.readContent(filePath);
|
||||
expect(contents)
|
||||
.toMatch(/document.addEventListener\('DOMContentLoaded', \(\) => {[\w\W]+;[\r\n]}\);/);
|
||||
.toMatch(/document.addEventListener\('DOMContentLoaded', \(\) => {/);
|
||||
});
|
||||
|
||||
it('should wrap the bootstrap declaration in a DOMContentLoaded event handler', async () => {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import {join} from 'path';
|
||||
import {ng} from '../../../utils/process';
|
||||
import {expectFileToMatch} from '../../../utils/fs';
|
||||
import { updateJsonFile } from '../../../utils/project';
|
||||
import { updateJsonFile, useCIChrome, useCIDefaults } from '../../../utils/project';
|
||||
|
||||
|
||||
export default function() {
|
||||
@ -17,6 +17,8 @@ export default function() {
|
||||
.then(() => expectFileToMatch(join(directiveDir, 'test2-directive.directive.ts'),
|
||||
/selector: '\[preW/))
|
||||
.then(() => ng('generate', 'application', 'app-two', '--skip-install'))
|
||||
.then(() => useCIDefaults('app-two'))
|
||||
.then(() => useCIChrome('./projects/app-two'))
|
||||
.then(() => updateJsonFile('angular.json', configJson => {
|
||||
configJson.projects['test-project'].schematics = {
|
||||
'@schematics/angular:directive': { prefix: 'preP' }
|
||||
|
@ -2,6 +2,12 @@ import { execAndWaitForOutputToMatch, execWithEnv, killAllProcesses } from '../.
|
||||
|
||||
|
||||
export default async function() {
|
||||
if (process.platform.startsWith('win')) {
|
||||
// "On Windows, process.title affects the console title, but not the name of the process in the task manager."
|
||||
// https://stackoverflow.com/questions/44756196/how-to-change-the-node-js-process-name-on-windows-10#comment96259375_44756196
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
try {
|
||||
await execAndWaitForOutputToMatch('ng', ['build', '--watch'], /./);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user