Skip to content

Commit 4a2642f

Browse files
fuatguzelBrkYldOzerozeryilm
authored
#BE-6910 Testing Setup (#72)
* Add testing setup * Refactor vitest config, add new test files: AppcircleExitError, ProgramError and writer. * feat(test): setup vitest and refactor for testability * test(services): add unit tests for services layer * test(core): add unit tests for core modules * test(main): add unit tests for main and program logic * test: add remaining unit tests and directory structure * Add unit tests for constants, security, types, and utility functions * test(main): enhance error handling and edge case coverage in main function and program logic * feat(tests): enhance unit tests for various edge cases and error handling * test: remove skipped tests for help, version, and JSON output modes in critical commands * fix(tests): update import paths and type assertions in integration and unit tests * feat(login): refactor login handling with dedicated helper functions for improved readability and organization * test(command-runner): add comprehensive tests for login helper functions and error handling * feat(logout): implement logout helper functions and integrate with command handling * Add unit tests for user prompt helpers and workflow ID parameter handling * refactor(command-runner): modularize command handling and enhance parameter validation with utility functions * refactor(command-runner): integrate utility functions for parameter resolution and validation, enhancing code modularity and readability * feat(command-runner): add comprehensive utility functions for command processing, validation, and error handling to improve modularity and testability * chore(vitest): update test exclusion patterns to improve test coverage by excluding specific utility and type files * refactor(main): extract command processing and error handling logic into utility functions for improved modularity and testability * refactor(program): extract help generation and error handling into utility functions for improved modularity and readability * feat(utilities): introduce utility functions for authentication, build management, file operations, and log processing to enhance modularity and testability * feat(writer): add command-specific writer functions and utility functions for data transformation and logging to enhance modularity and testability * feat(api): extract utility functions for API configuration, headers, and logging to enhance modularity and testability * refactor(writer): consolidate command handling by extracting command-specific writer functions to improve modularity and maintainability * feat(interactive-runner): enhance parameter handling with validation, path expansion, and modular prompt configuration for improved user interaction * feat(test-setup): add spies for console.info and console.table to enhance logging control during tests * feat(tests): add comprehensive unit tests for command runner utilities, enhancing coverage and modularity across various functionalities * fix(test-setup): ensure console methods exist before mocking to prevent errors during tests * 2.7.5-alpha.0 * 2.7.5-alpha.1 * refactor(tests): update E2E tests to use source TypeScript file and improve command execution handling * feat(upload): enhance upload process to update release notes with version ID retrieval * test(release-notes): add unit tests for release notes update feature including long, multiline, and special character handling * feat(publish): enforce required parameters for enterprise app version publishing and update documentation * test(enterprise-utilities): enhance tests for enterprise app version publishing with additional parameters and output validation * 2.7.5-alpha.2 * feat(auth): add token validation before login to handle expired tokens * test(e2e): enhance authentication command tests for invalid tokens and logout scenarios * 2.7.5-alpha.3 * feat: add pr workflow into Jenkinsfile * feat(upload): add enhanced method to retrieve latest app version ID after upload * feat(prompt): add support for simple multiline input for release notes * chore(docs): remove deprecated distribution commands and update migration guide links * 2.7.5-alpha.4 * refactor: change pr validation stage * feat: get tags before publish * refactor: add node version check * test: skip logout command test when not authenticated * feat: downgrade vite * Feature/be 6412 (#76) (#75) * feat(config): add HOOK_HOSTNAME configuration option and update related documentation * feat(command-runner): introduce build execution modes and user prompt for selecting execution mode during build start * feat(build-logs): implement real-time build logs feature with enhanced logging, progress tracking, and file output support * feat: add step summary execution mode and enhance build log processing * feat: validate PAT token format and improve logout command error handling * Add new unit tests * feat: exclude 'src/types/build-logs.ts' from coverage reporting * Add unit tests for command runner functionalities * 2.7.5-alpha.5 * feat: skip tests for handling invalid PAT token and user login status * feat: add execution mode parameter to build command for enhanced monitoring options * feat: enhance execution mode handling by prompting user in interactive mode * feat: skip test for handling login with empty token string * feat: implement execution mode tests and skip specific logout tests in E2E suite * 2.7.5-alpha.6 * refactor: update downloadBuildLogs function calls to use object destructuring for path parameter * fix: set default hook hostname to 'https://hook.appcircle.io' if not provided in environment variables * refactor: update execution mode terminology to 'monitoring preference' for clarity and consistency across documentation and code * refactor: improve duration formatting logic in command runner for better readability and consistency * refactor: enhance step management in command runner to prevent duplicate displays and improve status handling * refactor: rename execution mode to monitor mode and update related documentation and code for improved clarity and consistency * refactor: update console log messages for build log downloads to improve clarity * feat: add build status utilities and enhance artifact download error handling * feat: add verbose mode option to build log rendering for enhanced output control * refactor: enhance log processing and message handling for verbose mode, including improved deduplication and flushing of buffered messages * fix: ensure SSE connection is closed before prompting for log download on build failure * 2.7.5-alpha.7 * refactor: update authentication method from Personal Access Token to Personal Access Key in CLI and documentation * feat: add legacy PAT login support for backward compatibility and update related tests * feat: add hidden property to commands and update error message handling in TerminalRenderer * 2.7.5-alpha.8 * fix: update build monitor and execution mode options to include numbering for improved clarity * 2.7.5-alpha.9 Co-authored-by: Fuat Guzel <39780609+fuatguzel@users.noreply.github.com> * refactor: add fancy icons into jenkinsfile (#74) * refactor: add fancy icons into jenkinsfile * refactor: add fancy icons into jenkinsfile * refactor: add fancy icons into jenkinsfile * refactor: add fancy icons into jenkinsfile * refactor: add . --------- Co-authored-by: Ozer <ozer@Ozers-MacBook-Pro.local> Co-authored-by: Fuat Guzel <fuatguzel754@gmail.com> * refactor: add numbering to build monitoring preference options for clarity in unit tests --------- Co-authored-by: Burak Yıldırım <burak_yildirim_official@hotmail.com> Co-authored-by: Ozer <ozer@Ozers-MacBook-Pro.local> Co-authored-by: ozeryilm <ozer@appcircle.io>
1 parent 0aa9fce commit 4a2642f

141 files changed

Lines changed: 78187 additions & 5721 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Jenkinsfile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,55 @@ pipeline {
44
NPM_AUTH_TOKEN = credentials('Appcircle-CLI-NPM-Cred')
55
}
66
stages {
7+
stage('PR Validation') {
8+
when {
9+
changeRequest()
10+
}
11+
steps {
12+
sh '''#!/bin/bash
13+
# shellcheck shell=bash
14+
set -x
15+
set -euo pipefail
16+
17+
echo "🔨 Starting PR Validation Pipeline 🔨"
18+
echo "=================================="
19+
20+
echo "📦 Installing dependencies.. ."
21+
yarn install
22+
23+
echo "⚙️ Running TypeScript compilation..."
24+
if ! npm run build; then
25+
echo "❌ TypeScript compilation failed! 😢"
26+
exit 1
27+
fi
28+
echo "✅ TypeScript compilation successful! 🎉"
29+
30+
echo "🧪 Running unit tests..."
31+
if ! npm test; then
32+
echo "❌ Unit tests failed! 💔"
33+
exit 1
34+
fi
35+
echo "✅ Unit tests passed! 🌟"
36+
37+
echo "=================================="
38+
echo "🎯 PR validation complete - All checks passed! 🚀"
39+
'''
40+
}
41+
}
742

843
stage('Publish') {
44+
when {
45+
not { changeRequest() }
46+
}
947
steps {
1048
sh '''#!/bin/bash
1149
# shellcheck shell=bash
1250
set -x
1351
set -euo pipefail
52+
53+
node --version
54+
55+
git fetch --tags --force
1456
tag=$(git describe --tags --abbrev=0)
1557
echo "Tag: ${tag}"
1658

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ appcircle <command> <subcommand> ... <subcommand> [options] -o json
9898

9999
- `AUTH_HOSTNAME`: Specifies the host where your IAM (identity access management) server endpoint is located. [See also](#configuring-your-appcircle-cli-environment) for more details.
100100

101+
- `HOOK_HOSTNAME`: Specifies the host where the webhook endpoint is located. [See also](#configuring-your-appcircle-cli-environment) for more details.
102+
101103
## Interactive Mode
102104

103105
Appcircle CLI incorporates a GUI that allows users to interactively access its features. To view all features in interactive mode, execute the following command:
@@ -153,9 +155,9 @@ CURL_LOGGING= appcircle
153155

154156
You can authenticate with Appcircle using either Personal Access Token or API Key:
155157

156-
#### Using Personal Access Token
157-
- [Generate a personal access token from the Appcircle dashboard](https://docs.appcircle.io/appcircle-api/api-authentication#generatingmanaging-the-personal-api-tokens)
158-
- Using the Appcircle CLI, create a full access API token using the following command: `appcircle login pat --token="YOUR PERSONAL ACCESS TOKEN"`.
158+
#### Using Personal Access Key
159+
- [Generate a personal access key from the Appcircle dashboard](https://docs.appcircle.io/appcircle-api/api-authentication#generatingmanaging-the-personal-api-tokens)
160+
- Using the Appcircle CLI, create a full access API token using the following command: `appcircle login personal-access-key --secret="YOUR PERSONAL ACCESS KEY"`.
159161

160162
#### Using API Key
161163
- [Create an API Key from the Appcircle dashboard](https://docs.appcircle.io/appcircle-api/api-authentication#api-keys)

docs/build/start.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ appcircle build start [options]
3232
--download-logs Automatically download build logs after completion
3333
--download-artifacts Automatically download build artifacts after completion
3434
--path <string> Download path for logs and artifacts (default: ~/Downloads)
35+
--monitor <mode> Build monitoring preference: none, summary (default), steps, or verbose
3536
```
3637

3738
## Options inherited from parent commands
@@ -75,6 +76,27 @@ appcircle build start --profileId <uuid> --branch "main" --workflowId <uuid>
7576
- **Optional**: If not provided, uses the first available configuration for the profile
7677
- **Example**: `--configurationId <uuid>` or `--configuration "Debug Configuration"`
7778

79+
### Monitor Mode Selection
80+
The `--monitor` parameter controls how the build process is monitored and displayed:
81+
82+
- **`none`**: No monitoring. Just return Task/Build ID and exit immediately
83+
- **`summary`** (default): Wait until completion, show final status + total duration in one line
84+
- **`steps`**: Wait until completion, show step-by-step progress (started/finished) minimally
85+
- **`verbose`**: Wait until completion, stream detailed logs line by line in real-time
86+
87+
**Real-time Log Features:**
88+
- All monitor modes (except `none`) provide real-time log streaming from the build process
89+
- Logs are displayed as they are generated, providing immediate feedback on build progress
90+
- The system automatically handles log formatting and step transitions for better readability
91+
92+
**Backward Compatibility:**
93+
- The legacy `--execution-mode` parameter is still supported for backward compatibility
94+
- Legacy modes are automatically mapped to new monitor modes:
95+
- `normal``summary`
96+
- `detailed``verbose`
97+
- `step-summary``steps`
98+
- `skip``none`
99+
78100
## Usage Examples
79101

80102
### Basic Usage
@@ -121,6 +143,21 @@ appcircle build start --profileId <uuid> --commitId <uuid> --workflowId <uuid> -
121143
appcircle build start --profile "My Android App" --branchId 6ba7b810-9dad-11d1-80b4-00c04fd430c8 --workflow "Default Push Workflow"
122144
```
123145

146+
#### 9. Build with Different Execution Modes
147+
```bash
148+
# Normal mode (default) - standard monitoring with real-time logs
149+
appcircle build start --profileId <uuid> --commitId <uuid> --workflowId <uuid>
150+
151+
# Verbose mode - enhanced monitoring with detailed progress tracking
152+
appcircle build start --profileId <uuid> --commitId <uuid> --workflowId <uuid> --monitor verbose
153+
154+
# Steps mode - clean table showing only steps and durations
155+
appcircle build start --profileId <uuid> --commitId <uuid> --workflowId <uuid> --monitor steps
156+
157+
# None mode - return task ID immediately without monitoring
158+
appcircle build start --profileId <uuid> --commitId <uuid> --workflowId <uuid> --monitor none
159+
```
160+
124161
## Common Scenarios
125162

126163
### Scenario 1: Build Latest Commit from Branch
@@ -147,6 +184,15 @@ appcircle build start --profileId <uuid> --commitId <uuid> --workflowId <uuid> -
147184
appcircle build start --profileId <uuid> --commitId <uuid> --workflowId <uuid> --download-logs --download-artifacts
148185
```
149186

187+
### Scenario 5: Real-time Build Monitoring
188+
```bash
189+
# For development - watch build progress in real-time with detailed logs
190+
appcircle build start --profileId <uuid> --commitId <uuid> --workflowId <uuid> --monitor verbose
191+
192+
# For CI/CD - get clean step summary without verbose logs
193+
appcircle build start --profileId <uuid> --commitId <uuid> --workflowId <uuid> --monitor steps
194+
```
195+
150196
## Notes
151197

152198
- **Commit vs Branch**: When you provide `--commitId`, the system doesn't need branch information since the commit is already specified. When you provide `--branchId`, the system automatically uses the latest commit from that branch.
@@ -157,6 +203,12 @@ appcircle build start --profileId <uuid> --commitId <uuid> --workflowId <uuid> -
157203

158204
- **Auto Download**: The `--download-logs` and `--download-artifacts` parameters automatically download files after build completion. Use `--path` to specify a custom download location.
159205

206+
- **Monitoring Preferences**: The `--monitor` parameter allows you to control how build progress is displayed. The default `summary` mode provides real-time build status and duration, while `verbose` mode offers full verbose log streaming, `steps` shows step-by-step progress, and `none` returns only the task ID.
207+
208+
- **Real-time Logs**: All monitor modes (except `none`) provide real-time log streaming, allowing you to monitor build progress as it happens. The system automatically formats logs and handles step transitions for better readability.
209+
210+
- **Backward Compatibility**: The legacy `--execution-mode` parameter is still supported and automatically maps to the new monitor modes for seamless migration.
211+
160212
## Learn More
161213

162214
- Use `appcircle build profile list` to get available profiles with their UUIDs and names

docs/config/get.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ appcircle config get <key>
1010
```plaintext
1111
$ appcircle config get API_HOSTNAME
1212
$ appcircle config get AUTH_HOSTNAME
13+
$ appcircle config get HOOK_HOSTNAME
1314
$ appcircle config get AC_ACCESS_TOKEN
1415
```
1516

1617
## Arguments
1718

1819
| Argument | Description |
1920
| --------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
20-
| `key` | Config key [API_HOSTNAME, AUTH_HOSTNAME, AC_ACCESS_TOKEN]
21+
| `key` | Config key [API_HOSTNAME, AUTH_HOSTNAME, HOOK_HOSTNAME, AC_ACCESS_TOKEN]
2122

2223
## Options inherited from parent commands
2324

docs/config/set.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ appcircle config set <key> <value>
99

1010
```plaintext
1111
$ appcircle config set AUTH_HOSTNAME https://auth.example.com
12+
$ appcircle config set HOOK_HOSTNAME https://hook.example.com
1213
```
1314

1415
## Arguments
1516

1617
| Argument | Description |
1718
| --------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
18-
| `key` | Config key [API_HOSTNAME, AUTH_HOSTNAME, AC_ACCESS_TOKEN] |
19+
| `key` | Config key [API_HOSTNAME, AUTH_HOSTNAME, HOOK_HOSTNAME, AC_ACCESS_TOKEN] |
1920
`value` | Config value
2021

2122
## Options inherited from parent commands

docs/distribution/index.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

docs/distribution/profile/create.md

Lines changed: 0 additions & 20 deletions
This file was deleted.

docs/distribution/profile/index.md

Lines changed: 0 additions & 20 deletions
This file was deleted.

docs/distribution/profile/list.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

docs/distribution/upload.md

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)