-
Notifications
You must be signed in to change notification settings - Fork 4.4k
146 lines (138 loc) · 6.68 KB
/
ci.yml
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: Continuous Integration
on:
# Triggers the workflow on push or pull request events only for the specified branches
push:
branches:
- master
- r0.17
- release
- classic
pull_request_target:
branches:
- master
- r0.17
- release
- classic
permissions:
id-token: write
pull-requests: write
defaults:
run:
shell: bash
jobs:
build_torch:
name: Build PyTorch
if: "github.repository == 'd2l-ai/d2l-en' && !contains(github.event.head_commit.message, '[skip torch]') && !contains(github.event.head_commit.message, '[skip frameworks]')"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Env Vars
uses: ./.github/actions/setup_env_vars
- name: Evaluate PyTorch on AWS Batch
uses: ./.github/actions/submit-job
with:
job-type: ci-gpu-torch
job-name: D2L-Build-PyTorch
command: chmod +x ./.github/workflow_scripts/build_pytorch.sh && ./.github/workflow_scripts/build_pytorch.sh "${{ env.REPO_NAME }}" "${{ env.TARGET_BRANCH }}" "${{ env.CACHE_DIR }}"
- name: Terminate Batch Job on Cancellation
if: ${{ cancelled() && env.Batch_JobID }}
run: |
echo "Terminating Submitted AWS Batch Job: "${{ env.Batch_JobID }}""
aws batch terminate-job --job-id "${{ env.Batch_JobID }}" --reason "Job terminated by cancelled workflow"
build_tf:
name: Build Tensorflow
if: "github.repository == 'd2l-ai/d2l-en' && !contains(github.event.head_commit.message, '[skip tf]') && !contains(github.event.head_commit.message, '[skip frameworks]')"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Env Vars
uses: ./.github/actions/setup_env_vars
- name: Evaluate Tensorflow on AWS Batch
uses: ./.github/actions/submit-job
with:
job-type: ci-gpu-tf
job-name: D2L-Build-Tensorflow
command: chmod +x ./.github/workflow_scripts/build_tf.sh && ./.github/workflow_scripts/build_tf.sh "${{ env.REPO_NAME }}" "${{ env.TARGET_BRANCH }}" "${{ env.CACHE_DIR }}"
- name: Terminate Batch Job on Cancellation
if: ${{ cancelled() && env.Batch_JobID }}
run: |
echo "Terminating Submitted AWS Batch Job: "${{ env.Batch_JobID }}""
aws batch terminate-job --job-id "${{ env.Batch_JobID }}" --reason "Job terminated by cancelled workflow"
build_jax:
name: Build JAX
if: "github.repository == 'd2l-ai/d2l-en' && !contains(github.event.head_commit.message, '[skip jax]') && !contains(github.event.head_commit.message, '[skip frameworks]')"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Env Vars
uses: ./.github/actions/setup_env_vars
- name: Evaluate JAX on AWS Batch
uses: ./.github/actions/submit-job
with:
job-type: ci-gpu-jax
job-name: D2L-Build-JAX
command: chmod +x ./.github/workflow_scripts/build_jax.sh && ./.github/workflow_scripts/build_jax.sh "${{ env.REPO_NAME }}" "${{ env.TARGET_BRANCH }}" "${{ env.CACHE_DIR }}"
- name: Terminate Batch Job on Cancellation
if: ${{ cancelled() && env.Batch_JobID }}
run: |
echo "Terminating Submitted AWS Batch Job: "${{ env.Batch_JobID }}""
aws batch terminate-job --job-id "${{ env.Batch_JobID }}" --reason "Job terminated by cancelled workflow"
build_mxnet:
name: Build MXNet
if: "github.repository == 'd2l-ai/d2l-en' && !contains(github.event.head_commit.message, '[skip mxnet]') && !contains(github.event.head_commit.message, '[skip frameworks]')"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Env Vars
uses: ./.github/actions/setup_env_vars
- name: Evaluate MXNet on AWS Batch
uses: ./.github/actions/submit-job
with:
job-type: ci-gpu-mxnet
job-name: D2L-Build-MXNet
command: chmod +x ./.github/workflow_scripts/build_mxnet.sh && ./.github/workflow_scripts/build_mxnet.sh "${{ env.REPO_NAME }}" "${{ env.TARGET_BRANCH }}" "${{ env.CACHE_DIR }}"
- name: Terminate Batch Job on Cancellation
if: ${{ cancelled() && env.Batch_JobID }}
run: |
echo "Terminating Submitted AWS Batch Job: "${{ env.Batch_JobID }}""
aws batch terminate-job --job-id "${{ env.Batch_JobID }}" --reason "Job terminated by cancelled workflow"
build_and_deploy:
name: Build Website/PDF & Publish
needs: [build_torch, build_tf, build_jax, build_mxnet]
if: |
always() &&
github.repository == 'd2l-ai/d2l-en' &&
!contains(github.event.head_commit.message, '[skip builder]') &&
(needs.build_torch.result == 'success' || needs.build_torch.result == 'skipped') &&
(needs.build_tf.result == 'success' || needs.build_tf.result == 'skipped') &&
(needs.build_jax.result == 'success' || needs.build_jax.result == 'skipped') &&
(needs.build_mxnet.result == 'success' || needs.build_mxnet.result == 'skipped')
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Env Vars
uses: ./.github/actions/setup_env_vars
- name: Build Website & PDFs on AWS Batch
uses: ./.github/actions/submit-job
with:
job-type: ci-cpu
job-name: D2L-Builder
command: chmod +x ./.github/workflow_scripts/build_and_deploy.sh ./.github/workflow_scripts/build_html.sh && ./.github/workflow_scripts/build_and_deploy.sh "${{ env.REPO_NAME }}" "${{ env.TARGET_BRANCH }}" "${{ env.JOB_NAME }}" "${{ env.LANG }}" "${{ env.CACHE_DIR }}"
- name: Terminate Batch Job on Cancellation
if: ${{ cancelled() && env.Batch_JobID }}
run: |
echo "Terminating Submitted AWS Batch Job: "${{ env.Batch_JobID }}""
aws batch terminate-job --job-id "${{ env.Batch_JobID }}" --reason "Job terminated by cancelled workflow"
- name: Comment on PR
if: ${{ github.event_name == 'pull_request_target' }}
uses: peter-evans/create-or-update-comment@38e799a33166c9a254f2e3660d4d49ecd67eb80c # v3
with:
issue-number: ${{ github.event.number }}
body: |
Job PR-${{ github.event.number }}-${{ env.SHORT_SHA }} is done.
Check the results at http://preview.d2l.ai/${{ env.JOB_NAME }}