Nightly SST Core Container Build #237
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Nightly SST Core Container Build | |
| # Automatically builds SST-core containers from master branch when new commits are detected | |
| # Creates multi-architecture images with master-latest tags | |
| on: | |
| schedule: | |
| - cron: '0 10 * * *' # Daily at 10AM UTC (2 AM Pacific Standard Time (PST), 3 AM Pacific Daylight Time (PDT)) | |
| workflow_dispatch: # Manual trigger for testing | |
| inputs: | |
| force_rebuild: | |
| description: 'Force rebuild even if no updates detected' | |
| required: false | |
| default: false | |
| type: boolean | |
| mpich_version: | |
| description: 'MPICH version to use' | |
| required: false | |
| default: '4.0.2' | |
| type: string | |
| build_platforms: | |
| description: 'Platforms to build for' | |
| required: false | |
| default: 'linux/amd64,linux/arm64' | |
| type: choice | |
| options: | |
| - 'linux/amd64,linux/arm64' | |
| - 'linux/amd64' | |
| - 'linux/arm64' | |
| env: | |
| REGISTRY: ghcr.io | |
| SST_REPO: https://github.com/sstsimulator/sst-core.git | |
| SST_BRANCH: master | |
| jobs: | |
| check-updates: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: read | |
| outputs: | |
| build_needed: ${{ steps.check.outputs.build_needed }} | |
| current_sha: ${{ steps.check.outputs.current_sha }} | |
| short_sha: ${{ steps.check.outputs.short_sha }} | |
| tag_suffix: ${{ steps.check.outputs.tag_suffix }} | |
| steps: | |
| - name: Check for SST-core branch updates | |
| id: check | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| CURRENT_SHA=$(gh api /repos/sstsimulator/sst-core/branches/${{ env.SST_BRANCH }} --jq '.commit.sha') | |
| SHORT_SHA=${CURRENT_SHA:0:7} | |
| echo "Current SST-core ${{ env.SST_BRANCH }} SHA: $CURRENT_SHA" | |
| echo "Short SHA: $SHORT_SHA" | |
| TARGET_TAG="master-${SHORT_SHA}" | |
| echo "Checking for existing tag: $TARGET_TAG" | |
| CORE_IMAGE="${{ env.REGISTRY }}/${{ github.repository_owner }}/sst-core" | |
| if docker manifest inspect "${CORE_IMAGE}:${TARGET_TAG}" >/dev/null 2>&1; then | |
| echo "Multi-arch manifest with tag $TARGET_TAG already exists, skipping build" | |
| BUILD_NEEDED="false" | |
| else | |
| echo "No multi-arch manifest found with tag $TARGET_TAG, build needed" | |
| BUILD_NEEDED="true" | |
| fi | |
| FORCE_REBUILD="${{ inputs.force_rebuild }}" | |
| if [ "$FORCE_REBUILD" = "true" ]; then | |
| BUILD_NEEDED="true" | |
| echo "Build forced by force_rebuild parameter" | |
| fi | |
| echo "build_needed=$BUILD_NEEDED" >> $GITHUB_OUTPUT | |
| echo "current_sha=$CURRENT_SHA" >> $GITHUB_OUTPUT | |
| echo "short_sha=$SHORT_SHA" >> $GITHUB_OUTPUT | |
| echo "tag_suffix=master-${SHORT_SHA}" >> $GITHUB_OUTPUT | |
| build-core-containers: | |
| needs: [check-updates] | |
| if: needs.check-updates.outputs.build_needed == 'true' | |
| permissions: | |
| contents: read | |
| packages: write | |
| uses: ./.github/workflows/_reusable-build-containers.yml | |
| with: | |
| container_type: 'core' | |
| image_prefix: '${{ github.repository_owner }}/sst' | |
| tag_suffix: '${{ needs.check-updates.outputs.tag_suffix }}' | |
| build_platforms: ${{ inputs.build_platforms || 'linux/amd64,linux/arm64' }} | |
| mpich_version: ${{ inputs.mpich_version || '4.0.2' }} | |
| sst_core_repo: 'https://github.com/sstsimulator/sst-core.git' | |
| sst_core_ref: '${{ needs.check-updates.outputs.current_sha }}' | |
| publish_master_latest: true | |
| secrets: inherit | |
| validate-core-containers: | |
| permissions: | |
| contents: read | |
| packages: read | |
| uses: ./.github/workflows/_reusable-validate-containers.yml | |
| needs: [check-updates, build-core-containers] | |
| if: needs.build-core-containers.result == 'success' | |
| with: | |
| container_type: 'core' | |
| image_tags: '${{ needs.build-core-containers.outputs.built_images }}' | |
| build_platforms: ${{ inputs.build_platforms || 'linux/amd64,linux/arm64' }} | |
| max_image_size_mb: ${{ fromJson(needs.build-core-containers.outputs.max_image_size_mb) }} | |
| validation_mode: '${{ needs.build-core-containers.outputs.validation_mode }}' | |
| secrets: inherit | |
| generate-summary: | |
| uses: ./.github/workflows/_reusable-generate-summary.yml | |
| needs: [check-updates, build-core-containers, validate-core-containers] | |
| if: always() | |
| with: | |
| workflow_type: 'nightly' | |
| container_type: 'core' | |
| build_successful: ${{ needs.build-core-containers.result == 'success' || (needs.check-updates.outputs.build_needed == 'false' && needs.build-core-containers.result == 'skipped') }} | |
| manifest_successful: ${{ needs.build-core-containers.result == 'success' || (needs.check-updates.outputs.build_needed == 'false' && needs.build-core-containers.result == 'skipped') }} | |
| validation_successful: ${{ needs.validate-core-containers.result == 'success' || (needs.check-updates.outputs.build_needed == 'false' && needs.validate-core-containers.result == 'skipped') }} | |
| manifest_tag: '${{ needs.build-core-containers.outputs.manifest_tag }}' | |
| built_images: '${{ needs.build-core-containers.outputs.built_images }}' | |
| build_platforms: ${{ inputs.build_platforms || 'linux/amd64,linux/arm64' }} | |
| tag_suffix: '${{ needs.build-core-containers.outputs.resolved_tag_suffix }}' | |
| alias_tags_json: '${{ needs.build-core-containers.outputs.alias_tags_json }}' | |
| mpich_version: ${{ inputs.mpich_version || '4.0.2' }} | |
| sst_commit: '${{ needs.check-updates.outputs.current_sha }}' |