From bbad3f8c7e8e1ed67ee65efdb0156bbc6780c2b2 Mon Sep 17 00:00:00 2001 From: "Juergen E. Fischer" Date: Tue, 14 May 2024 22:15:48 +0200 Subject: [PATCH] add pr comments for packages --- .github/workflows/osgeo4w.yml | 49 ++++++++++++++++++++++++++++++-- tests/code_layout/CMakeLists.txt | 2 +- 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/.github/workflows/osgeo4w.yml b/.github/workflows/osgeo4w.yml index deccc879a0c6..6c178e524908 100644 --- a/.github/workflows/osgeo4w.yml +++ b/.github/workflows/osgeo4w.yml @@ -26,6 +26,7 @@ permissions: env: REPO: ${{ github.server_url }}/${{ github.repository }} + CTEST_CUSTOM_TESTS_IGNORE: 'ProcessingQgisAlgorithmsTestPt1;ProcessingQgisAlgorithmsTestPt2;ProcessingQgisAlgorithmsTestPt3;ProcessingQgisAlgorithmsTestPt4;ProcessingQgisAlgorithmsTestPt5;ProcessingGdalAlgorithmsRasterTest;ProcessingGdalAlgorithmsVectorTest;ProcessingScriptUtilsTest;ProcessingGrassAlgorithmsImageryTest;ProcessingGrassAlgorithmsRasterTestPt1;ProcessingGrassAlgorithmsRasterTestPt2;ProcessingGrassAlgorithmsVectorTest;test_core_browsermodel;test_core_callout;test_core_compositionconverter;test_core_diagram;test_core_dxfexport;test_core_expression;test_core_fontmarker;test_core_gdalprovider;test_core_imagecache;test_core_labelingengine;test_core_layoutlabel;test_core_layoutmanualtable;test_core_layoutmap;test_core_layoutmapgrid;test_core_layoutpicture;test_core_layoutscalebar;test_core_layouttable;test_core_legendrenderer;test_core_linefillsymbol;test_core_maprendererjob;test_core_maprotation;test_core_mapsettingsutils;test_core_mesheditor;test_core_meshlayer;test_core_pallabeling;test_core_project;test_core_svgcache;test_core_svgmarker;test_core_tiledownloadmanager;test_core_vectorfilewriter;test_core_vectortilelayer;test_core_layouthtml;test_core_openclutils;test_gui_attributeform;test_gui_processinggui;test_gui_filedownloader;test_gui_ogrprovidergui;test_gui_externalresourcewidgetwrapper;test_gui_queryresultwidget;test_gui_rasterlayersaveasdialog;test_3d_3dcameracontroller;test_3d_3drendering;test_3d_layout3dmap;test_3d_mesh3drendering;test_3d_pointcloud3drendering;test_analysis_processingalgspt1;test_analysis_processingalgspt2;test_analysis_processingmodelalgorithm;test_analysis_processing;test_provider_wcsprovider;test_provider_wmsprovider;test_provider_copcprovider;qgis_grassprovidertest8;test_app_qgisappclipboard;test_app_measurebearingtool;test_app_vertextool;PyQgsAnnotationLineTextItem;PyQgsAnnotationPointTextItem;PyQgsBlockingProcess;PyQgsCesium3dTilesLayer;PyQgsColorRampLegendNode;PyQgsDelimitedTextProvider;PyQgsExifTools;PyQgsExternalStorageWebDAV;PyQgsExternalStorageAWSS3;PyQgsFontManager;PyQgsProject;PyQgsFileUtils;PyQgsGeometryGeneratorSymbolLayer;PyQgsGeometryTest;PyQgsGoogleMapsGeocoder;PyQgsGpxProvider;PyQgsLayoutAtlas;PyQgsLayoutElevationProfile;PyQgsLayoutLegend;PyQgsLayoutMap;PyQgsLayoutMapGrid;PyQgsLineSymbolLayers;PyQgsMapLayer;PyQgsOGRProviderGpkg;PyQgsOrientedBox3D;PyQgsPalLabelingCanvas;PyQgsPalLabelingLayout;PyQgsPalLabelingPlacement;PyQgsPlot;PyQgsPointCloudAttributeByRampRenderer;PyQgsPointCloudClassifiedRenderer;PyQgsPointCloudRgbRenderer;PyQgsPointDisplacementRenderer;PyQgsProcessExecutablePt2;PyQgsProcessingPackageLayersAlgorithm;PyQgsProfileExporter;PyQgsProviderConnectionSpatialite;TestQgsRandomMarkerSymbolLayer;PyQgsRasterAttributeTable;PyQgsRasterFileWriter;PyQgsRasterLayer;PyQgsRasterResampler;PyQgsSvgCache;PyQgsTextRenderer;PyQgsSensorThingsProvider;PyQgsExternalStorageSimpleCopy;PyQgsSpatialiteProvider;PyQgsTiledSceneRender;PyQgsVectorFileWriter;PyQgsVectorLayerCache;PyQgsVectorLayerEditBuffer;PyQgsVectorLayerProfileGenerator;PyQgsVirtualLayerProvider;PyQgsSettings;PyQgsSettingsEntry;PyQgsSettingsTreeNode;PyQgsZipUtils;PyQgsAuthManagerProxy;PyQgsAuxiliaryStorage;PyQgsSelectiveMasking;PyQgsAuthSettingsWidget;PyQgsOGRProvider;PyQgsWFSProviderGUI;PyQgsAnnotation;PyQgsAuthenticationSystem;PyQgsProjectionSelectionWidgets;PyQgsRasterLayerProperties;PyQgsVectorLayer;PyQgsServer;PyQgsServerWMS;PyQgsServerApi;PyQgsServerWMSGetFeatureInfo;PyQgsServerWMSGetMap;PyQgsServerWMSGetMapDxf;PyQgsServerWMSGetLegendGraphic;PyQgsServerWMSGetPrint;PyQgsServerWMSGetPrintExtra;PyQgsServerWMSGetPrintOutputs;PyQgsServerWMSGetPrintAtlas;PyQgsServerWMSGetPrintMapTheme;PyQgsServerWMSDimension;PyQgsServerSettings;PyQgsServerSecurity;PyQgsServerCacheManager;PyQgsServerWMTS;PyQgsServerWFS;PyQgsServerLocaleOverride;PyQgsOfflineEditingWFS;PyQgsAuthManagerPasswordOWSTest;PyQgsAuthManagerPKIOWSTest;PyQgsAuthManagerOAuth2OWSTest;PyQgsServerRequest' jobs: osgeo4w-packages: @@ -75,6 +76,9 @@ jobs: strategy: matrix: ${{ fromJson(needs.osgeo4w-packages.outputs.matrix) }} + permissions: + pull-requests: write + steps: - name: Restore build cache uses: actions/cache/restore@v4 @@ -104,7 +108,8 @@ jobs: %GITHUB_WORKSPACE%\scripts\ccache -sv - - uses: actions/upload-artifact@v4 + - id: upload + uses: actions/upload-artifact@v4 with: name: ${{ matrix.pkg }} path: x86_64/ @@ -112,7 +117,47 @@ jobs: - name: Save build cache for push only uses: actions/cache/save@v4 - if: ${{ github.event_name == 'push' }} + if: github.event_name == 'push' with: path: ccache key: build-ccache-osgeo4w-${{ matrix.pkg }}-${{ github.ref_name }}-${{ github.run_id }} + + - run: npm install xml-js + if: github.event_name == 'pull_request' + - name: 'Post artifact download link and test results as comment on PR' + uses: actions/github-script@v7 + if: github.event_name == 'pull_request' + with: + script: | + let fs = require('fs'); + let tag = String(fs.readFileSync("src/${{ matrix.pkg }}/osgeo4w/build/Testing/TAG")).split("\r\n")[0] + let buildId = require('xml-js').xml2js(fs.readFileSync("src/${{ matrix.pkg }}/osgeo4w/build/Testing/" + tag + "/Done.xml"), {compact:true, ignoreDeclaration:true})['Done']['buildId']['_text'] + + const prComments = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number + }); + const PREFIX = "## OSGeo4W package ${{ matrix.pkg }} ready!"; + let body = PREFIX + "\n\n" + "Package repository archive of this PR is available for testing [here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/${{ steps.upload.outputs.artifact-id }})."; + body += "\n\n*(Built from commit ${{ github.event.pull_request.head.sha }})*\n"; + body += "\n\n*(Test results are [here](https://cdash.orfeo-toolbox.org/viewTest.php?buildid=" + buildId + "))*"; + + const winBuildComment = prComments.data?.find(c => c.body.startsWith(PREFIX)); + if (!!winBuildComment) { + // update the existing comment + await github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: winBuildComment.id, + body: body + }); + } else { + // submit a new comment + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: body + }); + } diff --git a/tests/code_layout/CMakeLists.txt b/tests/code_layout/CMakeLists.txt index 35f5fa28c479..ec46beccc63a 100644 --- a/tests/code_layout/CMakeLists.txt +++ b/tests/code_layout/CMakeLists.txt @@ -1,6 +1,6 @@ # TESTSRC is relative to ${CMAKE_SOURCE_DIR} macro (add_qgis_test_script TESTNAME TESTSRC) - add_test(${TESTNAME} ${CMAKE_SOURCE_DIR}/${TESTSRC}) + add_test(NAME ${TESTNAME} COMMAND sh ${CMAKE_SOURCE_DIR}/${TESTSRC}) set_tests_properties(${TESTNAME} PROPERTIES FIXTURES_REQUIRED SOURCETREE) endmacro()