Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Duniter v2S
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
rust
Duniter v2S
Commits
15ac629a
Commit
15ac629a
authored
9 months ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
fix(
#195
): runtime-release must include srtool output
parent
cbf1f632
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+5
-2
5 additions, 2 deletions
.gitlab-ci.yml
xtask/src/main.rs
+10
-4
10 additions, 4 deletions
xtask/src/main.rs
xtask/src/release_runtime.rs
+33
-52
33 additions, 52 deletions
xtask/src/release_runtime.rs
with
48 additions
and
58 deletions
.gitlab-ci.yml
+
5
−
2
View file @
15ac629a
...
@@ -358,7 +358,7 @@ create_network_release:
...
@@ -358,7 +358,7 @@ create_network_release:
-
<<
:
*is_network_branch
-
<<
:
*is_network_branch
image
:
rust:1-bullseye
image
:
rust:1-bullseye
variables
:
variables
:
# Used by `release-
runtime
` command
# Used by `release-
network
` command
SRTOOL_OUTPUT
:
$CI_PROJECT_DIR/release/srtool_output.json
SRTOOL_OUTPUT
:
$CI_PROJECT_DIR/release/srtool_output.json
script
:
script
:
-
*define_network_branch_vars
-
*define_network_branch_vars
...
@@ -384,9 +384,12 @@ create_client_release:
...
@@ -384,9 +384,12 @@ create_client_release:
rules
:
rules
:
-
<<
:
*is_network_branch
-
<<
:
*is_network_branch
image
:
rust:1-bullseye
image
:
rust:1-bullseye
variables
:
# Used by `release-runtime` command
SRTOOL_OUTPUT
:
$CI_PROJECT_DIR/release/srtool_output.json
script
:
script
:
-
*define_network_branch_vars
-
*define_network_branch_vars
-
cargo xtask release-runtime $
RUNTIME_MILESTON
E $CI_COMMIT_BRANCH
-
cargo xtask release-runtime $
NETWORK_RELEAS
E $CI_COMMIT_BRANCH
$RUNTIME_MILESTONE
-
cargo xtask create-asset-link $RUNTIME_MILESTONE ${RUNTIME}_runtime.compact.compressed.wasm https://nodes.pages.duniter.org/-/rust/duniter-v2s/-/jobs/$CI_JOB_ID/artifacts/$RELEASE_FILE_WASM
-
cargo xtask create-asset-link $RUNTIME_MILESTONE ${RUNTIME}_runtime.compact.compressed.wasm https://nodes.pages.duniter.org/-/rust/duniter-v2s/-/jobs/$CI_JOB_ID/artifacts/$RELEASE_FILE_WASM
-
cargo xtask create-asset-link $RUNTIME_MILESTONE ${RUNTIME}_client-specs.yaml https://nodes.pages.duniter.org/-/rust/duniter-v2s/-/jobs/$CI_JOB_ID/artifacts/$RELEASE_FILE_CLIENT_SPEC
-
cargo xtask create-asset-link $RUNTIME_MILESTONE ${RUNTIME}_client-specs.yaml https://nodes.pages.duniter.org/-/rust/duniter-v2s/-/jobs/$CI_JOB_ID/artifacts/$RELEASE_FILE_CLIENT_SPEC
-
cargo xtask create-asset-link $RUNTIME_MILESTONE ${RUNTIME}-raw.json https://nodes.pages.duniter.org/-/rust/duniter-v2s/-/jobs/$CI_JOB_ID/artifacts/$RELEASE_FILE_RAW_SPEC
-
cargo xtask create-asset-link $RUNTIME_MILESTONE ${RUNTIME}-raw.json https://nodes.pages.duniter.org/-/rust/duniter-v2s/-/jobs/$CI_JOB_ID/artifacts/$RELEASE_FILE_RAW_SPEC
...
...
This diff is collapsed.
Click to expand it.
xtask/src/main.rs
+
10
−
4
View file @
15ac629a
...
@@ -54,7 +54,11 @@ enum DuniterXTaskCommand {
...
@@ -54,7 +54,11 @@ enum DuniterXTaskCommand {
/// Release a new network
/// Release a new network
ReleaseNetwork
{
network
:
String
,
branch
:
String
},
ReleaseNetwork
{
network
:
String
,
branch
:
String
},
/// Release a new runtime
/// Release a new runtime
ReleaseRuntime
{
milestone
:
String
,
branch
:
String
},
ReleaseRuntime
{
network
:
String
,
branch
:
String
,
milestone
:
String
,
},
/// Print the chainSpec published on given Network Release
/// Print the chainSpec published on given Network Release
PrintSpec
{
network
:
String
},
PrintSpec
{
network
:
String
},
/// Create asset in a release
/// Create asset in a release
...
@@ -99,9 +103,11 @@ async fn main() -> Result<()> {
...
@@ -99,9 +103,11 @@ async fn main() -> Result<()> {
DuniterXTaskCommand
::
ReleaseNetwork
{
network
,
branch
}
=>
{
DuniterXTaskCommand
::
ReleaseNetwork
{
network
,
branch
}
=>
{
release_runtime
::
release_network
(
network
,
branch
)
.await
release_runtime
::
release_network
(
network
,
branch
)
.await
}
}
DuniterXTaskCommand
::
ReleaseRuntime
{
milestone
,
branch
}
=>
{
DuniterXTaskCommand
::
ReleaseRuntime
{
release_runtime
::
release_runtime
(
milestone
,
branch
)
.await
network
,
}
branch
,
milestone
,
}
=>
release_runtime
::
release_runtime
(
network
,
branch
,
milestone
)
.await
,
DuniterXTaskCommand
::
PrintSpec
{
network
}
=>
release_runtime
::
print_spec
(
network
)
.await
,
DuniterXTaskCommand
::
PrintSpec
{
network
}
=>
release_runtime
::
print_spec
(
network
)
.await
,
DuniterXTaskCommand
::
CreateAssetLink
{
DuniterXTaskCommand
::
CreateAssetLink
{
tag
,
tag
,
...
...
This diff is collapsed.
Click to expand it.
xtask/src/release_runtime.rs
+
33
−
52
View file @
15ac629a
...
@@ -69,28 +69,7 @@ pub(super) async fn release_network(network: String, branch: String) -> Result<(
...
@@ -69,28 +69,7 @@ pub(super) async fn release_network(network: String, branch: String) -> Result<(
"
,
"
,
);
);
add_srtool_notes
(
network
.clone
(),
&
mut
release_notes
)
?
;
// Generate release notes
let
currency
=
network
.clone
();
let
env_var
=
"SRTOOL_OUTPUT"
.to_string
();
if
let
Ok
(
sr_tool_output_file
)
=
std
::
env
::
var
(
env_var
)
{
let
read
=
fs
::
read_to_string
(
sr_tool_output_file
);
match
read
{
Ok
(
sr_tool_output
)
=>
{
release_notes
.push_str
(
gen_release_notes
(
currency
.to_string
(),
sr_tool_output
)
.with_context
(||
{
format!
(
"Fail to generate release notes for {}"
,
currency
)
})
?
.as_str
(),
);
}
Err
(
e
)
=>
{
eprintln!
(
"srtool JSON output could not be read ({}). Skipped."
,
e
)
}
}
}
println!
(
"{}"
,
release_notes
);
println!
(
"{}"
,
release_notes
);
let
gitlab_token
=
let
gitlab_token
=
...
@@ -106,42 +85,19 @@ pub(super) async fn release_network(network: String, branch: String) -> Result<(
...
@@ -106,42 +85,19 @@ pub(super) async fn release_network(network: String, branch: String) -> Result<(
Ok
(())
Ok
(())
}
}
pub
(
super
)
async
fn
release_runtime
(
milestone
:
String
,
branch
:
String
)
->
Result
<
()
>
{
pub
(
super
)
async
fn
release_runtime
(
// TODO: check spec_version in the code and bump if necessary (with a commit)
network
:
String
,
// TODO: create and push a git tag runtime-{spec_version}
branch
:
String
,
milestone
:
String
,
)
->
Result
<
()
>
{
let
mut
release_notes
=
String
::
from
(
let
mut
release_notes
=
String
::
from
(
"
"
# Runtime
s
# Runtime
"
,
"
,
);
);
// Generate release notes
add_srtool_notes
(
network
,
&
mut
release_notes
)
?
;
let
runtimes
=
vec!
[
(
"ĞDev"
,
"SRTOOL_OUTPUT_GDEV"
),
(
"ĞTest"
,
"SRTOOL_OUTPUT_GTEST"
),
(
"Ğ1"
,
"SRTOOL_OUTPUT_G1"
),
];
for
(
currency
,
env_var
)
in
runtimes
{
if
let
Ok
(
sr_tool_output_file
)
=
std
::
env
::
var
(
env_var
)
{
let
read
=
fs
::
read_to_string
(
sr_tool_output_file
);
match
read
{
Ok
(
sr_tool_output
)
=>
{
release_notes
.push_str
(
gen_release_notes
(
currency
.to_string
(),
sr_tool_output
)
.with_context
(||
{
format!
(
"Fail to generate release notes for {}"
,
currency
)
})
?
.as_str
(),
);
}
Err
(
e
)
=>
{
eprintln!
(
"srtool JSON output could not be read ({}). Skipped."
,
e
)
}
}
}
}
// Get changes (list of MRs) from gitlab API
// Get changes (list of MRs) from gitlab API
let
changes
=
get_changes
::
get_changes
(
milestone
.clone
())
.await
?
;
let
changes
=
get_changes
::
get_changes
(
milestone
.clone
())
.await
?
;
...
@@ -179,6 +135,31 @@ pub(super) async fn release_runtime(milestone: String, branch: String) -> Result
...
@@ -179,6 +135,31 @@ pub(super) async fn release_runtime(milestone: String, branch: String) -> Result
Ok
(())
Ok
(())
}
}
fn
add_srtool_notes
(
network
:
String
,
release_notes
:
&
mut
String
)
->
Result
<
()
>
{
// Generate release notes
let
currency
=
network
.clone
();
let
env_var
=
"SRTOOL_OUTPUT"
.to_string
();
if
let
Ok
(
sr_tool_output_file
)
=
std
::
env
::
var
(
env_var
)
{
let
read
=
fs
::
read_to_string
(
sr_tool_output_file
);
match
read
{
Ok
(
sr_tool_output
)
=>
{
release_notes
.push_str
(
gen_release_notes
(
currency
.to_string
(),
sr_tool_output
)
.with_context
(||
{
format!
(
"Fail to generate release notes for {}"
,
currency
)
})
?
.as_str
(),
);
}
Err
(
e
)
=>
{
eprintln!
(
"srtool JSON output could not be read ({}). Skipped."
,
e
)
}
}
}
Ok
(())
}
pub
(
super
)
async
fn
print_spec
(
network
:
String
)
->
Result
<
()
>
{
pub
(
super
)
async
fn
print_spec
(
network
:
String
)
->
Result
<
()
>
{
let
spec_file
=
match
network
.clone
()
{
let
spec_file
=
match
network
.clone
()
{
network
if
network
.starts_with
(
"g1"
)
=>
"g1.json"
,
network
if
network
.starts_with
(
"g1"
)
=>
"g1.json"
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment