(logs: string)
| 569 | |
| 570 | // Try to extract useful warnings from logs. Sometimes we may even want to fail the build. This won't work if the step is cached. |
| 571 | function checkLogsForWarnings(logs: string): WarningsCheckReturn { |
| 572 | const warnings: LogParserOptions = [ |
| 573 | { |
| 574 | regex: /prisma:warn We could not find your Prisma schema/, |
| 575 | message: `Prisma generate failed to find the default schema. Did you include it in config.additionalFiles? ${terminalLink( |
| 576 | "Config docs", |
| 577 | docs.config.prisma |
| 578 | )}\nCustom schema paths require a postinstall script like this: \`prisma generate --schema=./custom/path/to/schema.prisma\``, |
| 579 | shouldFail: true, |
| 580 | }, |
| 581 | ]; |
| 582 | |
| 583 | const errorMessages: string[] = []; |
| 584 | const warningMessages: string[] = []; |
| 585 | |
| 586 | let shouldFail = false; |
| 587 | |
| 588 | for (const warning of warnings) { |
| 589 | const matches = logs.match(warning.regex); |
| 590 | |
| 591 | if (!matches) { |
| 592 | continue; |
| 593 | } |
| 594 | |
| 595 | const message = getMessageFromTemplate(warning.message, matches.groups); |
| 596 | |
| 597 | if (warning.shouldFail) { |
| 598 | shouldFail = true; |
| 599 | errorMessages.push(message); |
| 600 | } else { |
| 601 | warningMessages.push(message); |
| 602 | } |
| 603 | } |
| 604 | |
| 605 | if (shouldFail) { |
| 606 | return { |
| 607 | ok: false, |
| 608 | summary: "Build succeeded with critical warnings. Will not proceed", |
| 609 | warnings: warningMessages, |
| 610 | errors: errorMessages, |
| 611 | }; |
| 612 | } |
| 613 | |
| 614 | return { |
| 615 | ok: true, |
| 616 | warnings: warningMessages, |
| 617 | }; |
| 618 | } |
| 619 | |
| 620 | // Try to extract useful error messages from the logs |
| 621 | function checkLogsForErrors(logs: string) { |
no test coverage detected
searching dependent graphs…