|
| 1 | +name: Reference generation |
| 2 | + |
| 3 | +on: |
| 4 | + # Manual launch |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + release_tag: |
| 8 | + description: "Release tag" |
| 9 | + required: true |
| 10 | + release_name: |
| 11 | + description: "Release name" |
| 12 | + required: true |
| 13 | + antares_tag: |
| 14 | + description: "Antares_Simulator solver tag" |
| 15 | + default: v9.0.0 |
| 16 | + required: true |
| 17 | + antares_tests_tag: |
| 18 | + description: "Antares_Simulator_Tests_NR" |
| 19 | + default: v9.0.0 |
| 20 | + required: true |
| 21 | + |
| 22 | +jobs: |
| 23 | + release: |
| 24 | + runs-on: ubuntu-latest |
| 25 | + outputs: |
| 26 | + batches: ${{ steps.read_batches.outputs.batches }} |
| 27 | + |
| 28 | + steps: |
| 29 | + - name: Checkout SimTest |
| 30 | + uses: actions/checkout@v4 |
| 31 | + |
| 32 | + - name: Create release |
| 33 | + env: |
| 34 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 35 | + tag: ${{ github.event.inputs.release_tag }} |
| 36 | + title: ${{ github.event.inputs.release_name }} |
| 37 | + antares_tag: ${{ github.event.inputs.antares_tag }} |
| 38 | + antares_tests_tag: ${{ github.event.inputs.antares_tests_tag }} |
| 39 | + run: | |
| 40 | + gh release create "$tag" \ |
| 41 | + --repo="$GITHUB_REPOSITORY" \ |
| 42 | + --title="$title" \ |
| 43 | + --target="$target_branch" \ |
| 44 | + --notes="Antares_Simulator: $antares_tag |
| 45 | + Antares_Simulator_Tests_NR: $antares_tests_tag" |
| 46 | +
|
| 47 | + - name: Download study-batches.txt |
| 48 | + run: | |
| 49 | + wget https://github.com/AntaresSimulatorTeam/Antares_Simulator_Tests_NR/releases/download/${{ github.event.inputs.antares_tests_tag }}/study-batches.txt |
| 50 | +
|
| 51 | + - name: Read study-batches.txt |
| 52 | + id: read_batches |
| 53 | + run: | |
| 54 | + BATCHES=$(printf "\"%s\"," $(cat study-batches.txt) | sed "s/^/[/;s/,$/]/") |
| 55 | + echo "batches=$BATCHES" >> $GITHUB_OUTPUT |
| 56 | +
|
| 57 | + - name: Upload study-batches.txt |
| 58 | + env: |
| 59 | + GITHUB_TOKEN: ${{ github.token }} |
| 60 | + tag: ${{ github.event.inputs.release_tag }} |
| 61 | + run: | |
| 62 | + gh release upload "$tag" study-batches.txt |
| 63 | +
|
| 64 | + generation: |
| 65 | + runs-on: ${{ matrix.os }} |
| 66 | + needs: release |
| 67 | + strategy: |
| 68 | + fail-fast: false |
| 69 | + matrix: |
| 70 | + batch: ${{ fromJson(needs.release.outputs.batches) }} |
| 71 | + os: [ubuntu-22.04, windows-2022] |
| 72 | + |
| 73 | + steps: |
| 74 | + - name: Checkout SimTest |
| 75 | + uses: actions/checkout@v4 |
| 76 | + |
| 77 | + - name: Pre-requisites (Windows) |
| 78 | + if: ${{ startsWith(matrix.os, 'windows') }} |
| 79 | + run: choco install wget zip unzip --no-progress |
| 80 | + |
| 81 | + - name: Download Antares_Simulator archive (Ubuntu) |
| 82 | + if: ${{ startsWith(matrix.os, 'ubuntu') }} |
| 83 | + run: | |
| 84 | + ANTARES_TAG=${{ github.event.inputs.antares_tag }} |
| 85 | + wget https://github.com/AntaresSimulatorTeam/Antares_Simulator/releases/download/${{ github.event.inputs.antares_tag }}/antares-${ANTARES_TAG/v/}-Ubuntu-22.04.tar.gz -O antares_simulator.tar.gz |
| 86 | +
|
| 87 | + - name: Download Antares_Simulator archive (Windows) |
| 88 | + if: ${{ startsWith(matrix.os, 'windows') }} |
| 89 | + run: | |
| 90 | + ANTARES_TAG=${{ github.event.inputs.antares_tag }} |
| 91 | + wget https://github.com/AntaresSimulatorTeam/Antares_Simulator/releases/download/${{ github.event.inputs.antares_tag }}/antares-solver_windows.zip -O antares_simulator.zip |
| 92 | + shell: bash |
| 93 | + |
| 94 | + - name: Unpack Antares_Simulator, clean archive (Ubuntu) |
| 95 | + if: ${{ startsWith(matrix.os, 'ubuntu') }} |
| 96 | + run: | |
| 97 | + tar xf antares_simulator.tar.gz |
| 98 | + rm antares_simulator.tar.gz |
| 99 | +
|
| 100 | + - name: Unpack Antares_Simulator, clean archive (Windows) |
| 101 | + if: ${{ startsWith(matrix.os, 'windows') }} |
| 102 | + run: | |
| 103 | + unzip -q antares_simulator.zip |
| 104 | + rm antares_simulator.zip |
| 105 | +
|
| 106 | + - name: Download Antares_Simulator_Tests |
| 107 | + run: wget https://github.com/AntaresSimulatorTeam/Antares_Simulator_Tests_NR/releases/download/${{ github.event.inputs.antares_tests_tag }}/${{ matrix.batch }}.zip -O input.zip |
| 108 | + |
| 109 | + - name: Unpack test studies, clean archive |
| 110 | + run: | |
| 111 | + unzip -q input.zip |
| 112 | + rm input.zip |
| 113 | +
|
| 114 | + - name: Generate results (Ubuntu) |
| 115 | + if: ${{ startsWith(matrix.os, 'ubuntu') }} |
| 116 | + run: | |
| 117 | + ANTARES_TAG=${{ github.event.inputs.antares_tag }} |
| 118 | + python3 scripts/generate_reference.py ${{ matrix.batch }} antares-${ANTARES_TAG/v/}-Ubuntu-22.04/bin/antares-solver |
| 119 | +
|
| 120 | + - name: Generate results (Windows) |
| 121 | + if: ${{ startsWith(matrix.os, 'windows') }} |
| 122 | + run: | |
| 123 | + ANTARES_TAG=${{ github.event.inputs.antares_tag }} |
| 124 | + python3 scripts/generate_reference.py ${{ matrix.batch }} antares-solver.exe |
| 125 | + shell: bash |
| 126 | + |
| 127 | + - name: Write tags to file |
| 128 | + shell: bash |
| 129 | + run: | |
| 130 | + echo Antares_Simulator ${{ github.event.inputs.antares_tag }} >> ${{ matrix.batch }}/version.txt |
| 131 | + echo Antares_Simulator_Tests_NR ${{ github.event.inputs.antares_tests_tag }} >> ${{ matrix.batch }}/version.txt |
| 132 | + echo SimTest ${{ github.event.inputs.release_tag }} >> ${{ matrix.batch }}/version.txt |
| 133 | +
|
| 134 | + - name: zip results |
| 135 | + run: zip -q -r ${{ matrix.batch }}-${{ matrix.os }}.zip ${{ matrix.batch }} |
| 136 | + |
| 137 | + - name: Upload .zip |
| 138 | + env: |
| 139 | + GITHUB_TOKEN: ${{ github.token }} |
| 140 | + tag: ${{ github.event.inputs.release_tag }} |
| 141 | + shell: bash |
| 142 | + run: | |
| 143 | + gh release upload "$tag" ${{ matrix.batch }}-${{ matrix.os }}.zip |
| 144 | +
|
0 commit comments