Skip to content

Commit fac433e

Browse files
committed
Prefix dev builds with dev instead of nightly
1 parent 41c7c09 commit fac433e

File tree

5 files changed

+29
-17
lines changed

5 files changed

+29
-17
lines changed

.github/workflows/_build-release.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ jobs:
9494
- name: Build
9595
run: |
9696
${{ env.CARGO }} build --release --locked --target ${{ matrix.target }} --workspace --exclude scarb-prove \
97-
--exclude scarb-verify ${{ inputs.include-cairols && '--exclude scarb-cairo-language-server' || ''}} \
98-
--no-default-features ${{ inputs.include-lint && '--features scarb/scarb-lint' || ''}}
97+
--exclude scarb-verify ${{ inputs.include-cairols && '--exclude scarb-cairo-language-server' || ''}} \
98+
--no-default-features ${{ inputs.include-lint && '--features scarb/scarb-lint' || ''}}
9999
100100
- uses: dtolnay/rust-toolchain@master
101101
if: inputs.include-stwo

.github/workflows/dev-build.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,5 @@ jobs:
4242
#upgrade_stwo: ${{ inputs.upgrade_stwo }}
4343
include-cairols: ${{ inputs.include-cairols }}
4444
include-stwo: ${{ inputs.include-stwo }}
45-
include-lint: ${{ inputs.include-lint }}
45+
include-lint: ${{ inputs.include-lint }}
46+
is_dev: true

.github/workflows/nightly.yml

+8
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ on:
4949
description: "Include CairoLint in build"
5050
type: boolean
5151
default: true
52+
is_dev:
53+
description: "Is this a dev build"
54+
type: boolean
55+
default: false
5256
schedule:
5357
- cron: '0 0 * * 3,6'
5458

@@ -99,6 +103,8 @@ jobs:
99103
- name: Determine nightly version
100104
id: version
101105
shell: bash
106+
env:
107+
IS_SCARB_DEV: ${{ inputs.is_dev }}
102108
run: |
103109
NIGHTLY_TAG=$(cargo xtask get-nightly-version --tag)
104110
NIGHTLY_VERSION=$(cargo xtask get-nightly-version)
@@ -119,6 +125,8 @@ jobs:
119125
run: cargo build -p xtask
120126

121127
- name: Compose release notes
128+
env:
129+
IS_SCARB_DEV: ${{ inputs.is_dev }}
122130
run: cargo xtask nightly-release-notes > NIGHTLY_RELEASE_NOTES.md
123131

124132
- name: Commit patches

xtask/src/get_nightly_version.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,33 @@ use time::OffsetDateTime;
88
pub struct Args {
99
#[arg(short, long)]
1010
tag: bool,
11+
#[arg(long, env = "IS_SCARB_DEV")]
12+
dev: bool,
1113
}
1214

1315
pub fn main(args: Args) -> Result<()> {
14-
let tag = nightly_tag();
16+
let tag = nightly_tag(args.dev);
1517
if args.tag {
1618
println!("{tag}");
1719
} else {
18-
let version = nightly_version()?;
20+
let version = nightly_version(args.dev)?;
1921
println!("{version}");
2022
}
2123
Ok(())
2224
}
2325

24-
pub fn nightly_version() -> Result<Version> {
26+
pub fn nightly_version(is_dev: bool) -> Result<Version> {
2527
let mut version = expected_version()?;
2628
version.pre = Prerelease::EMPTY;
27-
version.build = BuildMetadata::new(&nightly_tag()).unwrap();
29+
version.build = BuildMetadata::new(&nightly_tag(is_dev)).unwrap();
2830
Ok(version)
2931
}
3032

31-
pub fn nightly_tag() -> String {
33+
pub fn nightly_tag(is_dev: bool) -> String {
34+
let prefix = if is_dev { "dev" } else { "nightly" };
3235
let dt = OffsetDateTime::now_utc();
3336
format!(
34-
"nightly-{}-{:0>2}-{:0>2}",
37+
"{prefix}-{}-{:0>2}-{:0>2}",
3538
dt.year(),
3639
u8::from(dt.month()),
3740
dt.day()

xtask/src/nightly_release_notes.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
use anyhow::Result;
22
use clap::Parser;
3-
use xshell::{cmd, Shell};
3+
use xshell::{Shell, cmd};
44

55
use crate::get_nightly_version::nightly_version;
66

77
#[derive(Parser)]
8-
pub struct Args;
8+
pub struct Args {
9+
#[arg(long, env = "IS_SCARB_DEV")]
10+
dev: bool,
11+
}
912

10-
pub fn main(_: Args) -> Result<()> {
13+
pub fn main(args: Args) -> Result<()> {
1114
// Note: We do not use scarb-build-metadata here because it requires rebuilding xtasks.
1215

1316
let sh = Shell::new()?;
1417

15-
let version = nightly_version()?;
18+
let version = nightly_version(args.dev)?;
1619

1720
let scarb_commit = cmd!(sh, "git log -1 --date=short --format=%H").read()?;
1821

@@ -28,10 +31,7 @@ pub fn main(_: Args) -> Result<()> {
2831
.unwrap()
2932
.iter()
3033
.find(|node| {
31-
let repr = node.get("id")
32-
.unwrap()
33-
.as_str()
34-
.unwrap();
34+
let repr = node.get("id").unwrap().as_str().unwrap();
3535
// The first condition for Rust >= 1.77
3636
// (After the PackageId spec stabilization)
3737
// The second condition for Rust < 1.77

0 commit comments

Comments
 (0)