-
Notifications
You must be signed in to change notification settings - Fork 56
75 lines (66 loc) · 2.33 KB
/
nightly-jax-test-unit.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Nightly JAX unit test
run-name: Nightly JAX unit test (${{ github.event_name == 'workflow_run' && format('nightly {0}', github.event.workflow_run.created_at) || github.event_name }})
on:
workflow_run:
workflows: [Nightly JAX build]
types: [completed]
branches: [main]
workflow_dispatch:
inputs:
JAX_IMAGE:
type: string
description: 'JAX image built by NVIDIA/JAX-Toolbox'
default: 'ghcr.io/nvidia/jax:latest'
required: true
PUBLISH:
type: boolean
description: Update status badge?
default: false
required: true
permissions:
contents: read # to fetch code
actions: write # to cancel previous workflows
packages: write # to upload container
env:
DEFAULT_JAX_IMAGE: 'ghcr.io/nvidia/jax:latest'
jobs:
if-upstream-failed:
if: (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'failure') && github.event_name != 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- run: echo 'Upstream workflow failed, aborting run' && exit 1
metadata:
runs-on: ubuntu-22.04
outputs:
JAX_IMAGE: ${{ steps.image.outputs.JAX_IMAGE }}
PUBLISH: ${{ steps.if-publish.outputs.PUBLISH }}
steps:
- name: Determine jax image to use
id: image
shell: bash -x -e {0}
run: |
if [[ -z "${{ inputs.JAX_IMAGE }}" ]]; then
JAX_IMAGE=${{ env.DEFAULT_JAX_IMAGE }}
else
JAX_IMAGE=${{ inputs.JAX_IMAGE }}
fi
echo "JAX_IMAGE=${JAX_IMAGE}" >> $GITHUB_OUTPUT
- name: Determine whether results will be 'published'
id: if-publish
shell: bash -x -e {0}
run: |
echo "PUBLISH=${{ github.event_name == 'workflow_run' || (github.event_name == 'workflow_dispatch' && inputs.PUBLISH) }}" >> $GITHUB_OUTPUT
run:
needs: metadata
uses: ./.github/workflows/_test_jax.yaml
if: (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') || github.event_name == 'workflow_dispatch'
with:
JAX_IMAGE: ${{ needs.metadata.outputs.JAX_IMAGE }}
secrets: inherit
finalize:
if: always()
needs: [metadata, run]
uses: ./.github/workflows/_finalize.yaml
with:
PUBLISH_BADGE: ${{ needs.metadata.outputs.PUBLISH == 'true' }}
secrets: inherit