Fix metrics CI to use new json file names
This commit is contained in:
parent
520d02f561
commit
f76f025889
3 changed files with 50 additions and 40 deletions
18
.github/workflows/metrics.yaml
vendored
18
.github/workflows/metrics.yaml
vendored
|
|
@ -67,7 +67,7 @@ jobs:
|
|||
other_metrics:
|
||||
strategy:
|
||||
matrix:
|
||||
names: [self, ripgrep, webrender, diesel]
|
||||
names: [self, ripgrep-13.0.0, webrender-2022, diesel-1.4.8]
|
||||
runs-on: ubuntu-latest
|
||||
needs: [setup_cargo, build_metrics]
|
||||
|
||||
|
|
@ -92,7 +92,7 @@ jobs:
|
|||
key: ${{ runner.os }}-target-${{ github.sha }}
|
||||
|
||||
- name: Collect metrics
|
||||
run: cargo xtask metrics ${{ matrix.names }}
|
||||
run: cargo xtask metrics "${{ matrix.names }}"
|
||||
|
||||
- name: Upload metrics
|
||||
uses: actions/upload-artifact@v3
|
||||
|
|
@ -118,25 +118,25 @@ jobs:
|
|||
with:
|
||||
name: self-${{ github.sha }}
|
||||
|
||||
- name: Download ripgrep metrics
|
||||
- name: Download ripgrep-13.0.0 metrics
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ripgrep-${{ github.sha }}
|
||||
name: ripgrep-13.0.0-${{ github.sha }}
|
||||
|
||||
- name: Download webrender metrics
|
||||
- name: Download webrender-2022 metrics
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: webrender-${{ github.sha }}
|
||||
name: webrender-2022-${{ github.sha }}
|
||||
|
||||
- name: Download diesel metrics
|
||||
- name: Download diesel-1.4.8 metrics
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: diesel-${{ github.sha }}
|
||||
name: diesel-1.4.8-${{ github.sha }}
|
||||
|
||||
- name: Combine json
|
||||
run: |
|
||||
git clone --depth 1 https://$METRICS_TOKEN@github.com/rust-analyzer/metrics.git
|
||||
jq -s ".[0] * .[1] * .[2] * .[3] * .[4]" build.json self.json ripgrep.json webrender.json diesel.json -c >> metrics/metrics.json
|
||||
jq -s ".[0] * .[1] * .[2] * .[3] * .[4]" build.json self.json ripgrep-13.0.0.json webrender-2022.json diesel-1.4.8.json -c >> metrics/metrics.json
|
||||
cd metrics
|
||||
git add .
|
||||
git -c user.name=Bot -c user.email=dummy@example.com commit --message 📈
|
||||
|
|
|
|||
|
|
@ -122,13 +122,24 @@ impl FromStr for MeasurementType {
|
|||
match s {
|
||||
"build" => Ok(Self::Build),
|
||||
"self" => Ok(Self::AnalyzeSelf),
|
||||
"ripgrep" => Ok(Self::AnalyzeRipgrep),
|
||||
"webrender" => Ok(Self::AnalyzeWebRender),
|
||||
"diesel" => Ok(Self::AnalyzeDiesel),
|
||||
"ripgrep-13.0.0" => Ok(Self::AnalyzeRipgrep),
|
||||
"webrender-2022" => Ok(Self::AnalyzeWebRender),
|
||||
"diesel-1.4.8" => Ok(Self::AnalyzeDiesel),
|
||||
_ => Err("Invalid option".to_string()),
|
||||
}
|
||||
}
|
||||
}
|
||||
impl AsRef<str> for MeasurementType {
|
||||
fn as_ref(&self) -> &str {
|
||||
match self {
|
||||
Self::Build => "build",
|
||||
Self::AnalyzeSelf => "self",
|
||||
Self::AnalyzeRipgrep => "ripgrep-13.0.0",
|
||||
Self::AnalyzeWebRender => "webrender-2022",
|
||||
Self::AnalyzeDiesel => "diesel-1.4.8",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Metrics {
|
||||
|
|
|
|||
|
|
@ -29,41 +29,40 @@ impl flags::Metrics {
|
|||
|
||||
let _env = sh.push_env("RA_METRICS", "1");
|
||||
|
||||
let filename = match self.measurement_type {
|
||||
Some(ms) => match ms {
|
||||
MeasurementType::Build => {
|
||||
metrics.measure_build(sh)?;
|
||||
"build.json"
|
||||
}
|
||||
MeasurementType::AnalyzeSelf => {
|
||||
metrics.measure_analysis_stats_self(sh)?;
|
||||
"self.json"
|
||||
}
|
||||
MeasurementType::AnalyzeRipgrep => {
|
||||
metrics.measure_analysis_stats(sh, "ripgrep-13.0.0")?;
|
||||
"ripgrep-13.0.0.json"
|
||||
}
|
||||
MeasurementType::AnalyzeWebRender => {
|
||||
metrics.measure_analysis_stats(sh, "webrender-2022")?;
|
||||
"webrender-2022.json"
|
||||
}
|
||||
MeasurementType::AnalyzeDiesel => {
|
||||
metrics.measure_analysis_stats(sh, "diesel-1.4.8")?;
|
||||
"diesel-1.4.8.json"
|
||||
}
|
||||
},
|
||||
let name = match &self.measurement_type {
|
||||
Some(ms) => {
|
||||
let name = ms.as_ref();
|
||||
match ms {
|
||||
MeasurementType::Build => {
|
||||
metrics.measure_build(sh)?;
|
||||
}
|
||||
MeasurementType::AnalyzeSelf => {
|
||||
metrics.measure_analysis_stats_self(sh)?;
|
||||
}
|
||||
MeasurementType::AnalyzeRipgrep => {
|
||||
metrics.measure_analysis_stats(sh, name)?;
|
||||
}
|
||||
MeasurementType::AnalyzeWebRender => {
|
||||
metrics.measure_analysis_stats(sh, name)?;
|
||||
}
|
||||
MeasurementType::AnalyzeDiesel => {
|
||||
metrics.measure_analysis_stats(sh, name)?;
|
||||
}
|
||||
};
|
||||
name
|
||||
}
|
||||
None => {
|
||||
metrics.measure_build(sh)?;
|
||||
metrics.measure_analysis_stats_self(sh)?;
|
||||
metrics.measure_analysis_stats(sh, "ripgrep-13.0.0")?;
|
||||
metrics.measure_analysis_stats(sh, "webrender-2022")?;
|
||||
metrics.measure_analysis_stats(sh, "diesel-1.4.8")?;
|
||||
"all.json"
|
||||
metrics.measure_analysis_stats(sh, MeasurementType::AnalyzeRipgrep.as_ref())?;
|
||||
metrics.measure_analysis_stats(sh, MeasurementType::AnalyzeWebRender.as_ref())?;
|
||||
metrics.measure_analysis_stats(sh, MeasurementType::AnalyzeDiesel.as_ref())?;
|
||||
"all"
|
||||
}
|
||||
};
|
||||
|
||||
let mut file =
|
||||
fs::File::options().write(true).create(true).open(format!("target/{}", filename))?;
|
||||
fs::File::options().write(true).create(true).open(format!("target/{}.json", name))?;
|
||||
writeln!(file, "{}", metrics.json())?;
|
||||
eprintln!("{metrics:#?}");
|
||||
Ok(())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue