~Sandbox #1270
This file contains 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: "~Sandbox" | |
on: | |
workflow_dispatch: | |
inputs: | |
ARCHITECTURE: | |
type: string | |
required: true | |
BUILD_DATE: | |
type: string | |
description: 'Build date in YYYY-MM-DD format' | |
required: false | |
default: NOT SPECIFIED | |
MANIFEST_ARTIFACT_NAME: | |
type: string | |
description: 'Artifact name in current run w/ manifest/patches. Leaving empty uses manifest/patches in current branch' | |
default: '' | |
required: false | |
SOURCE_URLREFS: | |
type: string | |
description: 'A JSON object containing git url+refs for softwares to be built' | |
required: false | |
default: '{}' | |
permissions: | |
contents: read # to fetch code | |
actions: write # to cancel previous workflows | |
packages: write # to upload container | |
jobs: | |
bump-manifest: | |
runs-on: ubuntu-22.04 | |
outputs: | |
SOURCE_URLREFS: ${{ steps.source-urlrefs.outputs.SOURCE_URLREFS }} | |
steps: | |
- name: Check out the repository under ${GITHUB_WORKSPACE} | |
uses: actions/checkout@v4 | |
- name: Create URL ref build args | |
id: source-urlrefs | |
shell: bash -x -e {0} | |
run: | | |
# converts manifest yaml to a json object of {SOFTWARE_NAME: URL#REF, ...} | |
urlrefs=$( | |
cat .github/container/manifest.yaml |\ | |
yq -o=json 'to_entries | .[] | select(.value.mode == "git-clone") | {( .key | upcase | sub("-", "_") ): .value.url + "#" + .value.latest_verified_commit}' |\ | |
jq -c -s 'add' | |
) | |
# SOURCE_OVERRIDES is a comma-separated list of package=urlref pairs | |
IFS=, read -ra overrides <<< "${{ inputs.SOURCE_OVERRIDES }}" | |
for override in "${overrides[@]}"; do | |
PACKAGE=$(cut -d= -f 1 <<< "${override}" | tr '[:lower:]' '[:upper:]' | tr '-' '_') | |
URLREF=$(cut -d= -f 2- <<< "${override}") | |
urlrefs=$(echo "$urlrefs" | jq -c ". + {\"$PACKAGE\": \"$URLREF\"}") | |
done | |
echo "SOURCE_URLREFS=${urlrefs}" >> $GITHUB_OUTPUT | |
build-base: | |
uses: ./.github/workflows/_build_base.yaml | |
with: | |
ARCHITECTURE: ${{ inputs.ARCHITECTURE }} | |
BUILD_DATE: ${{ inputs.BUILD_DATE }} | |
MANIFEST_ARTIFACT_NAME: ${{ inputs.MANIFEST_ARTIFACT_NAME }} | |
secrets: inherit | |
build-jax: | |
needs: build-base | |
uses: ./.github/workflows/_build.yaml | |
with: | |
ARCHITECTURE: ${{ inputs.ARCHITECTURE }} | |
ARTIFACT_NAME: artifact-jax-build | |
BADGE_FILENAME: badge-jax-build | |
BUILD_DATE: ${{ inputs.BUILD_DATE }} | |
BASE_IMAGE: ${{ needs.build-base.outputs.DOCKER_TAG }} | |
CONTAINER_NAME: jax | |
DOCKERFILE: .github/container/Dockerfile.jax | |
RUNNER_SIZE: large | |
EXTRA_BUILD_ARGS: | | |
URLREF_JAX=${{ fromJson(inputs.SOURCE_URLREFS).JAX }} | |
URLREF_XLA=${{ fromJson(inputs.SOURCE_URLREFS).XLA }} | |
URLREF_FLAX=${{ fromJson(inputs.SOURCE_URLREFS).FLAX }} | |
URLREF_TRANSFORMER_ENGINE=${{ fromJson(inputs.SOURCE_URLREFS).TRANSFORMER_ENGINE }} | |
secrets: inherit | |
build-upstream-pax: | |
needs: build-jax | |
uses: ./.github/workflows/_build.yaml | |
with: | |
ARCHITECTURE: ${{ inputs.ARCHITECTURE }} | |
ARTIFACT_NAME: artifact-pax-build | |
BADGE_FILENAME: badge-pax-build | |
BUILD_DATE: ${{ inputs.BUILD_DATE }} | |
BASE_IMAGE: ${{ needs.build-jax.outputs.DOCKER_TAG_MEALKIT }} | |
CONTAINER_NAME: upstream-pax | |
DOCKERFILE: .github/container/Dockerfile.pax.${{ inputs.ARCHITECTURE }} | |
EXTRA_BUILD_ARGS: | | |
URLREF_PAXML=${{ fromJson(inputs.SOURCE_URLREFS).PAXML }} | |
URLREF_PRAXIS=${{ fromJson(inputs.SOURCE_URLREFS).PRAXIS }} | |
secrets: inherit | |
test-distribution: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
TEST_SCRIPT: | |
- extra-only-distribution.sh | |
- mirror-only-distribution.sh | |
- upstream-only-distribution.sh | |
- local-patch-distribution.sh | |
fail-fast: false | |
steps: | |
- name: Print environment variables | |
run: env | |
- name: Set git login for tests | |
run: | | |
git config --global user.email "jax@nvidia.com" | |
git config --global user.name "JAX-Toolbox CI" | |
- name: Check out the repository under ${GITHUB_WORKSPACE} | |
uses: actions/checkout@v4 | |
- name: Run integration test ${{ matrix.TEST_SCRIPT }} | |
run: bash rosetta/tests/${{ matrix.TEST_SCRIPT }} | |
test-upstream-pax: | |
needs: build-upstream-pax | |
if: inputs.ARCHITECTURE == 'amd64' # no images for arm64 | |
uses: ./.github/workflows/_test_upstream_pax.yaml | |
with: | |
PAX_IMAGE: ${{ needs.build-upstream-pax.outputs.DOCKER_TAG_FINAL }} | |
secrets: inherit |