From 94e47582a7ac82acc40b0d383ce37e193562130e Mon Sep 17 00:00:00 2001 From: timbrinded <79199034+timbrinded@users.noreply.github.com> Date: Tue, 19 Sep 2023 10:52:44 +0100 Subject: [PATCH] json reports --- .changeset/happy-cars-wonder.md | 9 +++++ .github/workflows/main.yml | 10 ++++++ .../workflows/send-report-action/action.yml | 35 +++++++++++++++++++ test/moonwall.config.json | 4 ++- tsconfig.json | 2 +- 5 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 .changeset/happy-cars-wonder.md create mode 100644 .github/workflows/send-report-action/action.yml diff --git a/.changeset/happy-cars-wonder.md b/.changeset/happy-cars-wonder.md new file mode 100644 index 00000000..bc658a8b --- /dev/null +++ b/.changeset/happy-cars-wonder.md @@ -0,0 +1,9 @@ +--- +"@moonwall/tests": patch +"@moonwall/docs": patch +"@moonwall/cli": patch +"@moonwall/types": patch +"@moonwall/util": patch +--- + +JSON reporting options diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9c0bd05b..ff9d1566 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -166,6 +166,16 @@ jobs: cd test bun moonwall test chopsticks + # disabled until we have an available instance of moonscope running + # - name: Use Send Report Action + # if: always() + # uses: ./.github/send-report-action + # with: + # table: dev_reports + # moonwallenv: moonwall_chopsticks + # report_file_path: tmp/testReports.json + # moonscope: "https://moonscope.boo:3345" + test_readonly: runs-on: ubuntu-latest needs: ["build"] diff --git a/.github/workflows/send-report-action/action.yml b/.github/workflows/send-report-action/action.yml new file mode 100644 index 00000000..14e66339 --- /dev/null +++ b/.github/workflows/send-report-action/action.yml @@ -0,0 +1,35 @@ +# send-report-action/action.yml + +name: 'Send Report Action' +description: 'Send a report using a REST call' +inputs: + moonscope: + description: 'Connection string of the moonscope server' + # e.g. https://moonscope.boo:3002 + required: true + table: + description: 'Table name' + required: true + moonwallenv: + description: 'Moonwall Environment' + required: true + report_file_path: + description: 'Path to the report file' + required: true + default: 'tmp/testReports.json' +runs: + using: "composite" + steps: + - name: Read report file + id: read_file + run: echo "::set-output name=data::$(cat ${{ inputs.report_file_path }})" + shell: bash + + - name: Send REST Call + run: | + curl --location '${{ inputs.report_file_path }}/insert' \ + --header 'moonwallenv: ${{ inputs.moonwallenv }}' \ + --header 'table: ${{ inputs.table }}' \ + --header 'Content-Type: application/json' \ + --data '${{ steps.read_file.outputs.data }}' + shell: bash diff --git a/test/moonwall.config.json b/test/moonwall.config.json index 6fb8b413..89acbbc9 100644 --- a/test/moonwall.config.json +++ b/test/moonwall.config.json @@ -209,6 +209,8 @@ "name": "chopsticks", "testFileDir": ["suites/chopsticks/"], "include": ["**/*basic*"], + "reporters": ["default", "json"], + "reportFile": { "json": "tmp/testResults.json" }, "foundation": { "type": "chopsticks", "rtUpgradePath": "./tmp/moonriver_runtime.compact.compressed.wasm", @@ -535,7 +537,7 @@ "testFileDir": ["suites/dev_tests"], "envVars": ["DEBUG_COLORS=1", "TIMBO_TEST_ENV='TIMBO timbo timbo'"], "reporters": ["default", "html", "json"], - "reportFile": { "json": "tmp/report444.json" }, + "reportFile": { "json": "tmp/testResults.json" }, "contracts": "contracts/", "runScripts": ["compile-contracts.ts compile -p contracts/precompiles"], "defaultSigner": { diff --git a/tsconfig.json b/tsconfig.json index a23a2e95..8d312cc1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -20,5 +20,5 @@ "noUncheckedIndexedAccess": true, "strict": false //renable this oneday }, - "exclude": ["test/**", "**/dist/**", "./packages/*/*.d.ts", "./packages/*/*.d.cts"] + "exclude": ["**/dist/**", "./packages/*/*.d.ts", "./packages/*/*.d.cts", "node_modules"] }