Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
JavaReleaseMenu
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
朱鹏程
JavaReleaseMenu
Commits
cd3a975e
Commit
cd3a975e
authored
Nov 18, 2026
by
zpc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore inline selectors and compact release logs; allow closing idle panes
parent
12947a88
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
283 additions
and
187 deletions
+283
-187
Info.plist
Info.plist
+2
-2
SplitReleaseModel.swift
Sources/JavaReleaseMenu/SplitReleaseModel.swift
+14
-7
SplitReleasePanel.swift
Sources/JavaReleaseMenu/SplitReleasePanel.swift
+203
-178
ReleaseRunnerTests.swift
Tests/ReleaseCoreTests/ReleaseRunnerTests.swift
+64
-0
No files found.
Info.plist
View file @
cd3a975e
...
@@ -19,9 +19,9 @@
...
@@ -19,9 +19,9 @@
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
string
>
APPL
<
/string
>
<
string
>
APPL
<
/string
>
<
k
e
y
>
CFBundleShortVersionString
<
/k
e
y
>
<
k
e
y
>
CFBundleShortVersionString
<
/k
e
y
>
<
string
>
1.4.
0
<
/string
>
<
string
>
1.4.
1
<
/string
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
<
string
>
1
0
<
/string
>
<
string
>
1
1
<
/string
>
<
k
e
y
>
LSMinimumSystemVersion
<
/k
e
y
>
<
k
e
y
>
LSMinimumSystemVersion
<
/k
e
y
>
<
string
>
14.0
<
/string
>
<
string
>
14.0
<
/string
>
<
k
e
y
>
LSUIElement
<
/k
e
y
>
<
k
e
y
>
LSUIElement
<
/k
e
y
>
...
...
Sources/JavaReleaseMenu/SplitReleaseModel.swift
View file @
cd3a975e
...
@@ -18,6 +18,9 @@ private struct SavedPane: Codable {
...
@@ -18,6 +18,9 @@ private struct SavedPane: Codable {
@Observable
@Observable
final
class
ReleasePaneState
:
Identifiable
{
final
class
ReleasePaneState
:
Identifiable
{
enum
State
:
String
{
case
idle
,
queued
,
running
,
finished
,
skipped
}
enum
State
:
String
{
case
idle
,
queued
,
running
,
finished
,
skipped
}
enum
ConfigurationField
{
case
project
,
configuration
,
server
,
module
}
var
expandedField
:
ConfigurationField
?
var
expandedConsole
=
false
let
id
:
UUID
let
id
:
UUID
var
projectID
:
UUID
var
projectID
:
UUID
...
@@ -136,6 +139,7 @@ final class SplitReleaseModel {
...
@@ -136,6 +139,7 @@ final class SplitReleaseModel {
private
var
batch
=
false
private
var
batch
=
false
private
var
unread
=
false
private
var
unread
=
false
private
var
runIDs
=
Set
<
UUID
>
()
private
var
runIDs
=
Set
<
UUID
>
()
private
var
runResults
:
[
UUID
:
ReleaseResult
]
=
[:]
private
var
batchStarted
:
Date
?
private
var
batchStarted
:
Date
?
private
var
completionTask
:
Task
<
Void
,
Never
>
?
private
var
completionTask
:
Task
<
Void
,
Never
>
?
private(set)
var
completionDuration
:
Int
?
private(set)
var
completionDuration
:
Int
?
...
@@ -181,18 +185,18 @@ final class SplitReleaseModel {
...
@@ -181,18 +185,18 @@ final class SplitReleaseModel {
var
current
:
ReleasePaneState
?
{
panes
.
first
{
$0
.
state
==
.
running
}
}
var
current
:
ReleasePaneState
?
{
panes
.
first
{
$0
.
state
==
.
running
}
}
var
progressPercentage
:
Int
?
{
var
progressPercentage
:
Int
?
{
let
active
=
panes
.
filter
{
runIDs
.
contains
(
$0
.
id
)
}
let
active
=
panes
.
filter
{
runIDs
.
contains
(
$0
.
id
)
}
guard
isRunning
,
!
active
.
isEmpty
else
{
return
nil
}
guard
isRunning
,
!
runIDs
.
isEmpty
else
{
return
nil
}
let
completed
=
active
.
filter
{
$0
.
state
==
.
finished
}
.
count
let
completed
=
runResults
.
count
let
partial
=
active
.
filter
{
$0
.
state
==
.
running
}
.
reduce
(
0
)
{
let
partial
=
active
.
filter
{
$0
.
state
==
.
running
}
.
reduce
(
0
)
{
$0
+
(
$1
.
phase
?
.
estimatedPercentage
??
0
)
$0
+
(
$1
.
phase
?
.
estimatedPercentage
??
0
)
}
}
return
min
(
99
,
(
completed
*
100
+
partial
)
/
active
.
count
)
return
min
(
99
,
(
completed
*
100
+
partial
)
/
runIDs
.
count
)
}
}
var
indicator
:
ReleaseStatus
?
{
var
indicator
:
ReleaseStatus
?
{
if
isRunning
{
return
nil
}
if
isRunning
{
return
nil
}
if
completionTask
!=
nil
{
return
.
succeeded
}
if
completionTask
!=
nil
{
return
.
succeeded
}
if
unread
{
if
unread
{
return
panes
.
filter
{
runIDs
.
contains
(
$0
.
id
)
}
.
compactMap
(\
.
result
)
.
first
(
where
:
{
return
runResults
.
values
.
first
(
where
:
{
$0
.
status
!=
.
succeeded
$0
.
status
!=
.
succeeded
})?
.
status
})?
.
status
}
}
...
@@ -227,7 +231,7 @@ final class SplitReleaseModel {
...
@@ -227,7 +231,7 @@ final class SplitReleaseModel {
}
}
func
remove
(
_
pane
:
ReleasePaneState
)
{
func
remove
(
_
pane
:
ReleasePaneState
)
{
guard
!
isRunning
else
{
return
}
guard
pane
.
state
!=
.
running
&&
pane
.
state
!=
.
queued
else
{
return
}
pane
.
inventoryTask
?
.
cancel
()
pane
.
inventoryTask
?
.
cancel
()
panes
.
removeAll
{
$0
.
id
==
pane
.
id
}
panes
.
removeAll
{
$0
.
id
==
pane
.
id
}
save
()
save
()
...
@@ -320,6 +324,7 @@ final class SplitReleaseModel {
...
@@ -320,6 +324,7 @@ final class SplitReleaseModel {
batch
=
together
batch
=
together
batchStarted
=
Date
()
batchStarted
=
Date
()
runIDs
=
Set
(
prepared
.
map
{
$0
.
pane
.
id
})
runIDs
=
Set
(
prepared
.
map
{
$0
.
pane
.
id
})
runResults
.
removeAll
()
if
together
,
prepared
.
count
>
1
{
if
together
,
prepared
.
count
>
1
{
let
cityJobs
=
prepared
.
filter
{
let
cityJobs
=
prepared
.
filter
{
$0
.
project
.
type
==
.
cityKeeper
&&
$0
.
action
==
.
standard
$0
.
project
.
type
==
.
cityKeeper
&&
$0
.
action
==
.
standard
...
@@ -336,6 +341,8 @@ final class SplitReleaseModel {
...
@@ -336,6 +341,8 @@ final class SplitReleaseModel {
}
}
for
job
in
prepared
{
for
job
in
prepared
{
let
pane
=
job
.
pane
let
pane
=
job
.
pane
pane
.
expandedField
=
nil
pane
.
expandedConsole
=
false
pane
.
consoleDismissed
=
false
pane
.
consoleDismissed
=
false
pane
.
viewingLog
=
false
pane
.
viewingLog
=
false
pane
.
state
=
.
queued
pane
.
state
=
.
queued
...
@@ -408,6 +415,7 @@ final class SplitReleaseModel {
...
@@ -408,6 +415,7 @@ final class SplitReleaseModel {
pane
.
log
=
control
.
liveOutput
()
pane
.
log
=
control
.
liveOutput
()
pane
.
control
=
nil
pane
.
control
=
nil
pane
.
result
=
result
pane
.
result
=
result
runResults
[
pane
.
id
]
=
result
pane
.
state
=
.
finished
pane
.
state
=
.
finished
pane
.
phase
=
nil
pane
.
phase
=
nil
pane
.
paused
=
false
pane
.
paused
=
false
...
@@ -426,9 +434,8 @@ final class SplitReleaseModel {
...
@@ -426,9 +434,8 @@ final class SplitReleaseModel {
startAvailable
()
startAvailable
()
}
else
{
}
else
{
unread
=
job
.
action
!=
.
preflight
unread
=
job
.
action
!=
.
preflight
let
finished
=
panes
.
filter
{
runIDs
.
contains
(
$0
.
id
)
}
if
job
.
action
!=
.
preflight
,
if
job
.
action
!=
.
preflight
,
finished
.
allSatisfy
({
$0
.
result
?
.
status
==
.
succeeded
})
runIDs
.
allSatisfy
({
runResults
[
$0
]
?
.
status
==
.
succeeded
})
{
{
let
duration
=
Int
(
batchStarted
?
.
distance
(
to
:
Date
())
??
0
)
let
duration
=
Int
(
batchStarted
?
.
distance
(
to
:
Date
())
??
0
)
showCompletion
(
duration
:
duration
)
showCompletion
(
duration
:
duration
)
...
...
Sources/JavaReleaseMenu/SplitReleasePanel.swift
View file @
cd3a975e
...
@@ -27,23 +27,50 @@ struct SplitReleasePanel: View {
...
@@ -27,23 +27,50 @@ struct SplitReleasePanel: View {
}
}
private
var
columnHeight
:
CGFloat
{
private
var
columnHeight
:
CGFloat
{
let
desired
:
CGFloat
=
let
base
:
CGFloat
=
model
.
panes
.
count
==
1
?
460
:
500
model
.
panes
.
contains
(
where
:
\
.
showsConsole
)
?
650
:
(
model
.
panes
.
count
==
1
?
440
:
490
)
let
desired
=
model
.
panes
.
map
{
pane
->
CGFloat
in
if
pane
.
showsConsole
{
return
pane
.
expandedConsole
?
650
:
base
}
guard
let
field
=
pane
.
expandedField
else
{
return
base
}
let
extra
:
CGFloat
switch
field
{
case
.
project
:
extra
=
min
(
150
,
CGFloat
(
model
.
settings
.
projects
.
count
)
*
34
+
8
)
+
8
case
.
configuration
:
let
project
=
model
.
project
(
for
:
pane
)
let
count
=
((
try
?
project
?
.
configurationFiles
())
??
project
?
.
profiles
.
map
(\
.
file
)
??
[])
.
count
extra
=
min
(
160
,
CGFloat
(
count
)
*
46
+
8
)
+
50
case
.
server
:
extra
=
max
(
52
,
min
(
170
,
CGFloat
(
pane
.
servers
.
count
)
*
38
+
8
))
+
8
case
.
module
:
extra
=
max
(
44
,
min
(
220
,
CGFloat
(
pane
.
availableModules
.
count
)
*
31
+
8
))
+
44
}
return
min
(
650
,
base
+
extra
)
}
.
max
()
??
base
return
min
(
desired
,
max
(
380
,
(
NSScreen
.
main
?
.
visibleFrame
.
height
??
900
)
-
160
))
return
min
(
desired
,
max
(
380
,
(
NSScreen
.
main
?
.
visibleFrame
.
height
??
900
)
-
160
))
}
}
var
body
:
some
View
{
var
body
:
some
View
{
VStack
(
spacing
:
0
)
{
VStack
(
spacing
:
0
)
{
HStack
(
spacing
:
12
)
{
HStack
(
spacing
:
12
)
{
if
model
.
isRunning
{
ZStack
{
ZStack
{
Circle
()
.
stroke
(
ReleaseColors
.
blue
.
opacity
(
0.25
),
lineWidth
:
3
)
Circle
()
.
stroke
(
ReleaseColors
.
blue
.
opacity
(
0.25
),
lineWidth
:
3
)
Circle
()
.
trim
(
from
:
0
,
to
:
0.76
)
Circle
()
.
trim
(
from
:
0
,
to
:
0.76
)
.
stroke
(
.
stroke
(
ReleaseColors
.
blue
,
style
:
StrokeStyle
(
lineWidth
:
3
,
lineCap
:
.
round
)
ReleaseColors
.
blue
,
style
:
StrokeStyle
(
lineWidth
:
3
,
lineCap
:
.
round
)
)
)
.
rotationEffect
(
.
degrees
(
-
90
))
.
rotationEffect
(
.
degrees
(
-
90
))
}
}
.
frame
(
width
:
32
,
height
:
32
)
.
frame
(
width
:
32
,
height
:
32
)
}
else
{
Image
(
systemName
:
"shippingbox"
)
.
font
(
.
system
(
size
:
26
))
.
foregroundStyle
(
.
white
.
opacity
(
0.9
))
.
frame
(
width
:
32
,
height
:
32
)
}
Text
(
"Java 发布"
)
.
font
(
.
system
(
size
:
23
,
weight
:
.
semibold
))
Text
(
"Java 发布"
)
.
font
(
.
system
(
size
:
23
,
weight
:
.
semibold
))
Spacer
()
Spacer
()
Button
(
action
:
model
.
add
)
{
Button
(
action
:
model
.
add
)
{
...
@@ -155,10 +182,6 @@ private struct ProjectReleaseColumn: View {
...
@@ -155,10 +182,6 @@ private struct ProjectReleaseColumn: View {
@Bindable
var
pane
:
ReleasePaneState
@Bindable
var
pane
:
ReleasePaneState
let
height
:
CGFloat
let
height
:
CGFloat
@State
private
var
configurationDraft
:
DeployProfile
?
@State
private
var
configurationDraft
:
DeployProfile
?
@State
private
var
showsModules
=
false
@State
private
var
showsConfiguration
=
false
@State
private
var
showsProjects
=
false
@State
private
var
showsServers
=
false
@FocusState
private
var
moduleSearchFocused
:
Bool
@FocusState
private
var
moduleSearchFocused
:
Bool
private
var
project
:
ReleaseProject
?
{
model
.
project
(
for
:
pane
)
}
private
var
project
:
ReleaseProject
?
{
model
.
project
(
for
:
pane
)
}
...
@@ -187,7 +210,7 @@ private struct ProjectReleaseColumn: View {
...
@@ -187,7 +210,7 @@ private struct ProjectReleaseColumn: View {
.
padding
(
6
)
.
padding
(
6
)
}
}
.
buttonStyle
(
ReleaseButtonStyle
())
.
buttonStyle
(
ReleaseButtonStyle
())
.
disabled
(
!
editable
)
.
disabled
(
pane
.
state
==
.
running
||
pane
.
state
==
.
queued
)
}
}
}
}
if
pane
.
showsConsole
{
if
pane
.
showsConsole
{
...
@@ -200,68 +223,27 @@ private struct ProjectReleaseColumn: View {
...
@@ -200,68 +223,27 @@ private struct ProjectReleaseColumn: View {
.
frame
(
height
:
height
)
.
frame
(
height
:
height
)
.
background
(
pane
.
state
==
.
running
?
ReleaseColors
.
blue
.
opacity
(
0.09
)
:
.
clear
)
.
background
(
pane
.
state
==
.
running
?
ReleaseColors
.
blue
.
opacity
(
0.09
)
:
.
clear
)
.
font
(
ReleaseTypography
.
body
)
.
font
(
ReleaseTypography
.
body
)
.
popover
(
item
:
$
configurationDraft
)
{
draft
in
ConfigurationEditor
(
profile
:
draft
)
{
updated
in
saveProfile
(
updated
)
configurationDraft
=
nil
}
}
}
}
private
var
configuration
:
some
View
{
private
var
configuration
:
some
View
{
ScrollView
(
.
vertical
)
{
VStack
(
alignment
:
.
leading
,
spacing
:
16
)
{
VStack
(
alignment
:
.
leading
,
spacing
:
16
)
{
VStack
(
spacing
:
0
)
{
VStack
(
spacing
:
0
)
{
formRow
(
"项目"
,
symbol
:
"folder"
,
value
:
project
?
.
name
??
"选择项目"
)
{
formRow
(
.
project
,
"项目"
,
symbol
:
"folder"
,
value
:
project
?
.
name
??
"选择项目"
)
showsProjects
=
true
if
pane
.
expandedField
==
.
project
{
projectChoices
}
}
.
popover
(
isPresented
:
$
showsProjects
)
{
VStack
(
alignment
:
.
leading
,
spacing
:
12
)
{
Text
(
"选择项目"
)
.
font
(
.
headline
)
ForEach
(
model
.
settings
.
projects
.
filter
{
candidate
in
!
model
.
panes
.
contains
{
$0
.
id
!=
pane
.
id
&&
$0
.
projectID
==
candidate
.
id
}
}
)
{
candidate
in
Button
(
candidate
.
name
)
{
showsProjects
=
false
model
.
replace
(
pane
,
with
:
candidate
)
}
.
buttonStyle
(
ReleaseButtonStyle
())
}
}
.
padding
(
18
)
.
frame
(
minWidth
:
240
,
alignment
:
.
leading
)
.
environment
(\
.
colorScheme
,
.
dark
)
}
if
project
?
.
type
==
.
cityKeeper
{
if
project
?
.
type
==
.
cityKeeper
{
rowDivider
rowDivider
formRow
(
"发布配置"
,
symbol
:
"doc.text"
,
value
:
profile
?
.
title
??
"选择配置"
)
{
formRow
(
showsConfiguration
=
true
.
configuration
,
"发布配置"
,
symbol
:
"doc.text"
,
}
value
:
profile
?
.
title
??
"选择配置"
)
.
popover
(
isPresented
:
$
showsConfiguration
)
{
configurationControl
s
}
if
pane
.
expandedField
==
.
configuration
{
configurationChoice
s
}
rowDivider
rowDivider
formRow
(
"服务器"
,
symbol
:
"server.rack"
,
value
:
serverTitle
)
{
formRow
(
.
server
,
"服务器"
,
symbol
:
"server.rack"
,
value
:
serverTitle
)
showsServers
=
true
if
pane
.
expandedField
==
.
server
{
serverChoices
}
}
.
popover
(
isPresented
:
$
showsServers
)
{
ScrollView
{
VStack
(
alignment
:
.
leading
,
spacing
:
12
)
{
Text
(
"选择服务器"
)
.
font
(
.
headline
)
ForEach
(
pane
.
servers
,
id
:
\
.
name
)
{
target
in
Button
(
target
.
displayName
)
{
pane
.
server
=
target
.
name
model
.
save
()
showsServers
=
false
}
.
buttonStyle
(
ReleaseButtonStyle
())
}
if
pane
.
servers
.
isEmpty
{
Text
(
"未读取到服务器,请检查项目设置中的 hosts 文件。"
)
}
}
.
padding
(
18
)
}
.
frame
(
width
:
310
,
height
:
240
)
.
environment
(\
.
colorScheme
,
.
dark
)
}
}
}
rowDivider
rowDivider
formRow
(
"模块"
,
symbol
:
"square.stack"
,
value
:
moduleTitle
)
{
showsModules
=
true
}
formRow
(
.
module
,
"模块"
,
symbol
:
"square.stack"
,
value
:
moduleTitle
)
.
popover
(
isPresented
:
$
showsModules
)
{
modulePicker
}
if
pane
.
expandedField
==
.
module
{
modulePicker
}
if
project
?
.
type
==
.
cityKeeper
{
if
project
?
.
type
==
.
cityKeeper
{
rowDivider
rowDivider
HStack
(
spacing
:
12
)
{
HStack
(
spacing
:
12
)
{
...
@@ -279,7 +261,11 @@ private struct ProjectReleaseColumn: View {
...
@@ -279,7 +261,11 @@ private struct ProjectReleaseColumn: View {
}
}
}
}
.
background
(
ReleaseColors
.
surface
,
in
:
RoundedRectangle
(
cornerRadius
:
14
))
.
background
(
ReleaseColors
.
surface
,
in
:
RoundedRectangle
(
cornerRadius
:
14
))
.
overlay
{
RoundedRectangle
(
cornerRadius
:
14
)
.
strokeBorder
(
Color
.
white
.
opacity
(
0.13
))
}
.
clipShape
(
RoundedRectangle
(
cornerRadius
:
14
))
.
overlay
{
RoundedRectangle
(
cornerRadius
:
14
)
.
strokeBorder
(
Color
.
white
.
opacity
(
0.13
))
.
allowsHitTesting
(
false
)
}
.
disabled
(
!
editable
)
.
disabled
(
!
editable
)
if
project
?
.
type
==
.
cityKeeper
{
if
project
?
.
type
==
.
cityKeeper
{
...
@@ -287,6 +273,16 @@ private struct ProjectReleaseColumn: View {
...
@@ -287,6 +273,16 @@ private struct ProjectReleaseColumn: View {
.
toggleStyle
(
.
checkbox
)
.
disabled
(
!
editable
)
.
toggleStyle
(
.
checkbox
)
.
disabled
(
!
editable
)
.
onChange
(
of
:
pane
.
useVPC
)
{
model
.
save
()
}
.
onChange
(
of
:
pane
.
useVPC
)
{
model
.
save
()
}
}
}
if
let
project
,
project
.
supportsVerifiedRelease
(
profile
)
{
HStack
{
Toggle
(
"验证发布"
,
isOn
:
$
pane
.
verified
)
.
toggleStyle
(
.
checkbox
)
.
onChange
(
of
:
pane
.
verified
)
{
model
.
save
()
}
Spacer
()
Button
(
"预检"
)
{
model
.
publish
(
pane
,
action
:
.
preflight
)
}
.
buttonStyle
(
ReleaseButtonStyle
())
.
disabled
(
pane
.
modules
.
isEmpty
)
}
.
disabled
(
!
editable
)
}
publishButton
(
title
:
"发布
\(
pane
.
selectedCount
)
个模块"
)
publishButton
(
title
:
"发布
\(
pane
.
selectedCount
)
个模块"
)
if
let
message
=
pane
.
error
{
if
let
message
=
pane
.
error
{
Text
(
message
)
.
font
(
.
caption
)
.
foregroundStyle
(
.
red
)
.
lineLimit
(
3
)
Text
(
message
)
.
font
(
.
caption
)
.
foregroundStyle
(
.
red
)
.
lineLimit
(
3
)
...
@@ -313,7 +309,7 @@ private struct ProjectReleaseColumn: View {
...
@@ -313,7 +309,7 @@ private struct ProjectReleaseColumn: View {
Text
(
"选择模块后即可发布"
)
.
font
(
ReleaseTypography
.
detail
)
.
foregroundStyle
(
Text
(
"选择模块后即可发布"
)
.
font
(
ReleaseTypography
.
detail
)
.
foregroundStyle
(
ReleaseColors
.
muted
)
ReleaseColors
.
muted
)
}
}
Spacer
(
minLength
:
0
)
}
.
padding
(
.
bottom
,
4
)
}
}
}
}
...
@@ -328,19 +324,26 @@ private struct ProjectReleaseColumn: View {
...
@@ -328,19 +324,26 @@ private struct ProjectReleaseColumn: View {
Rectangle
()
.
fill
(
Color
.
white
.
opacity
(
0.12
))
.
frame
(
height
:
1
)
.
padding
(
.
horizontal
,
14
)
Rectangle
()
.
fill
(
Color
.
white
.
opacity
(
0.12
))
.
frame
(
height
:
1
)
.
padding
(
.
horizontal
,
14
)
}
}
private
func
formRow
(
private
func
formRow
(
_
label
:
String
,
symbol
:
String
,
value
:
String
,
action
:
@escaping
()
->
Void
_
field
:
ReleasePaneState
.
ConfigurationField
,
_
label
:
String
,
symbol
:
String
,
value
:
String
)
->
some
View
{
)
->
some
View
{
Button
(
action
:
action
)
{
Button
{
configurationDraft
=
nil
pane
.
expandedField
=
pane
.
expandedField
==
field
?
nil
:
field
}
label
:
{
HStack
(
spacing
:
12
)
{
HStack
(
spacing
:
12
)
{
Image
(
systemName
:
symbol
)
.
foregroundStyle
(
ReleaseColors
.
muted
)
.
frame
(
width
:
20
)
Image
(
systemName
:
symbol
)
.
foregroundStyle
(
ReleaseColors
.
muted
)
.
frame
(
width
:
20
)
Text
(
label
)
.
foregroundStyle
(
ReleaseColors
.
muted
)
.
frame
(
Text
(
label
)
.
foregroundStyle
(
ReleaseColors
.
muted
)
.
frame
(
width
:
66
,
alignment
:
.
leading
)
width
:
66
,
alignment
:
.
leading
)
Text
(
value
)
.
foregroundStyle
(
.
white
.
opacity
(
0.9
))
.
lineLimit
(
1
)
.
truncationMode
(
.
tail
)
Text
(
value
)
.
foregroundStyle
(
.
white
.
opacity
(
0.9
))
.
lineLimit
(
1
)
.
truncationMode
(
.
tail
)
.
frame
(
maxWidth
:
.
infinity
,
alignment
:
.
leading
)
.
frame
(
maxWidth
:
.
infinity
,
alignment
:
.
leading
)
Image
(
systemName
:
"chevron.down"
)
.
font
(
.
system
(
size
:
11
))
.
foregroundStyle
(
Image
(
systemName
:
pane
.
expandedField
==
field
?
"chevron.up"
:
"chevron.down"
)
.
font
(
.
system
(
size
:
11
)
)
.
foregroundStyle
(
ReleaseColors
.
muted
)
ReleaseColors
.
muted
)
}
.
padding
(
.
horizontal
,
14
)
.
frame
(
height
:
50
)
.
contentShape
(
Rectangle
())
}
.
padding
(
.
horizontal
,
14
)
.
frame
(
height
:
50
)
.
contentShape
(
Rectangle
())
}
.
buttonStyle
(
ReleaseButtonStyle
())
}
.
buttonStyle
(
ReleaseButtonStyle
(
radius
:
0
))
.
accessibilityLabel
(
label
)
.
accessibilityValue
(
value
)
}
}
private
func
publishButton
(
title
:
String
)
->
some
View
{
private
func
publishButton
(
title
:
String
)
->
some
View
{
Button
{
Button
{
...
@@ -373,6 +376,15 @@ private struct ProjectReleaseColumn: View {
...
@@ -373,6 +376,15 @@ private struct ProjectReleaseColumn: View {
Text
(
"实时输出 ·
\(
paneTitle
)
"
)
.
font
(
.
system
(
size
:
13
,
weight
:
.
medium
))
.
lineLimit
(
Text
(
"实时输出 ·
\(
paneTitle
)
"
)
.
font
(
.
system
(
size
:
13
,
weight
:
.
medium
))
.
lineLimit
(
1
)
1
)
Spacer
(
minLength
:
4
)
Spacer
(
minLength
:
4
)
Button
{
pane
.
expandedConsole
.
toggle
()
}
label
:
{
Image
(
systemName
:
pane
.
expandedConsole
?
"arrow.down.right.and.arrow.up.left"
:
"arrow.up.left.and.arrow.down.right"
)
}
.
help
(
pane
.
expandedConsole
?
"收起日志"
:
"展开日志"
)
if
pane
.
state
==
.
running
{
if
pane
.
state
==
.
running
{
Button
(
pane
.
paused
?
"继续"
:
"暂停"
)
{
model
.
togglePause
(
pane
)
}
.
disabled
(
Button
(
pane
.
paused
?
"继续"
:
"暂停"
)
{
model
.
togglePause
(
pane
)
}
.
disabled
(
pane
.
stopping
)
pane
.
stopping
)
...
@@ -410,12 +422,6 @@ private struct ProjectReleaseColumn: View {
...
@@ -410,12 +422,6 @@ private struct ProjectReleaseColumn: View {
private
var
modulePicker
:
some
View
{
private
var
modulePicker
:
some
View
{
VStack
(
alignment
:
.
leading
,
spacing
:
10
)
{
VStack
(
alignment
:
.
leading
,
spacing
:
10
)
{
HStack
{
Text
(
"选择模块"
)
.
font
(
.
headline
)
Spacer
()
Button
(
"完成"
)
{
showsModules
=
false
}
}
TextField
(
"输入模块名搜索…"
,
text
:
$
pane
.
search
)
TextField
(
"输入模块名搜索…"
,
text
:
$
pane
.
search
)
.
textFieldStyle
(
.
roundedBorder
)
.
textFieldStyle
(
.
roundedBorder
)
.
focused
(
$
moduleSearchFocused
)
.
focused
(
$
moduleSearchFocused
)
...
@@ -457,9 +463,7 @@ private struct ProjectReleaseColumn: View {
...
@@ -457,9 +463,7 @@ private struct ProjectReleaseColumn: View {
ReleaseColors
.
terminal
,
in
:
RoundedRectangle
(
cornerRadius
:
7
))
ReleaseColors
.
terminal
,
in
:
RoundedRectangle
(
cornerRadius
:
7
))
}
}
.
padding
(
12
)
.
padding
([
.
horizontal
,
.
bottom
],
8
)
.
frame
(
width
:
310
)
.
environment
(\
.
colorScheme
,
.
dark
)
}
}
private
var
configurationSummary
:
String
{
private
var
configurationSummary
:
String
{
...
@@ -469,85 +473,142 @@ private struct ProjectReleaseColumn: View {
...
@@ -469,85 +473,142 @@ private struct ProjectReleaseColumn: View {
return
"
\(
configuration
)
·
\(
destination
)
·
\(
pane
.
selectedCount
)
个模块"
return
"
\(
configuration
)
·
\(
destination
)
·
\(
pane
.
selectedCount
)
个模块"
}
}
private
var
configurationControls
:
some
View
{
private
var
projectChoices
:
some
View
{
VStack
(
alignment
:
.
leading
,
spacing
:
14
)
{
let
available
=
model
.
settings
.
projects
.
filter
{
candidate
in
Text
(
"发布选项"
)
.
font
(
.
headline
)
!
model
.
panes
.
contains
{
$0
.
id
!=
pane
.
id
&&
$0
.
projectID
==
candidate
.
id
}
if
let
project
{
}
if
project
.
type
==
.
cityKeeper
{
return
ScrollView
{
menuRow
(
"发布配置"
,
value
:
profile
?
.
title
??
"选择配置文件"
)
{
VStack
(
spacing
:
2
)
{
let
files
=
ForEach
(
available
)
{
candidate
in
(
try
?
project
.
configurationFiles
())
choiceButton
(
candidate
.
name
,
selected
:
candidate
.
id
==
pane
.
projectID
)
{
??
project
.
profiles
.
map
(\
.
file
)
pane
.
expandedField
=
nil
ForEach
(
files
,
id
:
\
.
self
)
{
file
in
model
.
replace
(
pane
,
with
:
candidate
)
Button
(
project
.
profiles
.
first
(
where
:
{
$0
.
file
==
file
})?
.
title
??
file
)
{
selectConfiguration
(
file
,
in
:
project
)
}
}
}
}
Divider
()
}
.
padding
(
4
)
Button
(
"浏览其他 YAML…"
)
{
browseConfiguration
(
in
:
project
)
}
}
}
menuRow
(
.
frame
(
height
:
min
(
150
,
CGFloat
(
available
.
count
)
*
34
+
8
))
"服务器"
,
.
background
(
ReleaseColors
.
terminal
,
in
:
RoundedRectangle
(
cornerRadius
:
7
))
value
:
pane
.
servers
.
first
(
where
:
{
$0
.
name
==
pane
.
server
})?
.
padding
([
.
horizontal
,
.
bottom
],
8
)
.
displayName
??
"选择服务器"
}
)
{
private
var
serverChoices
:
some
View
{
ScrollView
{
VStack
(
spacing
:
2
)
{
ForEach
(
pane
.
servers
,
id
:
\
.
name
)
{
target
in
ForEach
(
pane
.
servers
,
id
:
\
.
name
)
{
target
in
Button
(
target
.
displayName
)
{
choiceButton
(
target
.
displayName
,
selected
:
target
.
name
==
pane
.
server
)
{
pane
.
server
=
target
.
name
pane
.
server
=
target
.
name
pane
.
expandedField
=
nil
model
.
save
()
model
.
save
()
}
}
}
}
if
pane
.
servers
.
isEmpty
{
Text
(
"未读取到服务器,请检查项目设置中的 hosts 文件。"
)
.
font
(
.
caption
)
.
foregroundStyle
(
ReleaseColors
.
muted
)
.
padding
(
10
)
}
}
menuRow
(
"Maven"
,
value
:
pane
.
mavenCommand
.
title
)
{
}
.
padding
(
4
)
ForEach
([
MavenCommand
.
mvnd
,
.
mvn
])
{
command
in
Button
(
command
.
title
)
{
pane
.
mavenCommand
=
command
model
.
save
()
}
}
.
frame
(
height
:
max
(
52
,
min
(
170
,
CGFloat
(
pane
.
servers
.
count
)
*
38
+
8
)))
.
background
(
ReleaseColors
.
terminal
,
in
:
RoundedRectangle
(
cornerRadius
:
7
))
.
padding
([
.
horizontal
,
.
bottom
],
8
)
}
}
private
func
choiceButton
(
_
title
:
String
,
selected
:
Bool
,
action
:
@escaping
()
->
Void
)
->
some
View
{
Button
(
action
:
action
)
{
HStack
(
spacing
:
8
)
{
Image
(
systemName
:
selected
?
"largecircle.fill.circle"
:
"circle"
)
.
foregroundStyle
(
selected
?
ReleaseColors
.
blue
:
ReleaseColors
.
muted
)
Text
(
title
)
.
foregroundStyle
(
.
primary
)
.
fixedSize
(
horizontal
:
false
,
vertical
:
true
)
.
frame
(
maxWidth
:
.
infinity
,
alignment
:
.
leading
)
}
.
padding
(
.
horizontal
,
8
)
.
padding
(
.
vertical
,
7
)
}
}
HStack
(
spacing
:
12
)
{
.
buttonStyle
(
Toggle
(
"VPC"
,
isOn
:
$
pane
.
useVPC
)
ReleaseButtonStyle
(
if
project
.
supportsVerifiedRelease
(
profile
)
{
base
:
selected
?
ReleaseColors
.
blue
.
opacity
(
0.12
)
:
.
clear
,
radius
:
5
)
Toggle
(
"验证发布"
,
isOn
:
$
pane
.
verified
)
)
Spacer
(
minLength
:
0
)
.
accessibilityAddTraits
(
selected
?
.
isSelected
:
[])
Button
(
"预检"
)
{
model
.
publish
(
pane
,
action
:
.
preflight
)
}
}
.
buttonStyle
(
ReleaseButtonStyle
())
.
disabled
(
!
editable
||
pane
.
modules
.
isEmpty
)
private
var
configurationChoices
:
some
View
{
}
else
{
let
files
=
(
try
?
project
?
.
configurationFiles
())
??
project
?
.
profiles
.
map
(\
.
file
)
??
[]
Spacer
(
minLength
:
0
)
return
VStack
(
alignment
:
.
leading
,
spacing
:
6
)
{
if
!
files
.
isEmpty
{
ScrollView
{
VStack
(
spacing
:
2
)
{
ForEach
(
files
,
id
:
\
.
self
)
{
file
in
configurationChoice
(
file
)
}
}
.
padding
(
4
)
}
.
frame
(
height
:
min
(
160
,
CGFloat
(
files
.
count
)
*
46
+
8
))
.
background
(
ReleaseColors
.
terminal
,
in
:
RoundedRectangle
(
cornerRadius
:
7
))
}
if
let
draft
=
Binding
(
$
configurationDraft
)
{
VStack
(
alignment
:
.
leading
,
spacing
:
8
)
{
Text
(
draft
.
file
.
wrappedValue
)
.
font
(
.
system
(
.
caption
,
design
:
.
monospaced
))
.
foregroundStyle
(
ReleaseColors
.
muted
)
.
lineLimit
(
1
)
TextField
(
"别名(可选)"
,
text
:
draft
.
alias
)
.
textFieldStyle
(
.
roundedBorder
)
TextField
(
"SSH 目标(可选)"
,
text
:
draft
.
sshTarget
)
.
textFieldStyle
(
.
roundedBorder
)
HStack
{
Spacer
()
Button
(
"取消"
)
{
configurationDraft
=
nil
}
Button
(
"保存"
)
{
if
let
configurationDraft
,
saveProfile
(
configurationDraft
,
select
:
false
)
{
self
.
configurationDraft
=
nil
}
}
}
}
.
font
(
ReleaseTypography
.
detail
)
.
padding
(
8
)
.
background
(
ReleaseColors
.
terminal
,
in
:
RoundedRectangle
(
cornerRadius
:
7
))
}
}
if
let
profile
{
Button
{
Button
{
configurationDraft
=
profile
if
let
project
{
browseConfiguration
(
in
:
project
)
}
}
label
:
{
}
label
:
{
Image
(
systemName
:
"slider.horizontal.3"
)
Label
(
"浏览其他 YAML…"
,
systemImage
:
"folder"
)
}
.
foregroundStyle
(
ReleaseColors
.
blue
)
.
padding
(
8
)
.
buttonStyle
(
ReleaseButtonStyle
())
}
.
buttonStyle
(
ReleaseButtonStyle
())
.
help
(
"编辑配置别名和 SSH 目标"
)
}
.
padding
([
.
horizontal
,
.
bottom
],
8
)
.
disabled
(
!
editable
)
}
}
private
func
configurationChoice
(
_
file
:
String
)
->
some
View
{
var
option
=
project
?
.
profiles
.
first
(
where
:
{
$0
.
file
==
file
})
??
DeployProfile
()
option
.
file
=
file
let
selected
=
profile
?
.
file
==
file
return
HStack
(
spacing
:
2
)
{
Button
{
configurationDraft
=
nil
if
let
project
{
selectConfiguration
(
file
,
in
:
project
)
}
}
label
:
{
HStack
(
spacing
:
8
)
{
Image
(
systemName
:
selected
?
"largecircle.fill.circle"
:
"circle"
)
.
foregroundStyle
(
selected
?
ReleaseColors
.
blue
:
ReleaseColors
.
muted
)
VStack
(
alignment
:
.
leading
,
spacing
:
2
)
{
Text
(
option
.
title
)
.
lineLimit
(
1
)
if
option
.
title
!=
file
{
Text
(
file
)
.
font
(
.
system
(
.
caption
,
design
:
.
monospaced
))
.
foregroundStyle
(
ReleaseColors
.
muted
)
.
lineLimit
(
1
)
}
}
.
toggleStyle
(
.
checkbox
)
.
font
(
ReleaseTypography
.
detail
)
.
disabled
(
!
editable
)
.
onChange
(
of
:
pane
.
useVPC
)
{
model
.
save
()
}
.
onChange
(
of
:
pane
.
verified
)
{
model
.
save
()
}
}
}
if
project
.
type
!=
.
cityKeeper
{
Spacer
(
minLength
:
3
)
Text
(
"自定义项目使用项目设置中的发布脚本。"
)
}
.
padding
(
.
horizontal
,
8
)
.
frame
(
height
:
44
)
.
contentShape
(
Rectangle
())
.
foregroundStyle
(
ReleaseColors
.
muted
)
}
}
.
buttonStyle
(
ReleaseButtonStyle
(
base
:
selected
?
ReleaseColors
.
blue
.
opacity
(
0.12
)
:
.
clear
,
radius
:
5
)
)
.
accessibilityAddTraits
(
selected
?
.
isSelected
:
[])
Button
{
configurationDraft
=
option
}
label
:
{
Image
(
systemName
:
"pencil"
)
.
foregroundStyle
(
ReleaseColors
.
blue
)
.
frame
(
width
:
27
,
height
:
27
)
}
}
Button
(
"完成"
)
{
showsConfiguration
=
false
}
.
buttonStyle
(
ReleaseButtonStyle
())
.
frame
(
maxWidth
:
.
infinity
,
alignment
:
.
trailing
)
.
accessibilityLabel
(
"编辑
\(
file
)
的别名和选项"
)
}
}
.
padding
(
18
)
.
frame
(
width
:
360
)
.
environment
(\
.
colorScheme
,
.
dark
)
}
}
private
var
paneTitle
:
String
{
private
var
paneTitle
:
String
{
...
@@ -561,35 +622,10 @@ private struct ProjectReleaseColumn: View {
...
@@ -561,35 +622,10 @@ private struct ProjectReleaseColumn: View {
}
}
}
}
private
func
menuRow
<
Content
:
View
>
(
_
label
:
String
,
value
:
String
,
@ViewBuilder
content
:
()
->
Content
)
->
some
View
{
HStack
(
spacing
:
8
)
{
Text
(
label
)
.
foregroundStyle
(
ReleaseColors
.
muted
)
.
frame
(
width
:
60
,
alignment
:
.
leading
)
Menu
(
content
:
content
)
{
HStack
{
Text
(
value
)
.
lineLimit
(
1
)
Spacer
(
minLength
:
3
)
Image
(
systemName
:
"chevron.down"
)
.
font
(
.
system
(
size
:
10
))
}
.
padding
(
.
horizontal
,
11
)
.
frame
(
height
:
36
)
.
frame
(
maxWidth
:
.
infinity
)
.
background
(
ReleaseColors
.
surface
,
in
:
RoundedRectangle
(
cornerRadius
:
7
))
.
overlay
{
RoundedRectangle
(
cornerRadius
:
7
)
.
strokeBorder
(
ReleaseColors
.
border
)
}
}
.
menuStyle
(
.
borderlessButton
)
.
menuIndicator
(
.
hidden
)
.
frame
(
maxWidth
:
.
infinity
)
.
disabled
(
!
editable
)
}
}
private
func
selectConfiguration
(
_
file
:
String
,
in
project
:
ReleaseProject
)
{
private
func
selectConfiguration
(
_
file
:
String
,
in
project
:
ReleaseProject
)
{
if
let
existing
=
project
.
profiles
.
first
(
where
:
{
$0
.
file
==
file
})
{
if
let
existing
=
project
.
profiles
.
first
(
where
:
{
$0
.
file
==
file
})
{
pane
.
profileID
=
existing
.
id
pane
.
profileID
=
existing
.
id
pane
.
verified
=
false
model
.
save
()
model
.
save
()
return
return
}
}
...
@@ -610,8 +646,9 @@ private struct ProjectReleaseColumn: View {
...
@@ -610,8 +646,9 @@ private struct ProjectReleaseColumn: View {
selectConfiguration
(
name
,
in
:
project
)
selectConfiguration
(
name
,
in
:
project
)
}
}
private
func
saveProfile
(
_
updated
:
DeployProfile
)
{
@discardableResult
guard
var
project
else
{
return
}
private
func
saveProfile
(
_
updated
:
DeployProfile
,
select
:
Bool
=
true
)
->
Bool
{
guard
var
project
else
{
return
false
}
do
{
do
{
try
project
.
validate
(
updated
)
try
project
.
validate
(
updated
)
if
let
index
=
project
.
profiles
.
firstIndex
(
where
:
{
$0
.
id
==
updated
.
id
})
{
if
let
index
=
project
.
profiles
.
firstIndex
(
where
:
{
$0
.
id
==
updated
.
id
})
{
...
@@ -620,27 +657,15 @@ private struct ProjectReleaseColumn: View {
...
@@ -620,27 +657,15 @@ private struct ProjectReleaseColumn: View {
project
.
profiles
.
append
(
updated
)
project
.
profiles
.
append
(
updated
)
}
}
try
model
.
settings
.
save
(
project
)
try
model
.
settings
.
save
(
project
)
if
select
{
pane
.
profileID
=
updated
.
id
pane
.
profileID
=
updated
.
id
pane
.
verified
=
false
}
model
.
save
()
model
.
save
()
return
true
}
catch
{
}
catch
{
pane
.
error
=
error
.
localizedDescription
pane
.
error
=
error
.
localizedDescription
return
false
}
}
}
}
}
}
private
struct
ConfigurationEditor
:
View
{
@State
var
profile
:
DeployProfile
let
save
:
(
DeployProfile
)
->
Void
var
body
:
some
View
{
VStack
(
alignment
:
.
leading
,
spacing
:
9
)
{
Text
(
profile
.
file
)
.
font
(
.
system
(
size
:
12
,
design
:
.
monospaced
))
TextField
(
"别名"
,
text
:
$
profile
.
alias
)
TextField
(
"SSH 目标(可选)"
,
text
:
$
profile
.
sshTarget
)
Button
(
"保存"
)
{
save
(
profile
)
}
}
.
padding
(
15
)
.
frame
(
width
:
280
)
.
environment
(\
.
colorScheme
,
.
dark
)
}
}
Tests/ReleaseCoreTests/ReleaseRunnerTests.swift
View file @
cd3a975e
...
@@ -23,6 +23,7 @@ final class ReleaseRunnerTests: XCTestCase {
...
@@ -23,6 +23,7 @@ final class ReleaseRunnerTests: XCTestCase {
beta
.
name
=
"Beta"
beta
.
name
=
"Beta"
try
settings
.
save
(
alpha
)
try
settings
.
save
(
alpha
)
try
settings
.
save
(
beta
)
try
settings
.
save
(
beta
)
settings
.
projectID
=
alpha
.
id
let
model
=
SplitReleaseModel
(
settings
:
settings
,
storage
:
storage
)
let
model
=
SplitReleaseModel
(
settings
:
settings
,
storage
:
storage
)
model
.
add
()
model
.
add
()
XCTAssertEqual
(
model
.
panes
.
count
,
2
)
XCTAssertEqual
(
model
.
panes
.
count
,
2
)
...
@@ -60,6 +61,68 @@ final class ReleaseRunnerTests: XCTestCase {
...
@@ -60,6 +61,68 @@ final class ReleaseRunnerTests: XCTestCase {
XCTAssertTrue
(
restored
.
panes
.
contains
{
$0
.
log
.
contains
(
"first task completed"
)
})
XCTAssertTrue
(
restored
.
panes
.
contains
{
$0
.
log
.
contains
(
"first task completed"
)
})
}
}
@MainActor
func
testIdlePaneCanCloseWhileAnotherReleaseRuns
()
async
throws
{
let
first
=
try
Fixture
()
let
second
=
try
Fixture
()
defer
{
first
.
remove
();
second
.
remove
()
}
try
"sleep 0.4
\n
printf 'active release finished
\\
n'
\n
"
.
write
(
to
:
first
.
local
.
appending
(
path
:
"release.sh"
),
atomically
:
true
,
encoding
:
.
utf8
)
let
storage
=
first
.
base
.
appending
(
path
:
"close-state"
)
let
settings
=
AppModel
(
storage
:
storage
)
var
alpha
=
first
.
project
;
alpha
.
name
=
"Alpha"
var
beta
=
second
.
project
;
beta
.
name
=
"Beta"
try
settings
.
save
(
alpha
);
try
settings
.
save
(
beta
)
settings
.
projectID
=
alpha
.
id
let
model
=
SplitReleaseModel
(
settings
:
settings
,
storage
:
storage
)
model
.
add
()
let
active
=
model
.
panes
[
0
]
let
idle
=
model
.
panes
[
1
]
model
.
publish
(
active
)
model
.
remove
(
active
)
XCTAssertEqual
(
model
.
panes
.
count
,
2
)
model
.
remove
(
idle
)
XCTAssertEqual
(
model
.
panes
.
count
,
1
)
XCTAssertTrue
(
model
.
isRunning
)
for
_
in
0
..<
200
where
model
.
isRunning
{
try
await
Task
.
sleep
(
for
:
.
milliseconds
(
10
))
}
XCTAssertEqual
(
active
.
result
?
.
status
,
.
succeeded
)
XCTAssertTrue
(
active
.
log
.
contains
(
"active release finished"
))
XCTAssertEqual
(
model
.
indicator
,
.
succeeded
)
}
@MainActor
func
testFinishedPaneCanCloseWithoutLosingBatchOutcome
()
async
throws
{
let
first
=
try
Fixture
()
let
second
=
try
Fixture
()
defer
{
first
.
remove
();
second
.
remove
()
}
try
"printf 'first finished
\\
n'
\n
"
.
write
(
to
:
first
.
local
.
appending
(
path
:
"release.sh"
),
atomically
:
true
,
encoding
:
.
utf8
)
try
"sleep 0.4
\n
printf 'second finished
\\
n'
\n
"
.
write
(
to
:
second
.
local
.
appending
(
path
:
"release.sh"
),
atomically
:
true
,
encoding
:
.
utf8
)
let
storage
=
first
.
base
.
appending
(
path
:
"batch-close-state"
)
let
settings
=
AppModel
(
storage
:
storage
)
var
alpha
=
first
.
project
;
alpha
.
name
=
"Alpha"
var
beta
=
second
.
project
;
beta
.
name
=
"Beta"
try
settings
.
save
(
alpha
);
try
settings
.
save
(
beta
)
settings
.
projectID
=
alpha
.
id
let
model
=
SplitReleaseModel
(
settings
:
settings
,
storage
:
storage
)
model
.
add
()
let
finished
=
model
.
panes
[
0
]
let
next
=
model
.
panes
[
1
]
model
.
publishAll
()
model
.
remove
(
next
)
XCTAssertEqual
(
model
.
panes
.
count
,
2
)
for
_
in
0
..<
200
where
finished
.
state
!=
.
finished
{
try
await
Task
.
sleep
(
for
:
.
milliseconds
(
10
))
}
XCTAssertEqual
(
finished
.
result
?
.
status
,
.
succeeded
)
XCTAssertTrue
(
model
.
isRunning
)
model
.
remove
(
finished
)
XCTAssertEqual
(
model
.
panes
.
count
,
1
)
XCTAssertGreaterThanOrEqual
(
try
XCTUnwrap
(
model
.
progressPercentage
),
50
)
for
_
in
0
..<
200
where
model
.
isRunning
{
try
await
Task
.
sleep
(
for
:
.
milliseconds
(
10
))
}
XCTAssertEqual
(
next
.
result
?
.
status
,
.
succeeded
)
XCTAssertEqual
(
model
.
indicator
,
.
succeeded
)
}
@MainActor
@MainActor
func
testFailedPaneKeepsConsoleUntilReturnedAndRetryResetsIt
()
async
throws
{
func
testFailedPaneKeepsConsoleUntilReturnedAndRetryResetsIt
()
async
throws
{
let
fixture
=
try
Fixture
()
let
fixture
=
try
Fixture
()
...
@@ -128,6 +191,7 @@ final class ReleaseRunnerTests: XCTestCase {
...
@@ -128,6 +191,7 @@ final class ReleaseRunnerTests: XCTestCase {
beta
.
profiles
=
[
profile
]
beta
.
profiles
=
[
profile
]
try
settings
.
save
(
alpha
)
try
settings
.
save
(
alpha
)
try
settings
.
save
(
beta
)
try
settings
.
save
(
beta
)
settings
.
projectID
=
alpha
.
id
let
model
=
SplitReleaseModel
(
settings
:
settings
,
storage
:
storage
)
let
model
=
SplitReleaseModel
(
settings
:
settings
,
storage
:
storage
)
model
.
add
()
model
.
add
()
for
_
in
0
..<
100
where
model
.
panes
.
contains
(
where
:
{
$0
.
servers
.
isEmpty
})
{
for
_
in
0
..<
100
where
model
.
panes
.
contains
(
where
:
{
$0
.
servers
.
isEmpty
})
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment