Feature: Add test step to CI workflow.#3459
Conversation
|
/cc @matejvasek @lkingland @gauron99 Next one is ready for review! 😸 👍 |
700184d to
b04f22b
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3459 +/- ##
==========================================
- Coverage 54.71% 54.71% -0.01%
==========================================
Files 181 181
Lines 20394 20427 +33
==========================================
+ Hits 11158 11176 +18
- Misses 8059 8075 +16
+ Partials 1177 1176 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
gauron99
left a comment
There was a problem hiding this comment.
nice! just few questions from me
cmd/ci/workflow.go
Outdated
| case "go": | ||
| testStep.withRun("go test ./...") | ||
| case "node": | ||
| testStep.withRun("npm test") |
There was a problem hiding this comment.
Don't we need to call npm install first?
cmd/ci/workflow.go
Outdated
| case "node": | ||
| testStep.withRun("npm test") | ||
| case "python": | ||
| testStep.withRun("python -m pytest") |
There was a problem hiding this comment.
Don't we need to call pip instal… first?
b04f22b to
93278b3
Compare
|
/lgtm |
lkingland
left a comment
There was a problem hiding this comment.
Solid work, very clean!
/lgtm
/approve
/hold for anyone else that might want to chime in more
cmd/config_ci_test.go
Outdated
| { | ||
| name: "nodejs runtime adds npm test step", | ||
| runtime: "node", | ||
| expectedRun: "npm i && npm test", |
There was a problem hiding this comment.
I seem to remember something about an npm ci command specific for this use-case?
There was a problem hiding this comment.
Oh yes of course! 🙈
Updated it!
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gauron99, lkingland, twoGiants The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
93278b3 to
910e14a
Compare
|
Doc |
Running |
The command (and therefore docs gen) is behind feature flag diff --git a/docs/reference/func_config_ci.md b/docs/reference/func_config_ci.md
index 1c87a5fbd..74cfd1748 100644
--- a/docs/reference/func_config_ci.md
+++ b/docs/reference/func_config_ci.md
@@ -9,17 +9,21 @@ func config ci
### Options
```
- --branch string Use a custom branch name in the workflow (default "main")
+ --branch string Use a custom branch name in the workflow
+ --force Use to overwrite an existing GitHub workflow
-h, --help help for ci
--kubeconfig-secret-name string Use a custom secret name in the workflow, e.g. secret.YOUR_CUSTOM_KUBECONFIG (default "KUBECONFIG")
-p, --path string Path to the function. Default is current directory ($FUNC_PATH)
+ --platform string Pick a CI/CD platform for which a manifest will be generated. Currently only GitHub is supported. (default "github")
+ --registry-login Add a registry login step in the github workflow (default true)
--registry-login-url-variable-name string Use a custom registry login url variable name in the workflow, e.g. vars.YOUR_REGISTRY_LOGIN_URL (default "REGISTRY_LOGIN_URL")
--registry-pass-secret-name string Use a custom registry pass secret name in the workflow, e.g. secret.YOUR_REGISTRY_PASSWORD (default "REGISTRY_PASSWORD")
--registry-url-variable-name string Use a custom registry url variable name in the workflow, e.g. vars.YOUR_REGISTRY_URL (default "REGISTRY_URL")
--registry-user-variable-name string Use a custom registry user variable name in the workflow, e.g. vars.YOUR_REGISTRY_USER (default "REGISTRY_USERNAME")
--remote Build the function on a Tekton-enabled cluster
--self-hosted-runner Use a 'self-hosted' runner instead of the default 'ubuntu-latest' for local runner execution
- --use-registry-login Add a registry login step in the github workflow (default true)
+ --test-step Add a language-specific test step (supported: go, node, python) (default true)
+ -v, --verbose Print verbose logs ($FUNC_VERBOSE)
--workflow-name string Use a custom workflow name (default "Func Deploy")
```
|
910e14a to
b82164a
Compare
|
/lgtm |
The generated GitHub workflow now includes a "Run tests" step that runs before deployment. The test command is selected based on the function runtime: `go test ./...` for Go, `npm ci && npm test` for Node.js and Typescript, for Python `pip install . && python -m pytest` and `./mvnw test` for Quarkus. Unsupported runtimes skip the step with a warning. The step can be disabled via --test-step=false. Issue 3256 Signed-off-by: Stanislav Jakuschevskij <sjakusch@redhat.com>
b82164a to
2ed8b2b
Compare
|
New changes are detected. LGTM label has been removed. |
Changes
--test-stepflag tofunc config ci, enabled by default, disable with--test-step=falsego test ./...for Go,npm testfor Node.js,python -m pytestfor Python/kind enhancement
Relates to #3256
Release Note
Docs