|
| 1 | +name: Snapshot CI |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + generate_artifacts: |
| 7 | + description: 'Generate and upload build artifacts' |
| 8 | + required: true |
| 9 | + default: false |
| 10 | + type: boolean |
| 11 | + schedule: |
| 12 | + - cron: '30 3 * * *' |
| 13 | + |
| 14 | +jobs: |
| 15 | + build_powsybl_metrix: |
| 16 | + name: Build Java ${{ matrix.os }} |
| 17 | + runs-on: ${{ matrix.os }} |
| 18 | + strategy: |
| 19 | + matrix: |
| 20 | + os: [ ubuntu-latest, windows-latest, macos-latest ] |
| 21 | + fail-fast: false |
| 22 | + defaults: |
| 23 | + run: |
| 24 | + shell: bash |
| 25 | + |
| 26 | + steps: |
| 27 | + - name: Set up JDK 17 |
| 28 | + uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 |
| 29 | + with: |
| 30 | + distribution: 'temurin' |
| 31 | + java-version: '17' |
| 32 | + |
| 33 | + # Define script path variable |
| 34 | + - name: Set up script path |
| 35 | + run: | |
| 36 | + SCRIPTS_PATH="${GITHUB_WORKSPACE}/scripts/.github/workflows/scripts" |
| 37 | + if [[ "${{ matrix.os }}" == "windows-latest" ]]; then |
| 38 | + SCRIPTS_PATH=$(echo "$SCRIPTS_PATH" | sed 's/\\/\//g') |
| 39 | + fi |
| 40 | + echo "SCRIPTS_PATH=$SCRIPTS_PATH" >> $GITHUB_ENV |
| 41 | +
|
| 42 | + # Build powsybl-core on main branch |
| 43 | + - name: Checkout core sources |
| 44 | + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 |
| 45 | + with: |
| 46 | + repository: powsybl/powsybl-core |
| 47 | + ref: main |
| 48 | + path: powsybl-core |
| 49 | + |
| 50 | + - name: Build powsybl-core |
| 51 | + run: mvn -batch-mode --no-transfer-progress clean install -DskipTests |
| 52 | + working-directory: ./powsybl-core |
| 53 | + |
| 54 | + - name: Get powsybl-core version |
| 55 | + run: echo "CORE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV |
| 56 | + working-directory: ./powsybl-core |
| 57 | + |
| 58 | + # Checkout script |
| 59 | + # The script check_integration_branch.sh is located in the workflow folder of the repository |
| 60 | + # It is necessary for checking out the integration branch if it exists |
| 61 | + - name: Checkout script |
| 62 | + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 |
| 63 | + with: |
| 64 | + sparse-checkout: | |
| 65 | + .github |
| 66 | + sparse-checkout-cone-mode: false |
| 67 | + path: scripts |
| 68 | + |
| 69 | + # Build powsybl-metrix |
| 70 | + - name: Checking for powsybl-metrix snapshot branch |
| 71 | + run: ${{ env.SCRIPTS_PATH }}/check_integration_branch.sh "https://github.com/powsybl/powsybl-metrix.git" ${{ env.CORE_VERSION }} |
| 72 | + |
| 73 | + - name: Checkout powsybl-metrix |
| 74 | + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 |
| 75 | + with: |
| 76 | + repository: powsybl/powsybl-metrix |
| 77 | + ref: ${{ env.INTEGRATION_BRANCH }} |
| 78 | + path: powsybl-metrix |
| 79 | + submodules: true |
| 80 | + |
| 81 | + - name: update pom.xml |
| 82 | + run: mvn versions:set-property -Dproperty=powsyblcore.version -DnewVersion=$CORE_VERSION -DgenerateBackupPoms=false |
| 83 | + working-directory: ./powsybl-metrix |
| 84 | + |
| 85 | + - name: Build with Maven (Ubuntu) |
| 86 | + if: matrix.os == 'ubuntu-latest' |
| 87 | + working-directory: ./powsybl-metrix |
| 88 | + run: ./mvnw --batch-mode -Pjacoco install |
| 89 | + |
| 90 | + - name: Build with Maven (Windows) |
| 91 | + if: matrix.os == 'windows-latest' |
| 92 | + working-directory: .\powsybl-metrix |
| 93 | + run: mvnw.cmd --batch-mode install |
| 94 | + shell: cmd |
| 95 | + |
| 96 | + - name: Build with Maven (MacOS) |
| 97 | + if: matrix.os == 'macos-latest' |
| 98 | + working-directory: ./powsybl-metrix |
| 99 | + run: ./mvnw --batch-mode install |
| 100 | + |
| 101 | + - name: Get Maven version |
| 102 | + if: ${{ matrix.os == 'ubuntu-latest' && github.event_name == 'workflow_dispatch' && inputs.generate_artifacts }} |
| 103 | + working-directory: ./powsybl-metrix |
| 104 | + run: echo "MAVEN_PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV |
| 105 | + |
| 106 | + - name: Upload Metrix iTools archive |
| 107 | + if: ${{ matrix.os == 'ubuntu-latest' && github.event_name == 'workflow_dispatch' && inputs.generate_artifacts }} |
| 108 | + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # 4.3.3 |
| 109 | + with: |
| 110 | + name: itools-metrix-${{ env.MAVEN_PROJECT_VERSION }} |
| 111 | + path: ${{ github.workspace }}/powsybl-metrix/metrix-distribution/target/metrix |
| 112 | + |
| 113 | + - name: Install Boost on Ubuntu |
| 114 | + if: ${{ matrix.os == 'ubuntu-latest' }} |
| 115 | + run: | |
| 116 | + sudo apt-get update -y |
| 117 | + sudo apt-get install -y libboost-all-dev |
| 118 | +
|
| 119 | + - name: Configure 3rd parties on Ubuntu |
| 120 | + if: ${{ matrix.os == 'ubuntu-latest' }} |
| 121 | + run: > |
| 122 | + cmake -S $GITHUB_WORKSPACE/powsybl-metrix/metrix-simulator/external -B $GITHUB_WORKSPACE/powsybl-metrix/metrix-simulator/build/external |
| 123 | +
|
| 124 | + - name: Build 3rd parties on Ubuntu |
| 125 | + if: ${{ matrix.os == 'ubuntu-latest' }} |
| 126 | + run: > |
| 127 | + cmake --build $GITHUB_WORKSPACE/powsybl-metrix/metrix-simulator/build/external --parallel 2 |
| 128 | +
|
| 129 | + - name: Configure CMake on Ubuntu |
| 130 | + if: ${{ matrix.os == 'ubuntu-latest' }} |
| 131 | + run: > |
| 132 | + cmake -Wno-dev -S $GITHUB_WORKSPACE/powsybl-metrix/metrix-simulator -B $GITHUB_WORKSPACE/powsybl-metrix/metrix-simulator/build |
| 133 | + -DCMAKE_BUILD_TYPE=Release |
| 134 | + -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/powsybl-metrix/metrix-simulator/build/install |
| 135 | +
|
| 136 | + - name: Build metrix-simulator on Ubuntu |
| 137 | + if: ${{ matrix.os == 'ubuntu-latest' }} |
| 138 | + run: cmake --build $GITHUB_WORKSPACE/powsybl-metrix/metrix-simulator/build --target install --parallel 2 |
| 139 | + |
| 140 | + - name: Tests metrix-simulator on Ubuntu |
| 141 | + if: ${{ matrix.os == 'ubuntu-latest' }} |
| 142 | + run: cd $GITHUB_WORKSPACE/powsybl-metrix/metrix-simulator/build && ctest -j2 --output-on-failure |
| 143 | + |
| 144 | + - name: Upload Metrix Simulator archive |
| 145 | + if: ${{ matrix.os == 'ubuntu-latest' && github.event_name == 'workflow_dispatch' && inputs.generate_artifacts }} |
| 146 | + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # 4.3.3 |
| 147 | + with: |
| 148 | + name: metrix-simulator-ubuntu-${{ env.MAVEN_PROJECT_VERSION }} |
| 149 | + path: | |
| 150 | + powsybl-metrix/metrix-simulator/build/install/bin |
| 151 | + powsybl-metrix/metrix-simulator/build/install/etc |
0 commit comments