Skip to content

Commit

Permalink
Merge pull request #51 from nx-dotnet/fix/fix-e2e-tests
Browse files Browse the repository at this point in the history
fix(repo): e2e tests run in CI again
  • Loading branch information
AgentEnder committed May 20, 2021
2 parents dd5fd61 + f7ed139 commit 3442155
Show file tree
Hide file tree
Showing 8 changed files with 17,194 additions and 204 deletions.
32 changes: 12 additions & 20 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ jobs:
build:
runs-on: ubuntu-latest
name: Building affected apps
if: needs.pre-run.outputs.skip != 'true'
steps:
- uses: actions/checkout@v1
- uses: bahmutov/npm-install@v1.4.5
Expand All @@ -22,7 +21,6 @@ jobs:
test:
runs-on: ubuntu-latest
name: Testing affected apps
if: needs.pre-run.outputs.skip != 'true'
steps:
- uses: actions/checkout@v1
- uses: bahmutov/npm-install@v1.4.5
Expand All @@ -31,17 +29,26 @@ jobs:
lint:
runs-on: ubuntu-latest
name: Linting affected apps
if: needs.pre-run.outputs.skip != 'true'
steps:
- uses: actions/checkout@v1
- uses: bahmutov/npm-install@v1.4.5
- run: yarn nx affected --target=lint --base=origin/master~1 --parallel

e2e:
runs-on: ubuntu-latest
name: E2E testing affected apps
needs: [build]
steps:
- uses: actions/checkout@v1
- uses: bahmutov/npm-install@v1.4.5
- run: yarn e2e
- run: git reset --hard

semantic-release:
runs-on: ubuntu-latest
name: Publish packages via semantic release
needs: [test]
if: ${{needs.pre-run.outputs.skip != 'true' && github.event_name == 'push'}}
needs: [test, e2e]
if: ${{github.event_name == 'push'}}
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
Expand All @@ -63,18 +70,3 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

# e2e:
# runs-on: ubuntu-latest
# name: E2E testing affected apps
# needs: [pre-run, build]
# if: needs.pre-run.outputs.skip == 'false'
# steps:
# - uses: actions/checkout@v1
# - uses: bahmutov/npm-install@v1.4.5
# - name: Download a single artifact
# uses: actions/download-artifact@v2
# with:
# name: dist
# path: dist
# - run: yarn e2e
27 changes: 13 additions & 14 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,16 @@ jobs:
- uses: bahmutov/npm-install@v1.4.5
- run: yarn commitlint --from ${{ github.event.pull_request.base.sha }} --to HEAD --verbose

# e2e:
# runs-on: ubuntu-latest
# name: E2E testing affected apps
# needs: [pre-run, build]
# if: needs.pre-run.outputs.skip == 'false'
# steps:
# - uses: actions/checkout@v1
# - uses: bahmutov/npm-install@v1.4.5
# - name: Download a single artifact
# uses: actions/download-artifact@v2
# with:
# name: dist
# path: dist
# - run: yarn e2e
e2e:
runs-on: ubuntu-latest
name: E2E testing affected apps
needs: [build]
steps:
- uses: actions/checkout@v1
- uses: bahmutov/npm-install@v1.4.5
# - name: Download a single artifact
# uses: actions/download-artifact@v2
# with:
# name: dist
# path: dist
- run: yarn e2e
28 changes: 7 additions & 21 deletions e2e/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { dirSync } from 'tmp';

interface RunCmdOpts {
silenceError?: boolean;
env?: Record<string, string>;
env?: Record<string, string> | NodeJS.ProcessEnv;
cwd?: string;
silent?: boolean;
}
Expand Down Expand Up @@ -146,21 +146,7 @@ export function newProject({ name = uniq('proj') } = {}): string {
updateFile('.npmrc', 'prefer-frozen-lockfile=false');
}

const packages = [
`@nrwl/angular`,
`@nrwl/express`,
`@nrwl/jest`,
`@nrwl/linter`,
`@nrwl/nest`,
`@nrwl/next`,
`@nrwl/gatsby`,
`@nrwl/node`,
`@nrwl/react`,
`@nrwl/storybook`,
`@nrwl/nx-plugin`,
`@nrwl/eslint-plugin-nx`,
`@nrwl/web`,
];
const packages = [`@nx-dotnet/core`, `@nx-dotnet/typescript`];
packageInstall(packages.join(` `), projScope);

if (useBackupProject) {
Expand Down Expand Up @@ -231,7 +217,7 @@ export function runCommandUntil(
let output = '';
let complete = false;

function checkCriteria(c) {
function checkCriteria(c: any) {
output += c.toString();
if (criteria(output)) {
complete = true;
Expand All @@ -242,8 +228,8 @@ export function runCommandUntil(
}
}

p.stdout.on('data', checkCriteria);
p.stderr.on('data', checkCriteria);
p.stdout?.on('data', checkCriteria);
p.stderr?.on('data', checkCriteria);
p.on('exit', (code) => {
if (code !== 0 && !complete) {
console.log(output);
Expand Down Expand Up @@ -272,7 +258,7 @@ export function runNgAdd(
command?: string,
opts: RunCmdOpts = {
silenceError: false,
env: process.env,
env: process.env as Record<string, string>,
cwd: tmpProjPath(),
},
): string {
Expand Down Expand Up @@ -322,7 +308,7 @@ export function runCLI(
}

const needsMaxWorkers = /g.*(express|nest|node|web|react):app.*/;
if (needsMaxWorkers.test(command)) {
if (command && needsMaxWorkers.test(command)) {
setMaxWorkers();
}

Expand Down
Loading

0 comments on commit 3442155

Please sign in to comment.