Skip to content

Commit 41c7c09

Browse files
committed
Add option to verify components after build
1 parent 80ff460 commit 41c7c09

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

.github/workflows/_build-release.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ on:
1010
ref:
1111
required: false
1212
type: string
13-
include_cairols:
13+
full-verify:
14+
required: false
15+
type: boolean
16+
default: false
1417
include-cairols:
1518
description: "Include CairoLS in build"
1619
type: boolean
@@ -166,7 +169,7 @@ jobs:
166169
shell: bash
167170
run: |
168171
archive=$(find target/verify -name 'scarb-*.zip' -o -name 'scarb-*.tar.gz')
169-
cargo xtask verify-archive --archive "$archive"
172+
cargo xtask verify-archive --archive "$archive" ${{ inputs.full-verify && '--full' || ''}}
170173
env:
171174
EXPECTED_VERSION: ${{ inputs.scarb-tag }}
172175

.github/workflows/release.yml

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
uses: ./.github/workflows/_build-release.yml
1717
with:
1818
scarb-tag: ${{ github.ref_name }}
19+
full-verify: true
1920

2021
draft:
2122
name: draft release

xtask/src/verify_archive.rs

+23-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
use std::env;
22
use std::path::{Path, PathBuf};
33

4-
use anyhow::{anyhow, ensure, Result};
5-
use clap::Parser;
4+
use anyhow::{Result, anyhow, ensure};
5+
use clap::{Parser, arg};
66
use walkdir::WalkDir;
7-
use xshell::{cmd, Shell};
7+
use xshell::{Shell, cmd};
88

99
#[derive(Parser)]
1010
pub struct Args {
1111
#[arg(short, long, env = "SCARB_ARCHIVE")]
1212
archive: PathBuf,
1313
#[arg(short, long, env = "EXPECTED_VERSION")]
1414
expected_version: String,
15+
// Ensure Scarb has been compiled with all optional components.
16+
#[arg(long)]
17+
full: bool,
1518
}
1619

1720
pub fn main(args: Args) -> Result<()> {
@@ -20,7 +23,13 @@ pub fn main(args: Args) -> Result<()> {
2023
let expected_version = args.expected_version.trim_start_matches('v');
2124

2225
let install_dir = sh.create_temp_dir()?;
23-
if args.archive.file_name().unwrap().to_string_lossy().ends_with(".tar.gz") {
26+
if args
27+
.archive
28+
.file_name()
29+
.unwrap()
30+
.to_string_lossy()
31+
.ends_with(".tar.gz")
32+
{
2433
let archive = &args.archive;
2534
let install_dir = install_dir.path();
2635
cmd!(sh, "tar -zxvf {archive} -C {install_dir}").run()?;
@@ -47,6 +56,16 @@ pub fn main(args: Args) -> Result<()> {
4756
sh.change_dir(workdir.path().join("smoke_test"));
4857
cmd!(sh, "{scarb} build").run()?;
4958
cmd!(sh, "{scarb} test").run()?;
59+
if args.full {
60+
cmd!(sh, "{scarb} lint").run()?;
61+
cmd!(
62+
sh,
63+
"{scarb} commands | jq -e 'has(\"cairo-language-server\")'"
64+
)
65+
.run()?;
66+
cmd!(sh, "{scarb} commands | jq -e 'has(\"verify\")'").run()?;
67+
cmd!(sh, "{scarb} commands | jq -e 'has(\"prove\")'").run()?;
68+
}
5069

5170
Ok(())
5271
}

0 commit comments

Comments
 (0)