|
| 1 | +name: "Branch next: Docker" |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [next] |
| 6 | + push: |
| 7 | + branches: [next] |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + prepare: |
| 15 | + name: Prepare |
| 16 | + runs-on: ubuntu-slim |
| 17 | + outputs: |
| 18 | + base_sha: ${{ steps.checkout.outputs.base_sha }} |
| 19 | + mpi_version: ${{ steps.get_packages.outputs.mpi_version }} |
| 20 | + mpi_changed: ${{ steps.get_packages.outputs.mpi_changed }} |
| 21 | + petsc_version: ${{ steps.get_packages.outputs.petsc_version }} |
| 22 | + petsc_changed: ${{ steps.get_packages.outputs.petsc_changed }} |
| 23 | + libmesh_version: ${{ steps.get_packages.outputs.libmesh_version }} |
| 24 | + libmesh_changed: ${{ steps.get_packages.outputs.libmesh_changed }} |
| 25 | + moose_dev_version: ${{ steps.get_packages.outputs.moose_dev_version }} |
| 26 | + moose_dev_changed: ${{ steps.get_packages.outputs.moose_dev_changed }} |
| 27 | + steps: |
| 28 | + - uses: idaholab/moose/checkout-event@actions |
| 29 | + name: Checkout |
| 30 | + id: checkout |
| 31 | + - name: Get packages |
| 32 | + shell: bash |
| 33 | + id: get_packages |
| 34 | + run: | |
| 35 | + echo "::group::Install versioner dependencies" |
| 36 | + pip install --no-cache --break-system-packages pyyaml jinja2 |
| 37 | + echo "::endgroup::" |
| 38 | +
|
| 39 | + echo "::group::Parse packages" |
| 40 | + outputs=() |
| 41 | + summary=() |
| 42 | + base_sha="${{ steps.checkout.outputs.base_sha }}" |
| 43 | + packages=("mpi" "petsc" "libmesh" "moose-dev") |
| 44 | + for package in "${packages[@]}"; do |
| 45 | + base_json="$(./scripts/versioner.py "$package" "$base_sha" --json)" |
| 46 | + head_json="$(./scripts/versioner.py "$package" --json)" |
| 47 | + base_version="$(echo "$base_json" | jq -r '.full_version')" |
| 48 | + head_version="$(echo "$head_json" | jq -r '.full_version')" |
| 49 | +
|
| 50 | + package_var="${package//-/_}" |
| 51 | + outputs+=("${package_var}_version=${base_version}") |
| 52 | + if [ "$base_version" != "$head_version" ]; then |
| 53 | + outputs+=("${package_var}_changed=1") |
| 54 | + summary+=("| \`${package}\` | \`${base_version}\` | \`${head_version}\` |") |
| 55 | + else |
| 56 | + outputs+=("${package_var}_changed=") |
| 57 | + fi |
| 58 | + done |
| 59 | + echo "::endgroup::" |
| 60 | +
|
| 61 | + echo "::group::Output step change summary" |
| 62 | + echo "### Changed packages" >> $GITHUB_STEP_SUMMARY |
| 63 | + if (( ${#summary[@]} )); then |
| 64 | + echo "| Package | From version | To version |" >> $GITHUB_STEP_SUMMARY |
| 65 | + echo "| ------- | ------------ | ---------- |" >> $GITHUB_STEP_SUMMARY |
| 66 | + for entry in "${summary[@]}"; do |
| 67 | + echo "$entry" >> $GITHUB_STEP_SUMMARY |
| 68 | + done |
| 69 | + else |
| 70 | + echo "No packages were changed" |
| 71 | + fi |
| 72 | + echo "::endgroup::" |
| 73 | +
|
| 74 | + echo "::group::Output packages" |
| 75 | + for entry in "${outputs[@]}"; do |
| 76 | + echo "$entry" >> $GITHUB_OUTPUT |
| 77 | + echo "$entry" |
| 78 | + done |
| 79 | + echo "::endgroup::" |
| 80 | +
|
| 81 | + # delete_images: |
| 82 | + # name: "Delete images" |
| 83 | + # if: github.event_name == 'pull_request' |
| 84 | + # runs-on: ubuntu-slim |
| 85 | + # permissions: |
| 86 | + # packages: write |
| 87 | + # env: |
| 88 | + # FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true |
| 89 | + # steps: |
| 90 | + # - uses: actions/delete-package-versions@v5 |
| 91 | + # name: Delete pr-moose-mpi |
| 92 | + # with: |
| 93 | + # package-name: moose/pr-moose-mpi |
| 94 | + # package-type: container |
| 95 | + # min-versions-to-keep: 0 |
| 96 | + # ignore-versions: '^(?!pr-${{ github.event.pull_request.number }})' |
| 97 | + # - uses: actions/delete-package-versions@v5 |
| 98 | + # name: Delete pr-moose-petsc-mpich |
| 99 | + # with: |
| 100 | + # owner: ${{ github.repository_owner }} |
| 101 | + # package-name: pr-moose-petsc-mpich |
| 102 | + # package-type: container |
| 103 | + # min-versions-to-keep: 0 |
| 104 | + # ignore-versions: '^(?!pr-${{ github.event.pull_request.number }})' |
| 105 | + # - uses: actions/delete-package-versions@v5 |
| 106 | + # name: Delete pr-moose-libmesh-mpich |
| 107 | + # with: |
| 108 | + # owner: ${{ github.repository_owner }} |
| 109 | + # package-name: pr-moose-libmesh-mpich |
| 110 | + # package-type: container |
| 111 | + # min-versions-to-keep: 0 |
| 112 | + # ignore-versions: '^(?!pr-${{ github.event.pull_request.number }})' |
| 113 | + |
| 114 | + build_moose_mpi_rocky8: |
| 115 | + name: "Build: moose-mpi-rocky8" |
| 116 | + needs: |
| 117 | + - prepare |
| 118 | + if: >- |
| 119 | + !cancelled() |
| 120 | + && contains(fromJSON('["success", "skipped"]'), needs.prepare.result) |
| 121 | + && needs.prepare.outputs.mpi_changed |
| 122 | + outputs: |
| 123 | + tag: ${{ steps.build.outputs.tags }} |
| 124 | + runs-on: ubuntu-latest |
| 125 | + permissions: |
| 126 | + contents: read |
| 127 | + packages: write |
| 128 | + steps: |
| 129 | + - uses: idaholab/moose/checkout-event@actions |
| 130 | + name: Checkout |
| 131 | + with: |
| 132 | + pr_base_sha: ${{ needs.prepare.outputs.base_sha }} |
| 133 | + - uses: ./github/actions/build-docker-mpi |
| 134 | + id: build |
| 135 | + name: Build and push moose-mpi-rocky8 |
| 136 | + with: |
| 137 | + variant: rocky8 |
| 138 | + registry-token: ${{ secrets.GITHUB_TOKEN }} |
| 139 | + |
| 140 | + build_moose_mpi_rocky9: |
| 141 | + name: "Build: moose-mpi-rocky9" |
| 142 | + needs: |
| 143 | + - prepare |
| 144 | + if: >- |
| 145 | + !cancelled() |
| 146 | + && contains(fromJSON('["success", "skipped"]'), needs.prepare.result) |
| 147 | + && needs.prepare.outputs.mpi_changed |
| 148 | + outputs: |
| 149 | + tag: ${{ steps.build.outputs.tags }} |
| 150 | + runs-on: ubuntu-latest |
| 151 | + permissions: |
| 152 | + contents: read |
| 153 | + packages: write |
| 154 | + steps: |
| 155 | + - uses: idaholab/moose/checkout-event@actions |
| 156 | + name: Checkout |
| 157 | + with: |
| 158 | + pr_base_sha: ${{ needs.prepare.outputs.base_sha }} |
| 159 | + - uses: ./github/actions/build-docker-mpi |
| 160 | + id: build |
| 161 | + name: Build and push moose-mpi-rocky9 |
| 162 | + with: |
| 163 | + variant: rocky9 |
| 164 | + registry-token: ${{ secrets.GITHUB_TOKEN }} |
| 165 | + |
| 166 | + # build_moose_dev_mpich: |
| 167 | + # name: "Build: moose-dev-mpich" |
| 168 | + # needs: |
| 169 | + # - prepare |
| 170 | + # - build_moose_mpi |
| 171 | + # if: >- |
| 172 | + # !cancelled() |
| 173 | + # && contains(fromJSON('["success", "skipped"]'), needs.build_moose_mpi.result) |
| 174 | + # && (needs.prepare.outputs.petsc_changed || needs.prepare.outputs.libmesh_changed) |
| 175 | + # runs-on: ubuntu-latest |
| 176 | + # permissions: |
| 177 | + # contents: read |
| 178 | + # packages: write |
| 179 | + # steps: |
| 180 | + # - uses: idaholab/moose/checkout-event@actions |
| 181 | + # name: Checkout |
| 182 | + # id: checkout |
| 183 | + # with: |
| 184 | + # pr_base_sha: ${{ needs.prepare.outputs.base_sha }} |
| 185 | + # - name: Log in to GHCR |
| 186 | + # uses: docker/login-action@v4 |
| 187 | + # with: |
| 188 | + # registry: ghcr.io |
| 189 | + # username: ${{ github.repository_owner }} |
| 190 | + # password: ${{ secrets.GITHUB_TOKEN }} |
| 191 | + # - name: Form moose-petsc-mpich build args |
| 192 | + # id: petsc_build_args |
| 193 | + # if: needs.prepare.outputs.petsc_changed |
| 194 | + # shell: bash |
| 195 | + # run: | |
| 196 | + # petsc_submodule_ref="$(git ls-tree HEAD petsc | awk '{print $3}')" |
| 197 | + # value="build_args=PETSC_GIT_REF=${petsc_submodule_ref}" |
| 198 | + # { |
| 199 | + # echo "build_args<<EOF" |
| 200 | + # echo "PETSC_GIT_REF=${petsc_submodule_ref}" |
| 201 | + # echo "EOF" |
| 202 | + # } >> $GITHUB_OUTPUT |
| 203 | + # - name: Generate moose-petsc-mpich tag |
| 204 | + # if: needs.prepare.outputs.petsc_changed |
| 205 | + # id: petsc_meta |
| 206 | + # uses: docker/metadata-action@v6 |
| 207 | + # with: |
| 208 | + # images: ghcr.io/${{ github.repository }}/pr-moose-petsc-mpich |
| 209 | + # tags: type=ref,event=pr |
| 210 | + # - name: Extract moose-petsc-mpich tag |
| 211 | + # if: needs.prepare.outputs.petsc_changed |
| 212 | + # id: get_petsc_tag |
| 213 | + # run: | |
| 214 | + # echo "tag=$(echo '${{ steps.petsc_meta.outputs.tags }}' | head -n1)" >> $GITHUB_OUTPUT |
| 215 | + # - name: Build moose-petsc-mpich |
| 216 | + # if: needs.prepare.outputs.petsc_changed |
| 217 | + # uses: docker/build-push-action@v7 |
| 218 | + # with: |
| 219 | + # context: ./ |
| 220 | + # file: docker/moose-petsc/Dockerfile |
| 221 | + # build-args: | |
| 222 | + # BASE_IMAGE=${{ needs.build_moose_mpi.outputs.tag }} |
| 223 | + # BUILD_JOBS=4 |
| 224 | + # ${{ steps.petsc_build_args.outputs.build_args }} |
| 225 | + # push: true |
| 226 | + # tags: ${{ steps.petsc_meta.outputs.tags }} |
| 227 | + # - name: Form moose-libmesh build args |
| 228 | + # id: libmesh_build_args |
| 229 | + # if: needs.prepare.outputs.libmesh_changed |
| 230 | + # shell: bash |
| 231 | + # run: | |
| 232 | + # libmesh_submodule_ref="$(git ls-tree HEAD libmesh | awk '{print $3}')" |
| 233 | + # value="build_args=LIBMESH_GIT_REF=${libmesh_submodule_ref}" |
| 234 | + # { |
| 235 | + # echo "build_args<<EOF" |
| 236 | + # echo "LIBMESH_GIT_REF=${libmesh_submodule_ref}" |
| 237 | + # echo "EOF" |
| 238 | + # } >> $GITHUB_OUTPUT |
| 239 | + # - name: Generate moose-libmesh-mpich tag |
| 240 | + # if: needs.prepare.outputs.libmesh_changed |
| 241 | + # id: libmesh_meta |
| 242 | + # uses: docker/metadata-action@v6 |
| 243 | + # with: |
| 244 | + # images: ghcr.io/${{ github.repository }}/pr-moose-petsc-mpich |
| 245 | + # tags: type=ref,event=pr |
| 246 | + # - name: Extract moose-libmesh-mpich tag |
| 247 | + # if: needs.prepare.outputs.libmesh_changed |
| 248 | + # id: get_libmesh_tag |
| 249 | + # run: | |
| 250 | + # echo "tag=$(echo '${{ steps.libmesh_meta.outputs.tags }}' | head -n1)" >> $GITHUB_OUTPUT |
| 251 | + # - name: Build moose-libmesh-mpich |
| 252 | + # if: needs.prepare.outputs.libmesh_changed |
| 253 | + # uses: docker/build-push-action@v7 |
| 254 | + # with: |
| 255 | + # context: ./docker/moose-libmesh |
| 256 | + # build-args: | |
| 257 | + # BASE_IMAGE=${{ steps.get_petsc_tag.outputs.tag }} |
| 258 | + # push: true |
| 259 | + # tags: ${{ steps.libmesh_meta.outputs.tags }} |
| 260 | + |
| 261 | + # test1: |
| 262 | + # name: "Test 1" |
| 263 | + # needs: |
| 264 | + # - prepare |
| 265 | + # - build_moose_dev_mpich |
| 266 | + # if: >- |
| 267 | + # always() && |
| 268 | + # (needs.build_moose_dev_mpich.result == 'skipped' || needs.build_moose_dev_mpich.result == 'success') |
| 269 | + # runs-on: ubuntu-slim |
| 270 | + # steps: |
| 271 | + # - name: Test |
| 272 | + # shell: bash |
| 273 | + # run: | |
| 274 | + # echo "testing" |
| 275 | + |
| 276 | + # test2: |
| 277 | + # name: "Test 2" |
| 278 | + # needs: |
| 279 | + # - prepare |
| 280 | + # - build_moose_dev_mpich |
| 281 | + # if: >- |
| 282 | + # always() && |
| 283 | + # (needs.build_moose_dev_mpich.result == 'skipped' || needs.build_moose_dev_mpich.result == 'success') |
| 284 | + # runs-on: ubuntu-slim |
| 285 | + # steps: |
| 286 | + # - name: Test |
| 287 | + # shell: bash |
| 288 | + # run: | |
| 289 | + # echo "testing" |
0 commit comments