mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-06-13 14:01:01 +00:00
Add expectations tests to the CI action
This commit is contained in:
@@ -41,6 +41,10 @@ inputs:
|
|||||||
description: "The id of the parachain to spawn with the polkadot-omni-node. This is only required if the polkadot-omni-node is one of the selected platforms."
|
description: "The id of the parachain to spawn with the polkadot-omni-node. This is only required if the polkadot-omni-node is one of the selected platforms."
|
||||||
type: number
|
type: number
|
||||||
required: false
|
required: false
|
||||||
|
expectations-file-path:
|
||||||
|
description: "Path to the expectations file to use to compare against."
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
@@ -79,6 +83,12 @@ runs:
|
|||||||
run: |
|
run: |
|
||||||
${{ inputs['cargo-command'] }} build --locked --profile release -p pallet-revive-eth-rpc -p revive-dev-node --manifest-path ${{ inputs['polkadot-sdk-path'] }}/Cargo.toml
|
${{ inputs['cargo-command'] }} build --locked --profile release -p pallet-revive-eth-rpc -p revive-dev-node --manifest-path ${{ inputs['polkadot-sdk-path'] }}/Cargo.toml
|
||||||
${{ inputs['cargo-command'] }} build --locked --profile release --bin polkadot-omni-node --manifest-path ${{ inputs['polkadot-sdk-path'] }}/Cargo.toml
|
${{ inputs['cargo-command'] }} build --locked --profile release --bin polkadot-omni-node --manifest-path ${{ inputs['polkadot-sdk-path'] }}/Cargo.toml
|
||||||
|
- name: Installing retester
|
||||||
|
shell: bash
|
||||||
|
run: ${{ inputs['cargo-command'] }} install --path ./revive-differential-tests/crates/core
|
||||||
|
- name: Installing report-processor
|
||||||
|
shell: bash
|
||||||
|
run: ${{ inputs['cargo-command'] }} install --path ./revive-differential-tests/crates/report-processor
|
||||||
- name: Running the Differential Tests
|
- name: Running the Differential Tests
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -96,7 +106,7 @@ runs:
|
|||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${{ inputs['cargo-command'] }} run --locked --manifest-path revive-differential-tests/Cargo.toml -- test \
|
retester test \
|
||||||
--test ./revive-differential-tests/resolc-compiler-tests/fixtures/solidity/simple \
|
--test ./revive-differential-tests/resolc-compiler-tests/fixtures/solidity/simple \
|
||||||
--test ./revive-differential-tests/resolc-compiler-tests/fixtures/solidity/complex \
|
--test ./revive-differential-tests/resolc-compiler-tests/fixtures/solidity/complex \
|
||||||
--test ./revive-differential-tests/resolc-compiler-tests/fixtures/solidity/translated_semantic_tests \
|
--test ./revive-differential-tests/resolc-compiler-tests/fixtures/solidity/translated_semantic_tests \
|
||||||
@@ -110,22 +120,22 @@ runs:
|
|||||||
--eth-rpc.path ${{ inputs['polkadot-sdk-path'] }}/target/release/eth-rpc \
|
--eth-rpc.path ${{ inputs['polkadot-sdk-path'] }}/target/release/eth-rpc \
|
||||||
--polkadot-omni-node.path ${{ inputs['polkadot-sdk-path'] }}/target/release/polkadot-omni-node \
|
--polkadot-omni-node.path ${{ inputs['polkadot-sdk-path'] }}/target/release/polkadot-omni-node \
|
||||||
--resolc.path ./resolc \
|
--resolc.path ./resolc \
|
||||||
"${OMNI_ARGS[@]}"
|
--report.file-name ${{ inputs['platform'] }}.json \
|
||||||
- name: Creating a markdown report of the test execution
|
"${OMNI_ARGS[@]}" || true
|
||||||
|
- name: Generate the expectation file
|
||||||
shell: bash
|
shell: bash
|
||||||
if: ${{ always() }}
|
run: report-processor --report-path ./revive-differential-tests/workdir/${{ inputs['platform'] }}.json --output-path ${{ inputs['platform'] }}.json --remove-prefix ./revive-differential-tests/resolc-compiler-tests
|
||||||
run: |
|
|
||||||
mv ./workdir/*.json report.json
|
|
||||||
python3 revive-differential-tests/scripts/process-differential-tests-report.py report.json ${{ inputs['platform'] }}
|
|
||||||
- name: Upload the Report to the CI
|
- name: Upload the Report to the CI
|
||||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
|
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
|
||||||
if: ${{ always() }}
|
|
||||||
with:
|
with:
|
||||||
name: report-${{ inputs['platform'] }}.md
|
name: ${{ inputs['platform'] }}-report.json
|
||||||
path: report.md
|
path: ./revive-differential-tests/workdir/${{ inputs['platform'] }}.json
|
||||||
- name: Posting the report as a comment on the PR
|
- name: Upload the Report to the CI
|
||||||
uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405
|
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
|
||||||
if: ${{ always() }}
|
|
||||||
with:
|
with:
|
||||||
header: diff-tests-report-${{ inputs['platform'] }}
|
name: ${{ inputs['platform'] }}.json
|
||||||
path: report.md
|
path: ./${{ inputs['platform'] }}.json
|
||||||
|
- name: Check Expectations
|
||||||
|
shell: bash
|
||||||
|
if: ${{ inputs['expectations-file-path'] != '' }}
|
||||||
|
run: report-processor compare-expectation-files --base-expectation-path ${{ inputs['expectations-file-path'] }} --other-expectation-path ${{ inputs['platform'] }}.json
|
||||||
|
|||||||
@@ -1113,6 +1113,10 @@ pub struct ReportConfiguration {
|
|||||||
/// Controls if the compiler output is included in the final report.
|
/// Controls if the compiler output is included in the final report.
|
||||||
#[clap(long = "report.include-compiler-output")]
|
#[clap(long = "report.include-compiler-output")]
|
||||||
pub include_compiler_output: bool,
|
pub include_compiler_output: bool,
|
||||||
|
|
||||||
|
/// The filename to use for the report.
|
||||||
|
#[clap(long = "report.file-name")]
|
||||||
|
pub file_name: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Parser, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Parser, Serialize, Deserialize)]
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ pub struct ReportAggregator {
|
|||||||
runner_tx: Option<UnboundedSender<RunnerEvent>>,
|
runner_tx: Option<UnboundedSender<RunnerEvent>>,
|
||||||
runner_rx: UnboundedReceiver<RunnerEvent>,
|
runner_rx: UnboundedReceiver<RunnerEvent>,
|
||||||
listener_tx: Sender<ReporterEvent>,
|
listener_tx: Sender<ReporterEvent>,
|
||||||
|
/* Context */
|
||||||
|
file_name: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ReportAggregator {
|
impl ReportAggregator {
|
||||||
@@ -43,6 +45,11 @@ impl ReportAggregator {
|
|||||||
let (runner_tx, runner_rx) = unbounded_channel::<RunnerEvent>();
|
let (runner_tx, runner_rx) = unbounded_channel::<RunnerEvent>();
|
||||||
let (listener_tx, _) = channel::<ReporterEvent>(0xFFFF);
|
let (listener_tx, _) = channel::<ReporterEvent>(0xFFFF);
|
||||||
Self {
|
Self {
|
||||||
|
file_name: match context {
|
||||||
|
Context::Test(ref context) => context.report_configuration.file_name.clone(),
|
||||||
|
Context::Benchmark(ref context) => context.report_configuration.file_name.clone(),
|
||||||
|
Context::ExportJsonSchema | Context::ExportGenesis(..) => None,
|
||||||
|
},
|
||||||
report: Report::new(context),
|
report: Report::new(context),
|
||||||
remaining_cases: Default::default(),
|
remaining_cases: Default::default(),
|
||||||
runner_tx: Some(runner_tx),
|
runner_tx: Some(runner_tx),
|
||||||
@@ -121,7 +128,7 @@ impl ReportAggregator {
|
|||||||
self.handle_completion(CompletionEvent {});
|
self.handle_completion(CompletionEvent {});
|
||||||
debug!("Report aggregation completed");
|
debug!("Report aggregation completed");
|
||||||
|
|
||||||
let file_name = {
|
let default_file_name = {
|
||||||
let current_timestamp = SystemTime::now()
|
let current_timestamp = SystemTime::now()
|
||||||
.duration_since(UNIX_EPOCH)
|
.duration_since(UNIX_EPOCH)
|
||||||
.context("System clock is before UNIX_EPOCH; cannot compute report timestamp")?
|
.context("System clock is before UNIX_EPOCH; cannot compute report timestamp")?
|
||||||
@@ -130,6 +137,7 @@ impl ReportAggregator {
|
|||||||
file_name.push_str(".json");
|
file_name.push_str(".json");
|
||||||
file_name
|
file_name
|
||||||
};
|
};
|
||||||
|
let file_name = self.file_name.unwrap_or(default_file_name);
|
||||||
let file_path = self
|
let file_path = self
|
||||||
.report
|
.report
|
||||||
.context
|
.context
|
||||||
|
|||||||
Reference in New Issue
Block a user