GitHub Actions: Add apt mirror to make package download more robust

- Download of Ubuntu packages from Azure is unstable. Add mirror sites to improve reliability.
- Improve use of clang-format and include source code changes
This commit is contained in:
Magne Sjaastad 2023-02-07 07:22:57 +01:00
parent 63bc352a2b
commit c4993b6869
11 changed files with 46 additions and 21 deletions

View File

@ -12,6 +12,15 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Set apt mirror
# see https://github.com/actions/runner-images/issues/7048
if: "contains( matrix.os, 'ubuntu')"
run: |
# make sure there is a `\t` between URL and `priority:*` attributes
printf 'http://azure.archive.ubuntu.com/ubuntu priority:1\n' | sudo tee /etc/apt/mirrors.txt
curl http://mirrors.ubuntu.com/mirrors.txt | sudo tee --append /etc/apt/mirrors.txt
sudo sed -i 's/http:\/\/azure.archive.ubuntu.com\/ubuntu\//mirror+file:\/etc\/apt\/mirrors.txt/' /etc/apt/sources.list
- name: Install Linux dependencies - name: Install Linux dependencies
if: "contains( matrix.os, 'ubuntu')" if: "contains( matrix.os, 'ubuntu')"
run: | run: |

View File

@ -132,6 +132,15 @@ jobs:
run: echo "${{github.workspace}}/buildcache/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 run: echo "${{github.workspace}}/buildcache/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
shell: pwsh shell: pwsh
- name: Set apt mirror
# see https://github.com/actions/runner-images/issues/7048
if: "contains( matrix.config.os, 'ubuntu')"
run: |
# make sure there is a `\t` between URL and `priority:*` attributes
printf 'http://azure.archive.ubuntu.com/ubuntu priority:1\n' | sudo tee /etc/apt/mirrors.txt
curl http://mirrors.ubuntu.com/mirrors.txt | sudo tee --append /etc/apt/mirrors.txt
sudo sed -i 's/http:\/\/azure.archive.ubuntu.com\/ubuntu\//mirror+file:\/etc\/apt\/mirrors.txt/' /etc/apt/sources.list
- name: Install Linux dependencies - name: Install Linux dependencies
if: "contains( matrix.config.os, 'ubuntu')" if: "contains( matrix.config.os, 'ubuntu')"
run: | run: |

View File

@ -6,25 +6,34 @@ jobs:
clang-format-job: clang-format-job:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- name: Set apt mirror
# GitHub Actions apt proxy is super unstable
# see https://github.com/actions/runner-images/issues/7048
run: |
# make sure there is a `\t` between URL and `priority:*` attributes
printf 'http://azure.archive.ubuntu.com/ubuntu priority:1\n' | sudo tee /etc/apt/mirrors.txt
curl http://mirrors.ubuntu.com/mirrors.txt | sudo tee --append /etc/apt/mirrors.txt
sudo sed -i 's/http:\/\/azure.archive.ubuntu.com\/ubuntu\//mirror+file:\/etc\/apt\/mirrors.txt/' /etc/apt/sources.list
- name: Install clang-format 10.0 - name: Install clang-format 10.0
run: | run: |
sudo apt install --option="APT::Acquire::Retries=3" clang-format sudo apt-get install --option="APT::Acquire::Retries=3" clang-format-10
clang-format --version clang-format-10 --version
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Check format - ApplicationLibCode - name: Check format - ApplicationLibCode
run: | run: |
cd ApplicationLibCode cd ApplicationLibCode
find -name *.h -o -name *.cpp -o -name *.inl | xargs clang-format -i find -name '*.h' -o -name '*.cpp' -o -name '*.inl' | xargs clang-format-10 -i
git diff git diff
- name: Check format - ApplicationExeCode - name: Check format - ApplicationExeCode
run: | run: |
cd ApplicationExeCode cd ApplicationExeCode
find -name *.h -o -name *.cpp -o -name *.inl | xargs clang-format -i find -name '*.h' -o -name '*.cpp' -o -name '*.inl' | xargs clang-format-10 -i
git diff git diff
- name: Check format - AppFwk - name: Check format - AppFwk
run: | run: |
cd Fwk/AppFwk cd Fwk/AppFwk
find -name *.h -o -name *.cpp -o -name *.inl | grep -v gtest | xargs clang-format -i find -name '*.h' -o -name '*.cpp' -o -name '*.inl' | grep -v gtest | xargs clang-format-10 -i
git diff git diff
- uses: peter-evans/create-pull-request@v4 - uses: peter-evans/create-pull-request@v4
with: with:

View File

@ -22,8 +22,6 @@
#include <QString> #include <QString>
namespace RiaDefines namespace RiaDefines
{ {
QString leakoffPressureDropResultName(); QString leakoffPressureDropResultName();

View File

@ -30,9 +30,9 @@ class RicMswSegmentCellIntersection
{ {
public: public:
RicMswSegmentCellIntersection( const QString& gridName, // Pass in empty string for main grid RicMswSegmentCellIntersection( const QString& gridName, // Pass in empty string for main grid
size_t globalCellIndex, size_t globalCellIndex,
const cvf::Vec3st& gridLocalCellIJK, const cvf::Vec3st& gridLocalCellIJK,
const cvf::Vec3d& lengthsInCell ); const cvf::Vec3d& lengthsInCell );
const QString& gridName() const; const QString& gridName() const;
size_t globalCellIndex() const; size_t globalCellIndex() const;
cvf::Vec3st gridLocalCellIJK() const; cvf::Vec3st gridLocalCellIJK() const;

View File

@ -117,10 +117,11 @@ public:
int priority() const int priority() const
{ {
return type == RigCompletionData::CompletionType::FRACTURE ? 1 return type == RigCompletionData::CompletionType::FRACTURE
: type == RigCompletionData::CompletionType::FISHBONES ? 2 ? 1
: type == RigCompletionData::CompletionType::PERFORATION ? 3 : type == RigCompletionData::CompletionType::FISHBONES
: 4; ? 2
: type == RigCompletionData::CompletionType::PERFORATION ? 3 : 4;
} }
// Sort by priority, then name, then number // Sort by priority, then name, then number

View File

@ -23,7 +23,6 @@
#include <limits> #include <limits>
#include <utility> #include <utility>
#include <vector> #include <vector>
#include <limits>
#include <QString> #include <QString>

View File

@ -71,7 +71,7 @@ protected:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
caf::PdmFieldHandle* userDescriptionField() override; caf::PdmFieldHandle* userDescriptionField() override;
caf::PdmFieldHandle* objectToggleField() override; caf::PdmFieldHandle* objectToggleField() override;
void defineEditorAttribute( const caf::PdmFieldHandle* field, void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName, QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override; caf::PdmUiEditorAttribute* attribute ) override;

View File

@ -43,7 +43,7 @@ public:
protected: protected:
caf::PdmFieldHandle* objectToggleField() override; caf::PdmFieldHandle* objectToggleField() override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
void initAfterRead() override; void initAfterRead() override;
private: private:
caf::PdmField<bool> m_isActive; caf::PdmField<bool> m_isActive;

View File

@ -62,9 +62,9 @@ inline Opm::FlowDiagnostics::ConnectionValues
{ {
using ConnVals = Opm::FlowDiagnostics::ConnectionValues; using ConnVals = Opm::FlowDiagnostics::ConnectionValues;
auto flux = ConnVals( ConnVals::NumConnections{G.numConnections()}, ConnVals::NumPhases{actPh.size()} ); auto flux = ConnVals( ConnVals::NumConnections{ G.numConnections() }, ConnVals::NumPhases{ actPh.size() } );
auto phas = ConnVals::PhaseID{0}; auto phas = ConnVals::PhaseID{ 0 };
for ( const auto& p : actPh ) for ( const auto& p : actPh )
{ {
@ -74,7 +74,7 @@ inline Opm::FlowDiagnostics::ConnectionValues
{ {
assert( pflux.size() == flux.numConnections() ); assert( pflux.size() == flux.numConnections() );
auto conn = ConnVals::ConnID{0}; auto conn = ConnVals::ConnID{ 0 };
for ( const auto& v : pflux ) for ( const auto& v : pflux )
{ {
flux( conn, phas ) = v; flux( conn, phas ) = v;

View File

@ -22,9 +22,9 @@
#include <QString> #include <QString>
#include <QVector> #include <QVector>
#include <limits>
#include <map> #include <map>
#include <set> #include <set>
#include <limits>
class QwtPlot; class QwtPlot;
class QColor; class QColor;