Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize GH Actions #78

Merged
merged 5 commits into from
Apr 18, 2024
Merged

Conversation

JostMigenda
Copy link
Collaborator

@JostMigenda JostMigenda commented Apr 17, 2024

  • Update versions of various actions (removes warnings/errors due to deprecated/unsupported versions)
  • Update/remove arguments to some actions, where new versions require it
  • Update gcc, g++ versions under ubuntu-20.04

Copy link

github-actions bot commented Apr 17, 2024

⚡ Code Analysis Results ⚡

🔴 Cppcheck found 18 issues! Click here to see details.

scalars = vtkFloatArray::SafeDownCast(surface->GetVtkPolyData()->GetCellData()->GetScalars());
numObjects = surface->GetVtkPolyData()->GetNumberOfCells();
} else{
// surface->GetVtkPolyData()->GetCellData()->SetActiveScalars(fieldName.toStdString().c_str());
scalars = vtkFloatArray::SafeDownCast(surface->GetVtkPolyData()->GetCellData()->GetScalars());
numObjects = surface->GetVtkPolyData()->GetNumberOfCells();

!Line: 1813 - style: Redundant initialization for 'scalars'. The initialized value is overwritten before it is read. [redundantInitialization]

vtkFloatArray *scalars = vtkFloatArray::New();
vtkIdType numObjects;
std::cout << "fieldName: " << fieldName.toStdString() << '\n';
if (isElem){

!Line: 1806 - note: scalars is initialized

scalars = vtkFloatArray::SafeDownCast(surface->GetVtkPolyData()->GetCellData()->GetScalars());
numObjects = surface->GetVtkPolyData()->GetNumberOfCells();
} else{
// surface->GetVtkPolyData()->GetCellData()->SetActiveScalars(fieldName.toStdString().c_str());
scalars = vtkFloatArray::SafeDownCast(surface->GetVtkPolyData()->GetCellData()->GetScalars());
numObjects = surface->GetVtkPolyData()->GetNumberOfCells();

!Line: 1813 - note: scalars is overwritten

class AtrialFibresClipperView : public QmitkAbstractView {
// this is needed for all Qt objects that should have a Qt meta-object
// (everything that derives from QObject and wants to have signal/slots)
Q_OBJECT

!Line: 55 - style: The class 'AtrialFibresClipperView' does not have a constructor although it has private member variables. [noConstructor]

class AtrialFibresView : public QmitkAbstractView {
// this is needed for all Qt objects that should have a Qt meta-object
// (everything that derives from QObject and wants to have signal/slots)
Q_OBJECT

!Line: 66 - style: The class 'AtrialFibresView' does not have a constructor although it has private member variables. [noConstructor]

radii = vtkDoubleArray::SafeDownCast(line->GetPointData()->GetArray("MaximumInscribedSphereRadius"));
double adjust = ctrPlane->GetRadius() / radii->GetValue(position);
//Adjust highlighted clipper
for (unsigned int i=0; i<clipperActors.size(); i++)
clipperActors.at(i)->GetProperty()->SetOpacity(i==(unsigned)index ? 1.0 : 0.1);

!Line: 450 - style: Redundant initialization for 'radii'. The initialized value is overwritten before it is read. [redundantInitialization]

vtkSmartPointer<vtkDoubleArray> radii = vtkSmartPointer<vtkDoubleArray>::New();
radii = vtkDoubleArray::SafeDownCast(line->GetPointData()->GetArray("MaximumInscribedSphereRadius"));
double adjust = ctrPlane->GetRadius() / radii->GetValue(position);
//Adjust highlighted clipper
for (unsigned int i=0; i<clipperActors.size(); i++)

!Line: 449 - note: radii is initialized

radii = vtkDoubleArray::SafeDownCast(line->GetPointData()->GetArray("MaximumInscribedSphereRadius"));
double adjust = ctrPlane->GetRadius() / radii->GetValue(position);
//Adjust highlighted clipper
for (unsigned int i=0; i<clipperActors.size(); i++)
clipperActors.at(i)->GetProperty()->SetOpacity(i==(unsigned)index ? 1.0 : 0.1);

!Line: 450 - note: radii is overwritten

class AtrialFibresLandmarksView : public QmitkAbstractView {
// this is needed for all Qt objects that should have a Qt meta-object
// (everything that derives from QObject and wants to have signal/slots)
Q_OBJECT

!Line: 53 - style: The class 'AtrialFibresLandmarksView' does not have a constructor although it has private member variables. [noConstructor]

double distance;
int pickedSeedId = -1;
double minDistance = 1E10;
for (int i=0; i<pickedCellPointIds->GetNumberOfIds(); i++) {
distance = vtkMath::Distance2BetweenPoints(
pickPosition, surface->GetVtkPolyData()->GetPoint(pickedCellPointIds->GetId(i)));

!Line: 392 - style: The scope of the variable 'distance' can be reduced. [variableScope]

class AtrialFibresVisualiseView : public QmitkAbstractView {
// this is needed for all Qt objects that should have a Qt meta-object
// (everything that derives from QObject and wants to have signal/slots)
Q_OBJECT

!Line: 50 - style: The class 'AtrialFibresVisualiseView' does not have a constructor although it has private member variables. [noConstructor]

if(!userInputAccepted){
QDialog* inputs = new QDialog(0,0);
m_UIEditLabels.setupUi(inputs);
connect(m_UIEditLabels.buttonBox, SIGNAL(accepted()), inputs, SLOT(accept()));
connect(m_UIEditLabels.buttonBox, SIGNAL(rejected()), inputs, SLOT(reject()));
std::cout << "WHICH ATRIUM: " << uac_whichAtrium.toStdString() << '\n';

!Line: 1795 - style: Condition '!userInputAccepted' is always true [knownConditionTrueFalse]

bool userInputAccepted=false;
if(!userInputAccepted){
QDialog* inputs = new QDialog(0,0);
m_UIEditLabels.setupUi(inputs);
connect(m_UIEditLabels.buttonBox, SIGNAL(accepted()), inputs, SLOT(accept()));

!Line: 1793 - note: Assignment 'userInputAccepted=false', assigned value is 0

if(!userInputAccepted){
QDialog* inputs = new QDialog(0,0);
m_UIEditLabels.setupUi(inputs);
connect(m_UIEditLabels.buttonBox, SIGNAL(accepted()), inputs, SLOT(accept()));
connect(m_UIEditLabels.buttonBox, SIGNAL(rejected()), inputs, SLOT(reject()));
std::cout << "WHICH ATRIUM: " << uac_whichAtrium.toStdString() << '\n';

!Line: 1795 - note: Condition '!userInputAccepted' is always true

segImage = atrium->LoadImage(segRegPath);
resultString = segRegPath;
tagName += "-reg";
SetLgeAnalysis(true);

!Line: 2340 - style: Variable 'segImage' is assigned a value that is never used. [unreadVariable]

reply1 = Ask("Question", "Use alternative DICOM reader?");
#endif
if (reply1 == QMessageBox::Yes) {
QString dicomFolder = QFileDialog::getExistingDirectory(NULL, "Open folder with DICOMs.", mitk::IOUtil::GetProgramPath().c_str(), QFileDialog::ShowDirsOnly|QFileDialog::DontUseNativeDialog);

!Line: 193 - style: Redundant initialization for 'reply1'. The initialized value is overwritten before it is read. [redundantInitialization]

int reply1 = QMessageBox::No;
#if defined(__APPLE__)
MITK_INFO << "Ask user about alternative DICOM reader";
reply1 = Ask("Question", "Use alternative DICOM reader?");
#endif

!Line: 190 - note: reply1 is initialized

reply1 = Ask("Question", "Use alternative DICOM reader?");
#endif
if (reply1 == QMessageBox::Yes) {
QString dicomFolder = QFileDialog::getExistingDirectory(NULL, "Open folder with DICOMs.", mitk::IOUtil::GetProgramPath().c_str(), QFileDialog::ShowDirsOnly|QFileDialog::DontUseNativeDialog);

!Line: 193 - note: reply1 is overwritten


@JostMigenda
Copy link
Collaborator Author

The test action runs much farther now, which is nice to see; but the build step still fails with some references to gcc-6 and g++-6, even though I’ve eliminated those from all .yml files. So I’m not quite sure where that comes … unless it is in the precompiled Build folder that it’s downloading in the first step? 🤔

On a separate note: I notice that test.yml is currently set to run on: [push, pull_request]; which means it runs twice when I push a new commit to an open PR, which is wasteful. I’d therefore suggest changing it to only run on PRs?

@alonsoJASL
Copy link
Collaborator

The test action runs much farther now, which is nice to see; but the build step still fails with some references to gcc-6 and g++-6, even though I’ve eliminated those from all .yml files. So I’m not quite sure where that comes … unless it is in the precompiled Build folder that it’s downloading in the first step? 🤔

On a separate note: I notice that test.yml is currently set to run on: [push, pull_request]; which means it runs twice when I push a new commit to an open PR, which is wasteful. I’d therefore suggest changing it to only run on PRs?

Thank you Jost, these are great updates.

I agree that, as you mention, the references to older gcc versions would come from the prebuild folders downloaded. The solution would be to make these for the right versions. So, one in macOS, one in Ubuntu and one in Windows. These prebuild folders would be generated once we confirm the build instructions. So that's on my plate at the moment.

I'll accept the merge and we can pause till I provide the build folders. A question, we would need an intel mac and an arm mac prebuild folder, in case we manage arm, right?

@alonsoJASL alonsoJASL merged commit 9947f26 into development Apr 18, 2024
1 of 3 checks passed
@JostMigenda
Copy link
Collaborator Author

I'll accept the merge and we can pause till I provide the build folders. A question, we would need an intel mac and an arm mac prebuild folder, in case we manage arm, right?

Not necessarily. In principle, Qt versions that support ARM Macs also support cross builds or universal binaries; but how well that works in practice remains to be seen after we’ve upgraded Qt to a more recent version.

@JostMigenda JostMigenda deleted the actions/node20-updates-and-more branch May 8, 2024 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants