Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/angular-tofu-showcase-e2e/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default defineConfig({
webServer: {
command: 'npx nx run angular-tofu-showcase:serve',
url: 'http://localhost:4200',
reuseExistingServer: !process.env.CI,
reuseExistingServer: false, //!process.env.CI,
cwd: workspaceRoot,
},
projects: [
Expand Down
6 changes: 6 additions & 0 deletions builds/ci-build/src/build-it-lib/runtime/build-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ export class BuildContext {

logLevel = LogLevel.Info;

isCI = this.determineCIEnvironment();

getTasks<T>(ctor: constructor<T>) {
container.resolve(ctor);
}

private determineCIEnvironment() {
return process.env.GITHUB_ACTIONS === 'true';
}
}
2 changes: 2 additions & 0 deletions builds/ci-build/src/build-it-lib/runtime/build-executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export class BuildExecutor {
}

private async runBuild(buildDefinition: BuildDefinition, targets: string[]) {
this.logger.log('Is running on CI build server:', this.buildContext.isCI);

const buildTargets = this.findBuildTargets(buildDefinition, targets);

this.buildContext.targets = buildTargets.map((t) => t.name);
Expand Down
13 changes: 12 additions & 1 deletion builds/ci-build/src/build-it-lib/tasks/nx-tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export class NxTasks extends BuildTasks {
}

async executeNxCommand(command: string) {
this.logger.log(`Executing Nx command: ${command}`);
return await this.cmdExecutor.executeStream(`npx nx ${command}`);
}

Expand All @@ -26,20 +27,30 @@ export class NxTasks extends BuildTasks {
return this.executeNxCommand(`affected -t ${targets.join(' ')} ${baseArg}`);
}

async runTargetsForAll(targets: string[]) {
const baseArg = this.base ? `--base=${this.base}` : '';
return this.executeNxCommand(`run-many -t ${targets.join(' ')} ${baseArg}`);
}

async setReleaseVersion(version: string) {
return this.executeNxCommand(
`release version ${version} --stage-changes=false --git-commit=false`
);
}

async releaseAndPublish(projectName: string, access: string) {
//run angular-tofu:nx-release-publish --access public
const args = [
'run',
`${projectName}:nx-release-publish`,
`--access ${access}`,
'--dryRun',
//'--registry=https://registry.npmjs.org/',
];

if (this.context.dryRun) {
args.push('--dry-run');
}

return this.executeNxCommand(args.join(' '));
}
}
2 changes: 1 addition & 1 deletion builds/ci-build/src/the-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class TheBuild extends BuildDefinition {
name: 'nxTargets',
execute: async (buildContext) => {
this.logger.log('GitVersion:', await this.gitVersion.value.getVersion());
await this.nxTasks.runTargetForAffected(['lint', 'test', 'build', 'e2e']);
await this.nxTasks.runTargetsForAll(['lint', 'test', 'build', 'e2e']);
},
dependsOn: [this.setReleaseVersion],
};
Expand Down