Skip to content

Commit

Permalink
add pr comments for packages
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed May 15, 2024
1 parent 6f5028a commit cd4196d
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 3 deletions.
49 changes: 47 additions & 2 deletions .github/workflows/osgeo4w.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -104,15 +108,56 @@ 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/
retention-days: 1

- 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
});
}
2 changes: 1 addition & 1 deletion tests/code_layout/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()

Expand Down

0 comments on commit cd4196d

Please sign in to comment.