Skip to content

Commit ce55e84

Browse files
committed
Remove ${{ }} notation in if statement where not needed
1 parent d487a7e commit ce55e84

File tree

7 files changed

+62
-54
lines changed

7 files changed

+62
-54
lines changed

.github/workflows/_build_plugin.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,32 +36,36 @@ jobs:
3636
BAZEL_JOBS: 16
3737
BAZEL_REMOTE_CACHE: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}
3838
steps:
39+
- name: Debug has_code_changes and its comparison
40+
run: |
41+
echo "Raw value of inputs.has_code_changes: '${{ inputs.has_code_changes }}'"
42+
echo "Is (inputs.has_code_changes == 'true')? : ${{ inputs.has_code_changes == 'true' }}"
3943
- name: Checkout actions
40-
if: ${{ inputs.has_code_changes == 'true' }}
44+
if: inputs.has_code_changes == 'true'
4145
uses: actions/checkout@v4
4246
with:
4347
sparse-checkout: |
4448
.github/workflows/setup
4549
path: .actions
4650
- name: Setup
47-
if: ${{ inputs.has_code_changes == 'true' }}
51+
if: inputs.has_code_changes == 'true'
4852
uses: ./.actions/.github/workflows/setup
4953
with:
5054
torch-commit: ${{ inputs.torch-commit }}
5155
cuda: true
5256
- name: Build
53-
if: ${{ inputs.has_code_changes == 'true' }}
57+
if: inputs.has_code_changes == 'true'
5458
shell: bash
5559
run: |
5660
cd pytorch/xla/infra/ansible
5761
ansible-playbook playbook.yaml -vvv -e "stage=build_plugin arch=amd64 accelerator=cuda cuda_compute_capabilities=5.2,7.5,8.6 src_root=${GITHUB_WORKSPACE} cache_suffix=-ci" --skip-tags=fetch_srcs,install_deps
5862
- name: Upload wheel
59-
if: ${{ inputs.has_code_changes == 'true' }}
63+
if: inputs.has_code_changes == 'true'
6064
uses: actions/upload-artifact@v4
6165
with:
6266
name: cuda-plugin
6367
path: /dist/*.whl
6468
- name: Report no code changes
65-
if: ${{ inputs.has_code_changes == 'false' }}
69+
if: inputs.has_code_changes == 'false'
6670
run: |
6771
echo "No code changes were detected that require running the full test suite."

.github/workflows/_build_torch_with_cuda.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,31 +38,31 @@ jobs:
3838
MAX_JOBS: 24
3939
steps:
4040
- name: Checkout actions
41-
if: ${{ inputs.has_code_changes == 'true' }}
41+
if: inputs.has_code_changes == 'true'
4242
uses: actions/checkout@v4
4343
with:
4444
sparse-checkout: |
4545
.github/workflows/setup
4646
path: .actions
4747
- name: Setup
48-
if: ${{ inputs.has_code_changes == 'true' }}
48+
if: inputs.has_code_changes == 'true'
4949
uses: ./.actions/.github/workflows/setup
5050
with:
5151
torch-commit: ${{ inputs.torch-commit }}
5252
cuda: true
5353
- name: Build PyTorch with CUDA enabled
54-
if: ${{ inputs.has_code_changes == 'true' }}
54+
if: inputs.has_code_changes == 'true'
5555
shell: bash
5656
run: |
5757
cd pytorch
5858
python setup.py bdist_wheel
5959
- name: Upload wheel
60-
if: ${{ inputs.has_code_changes == 'true' }}
60+
if: inputs.has_code_changes == 'true'
6161
uses: actions/upload-artifact@v4
6262
with:
6363
name: torch-with-cuda
6464
path: pytorch/dist/*.whl
6565
- name: Report no code changes
66-
if: ${{ inputs.has_code_changes == 'false' }}
66+
if: inputs.has_code_changes == 'false'
6767
run: |
6868
echo "No code changes were detected that require running the full test suite."

.github/workflows/_build_torch_xla.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,37 +44,37 @@ jobs:
4444
# Need to check out local composite actions before using them
4545
# https://github.com/orgs/community/discussions/11771
4646
- name: Checkout actions
47-
if: ${{ inputs.has_code_changes == 'true' }}
47+
if: inputs.has_code_changes == 'true'
4848
uses: actions/checkout@v4
4949
with:
5050
sparse-checkout: |
5151
.github/workflows/setup
5252
path: .actions
5353
- name: Setup
54-
if: ${{ inputs.has_code_changes == 'true' }}
54+
if: inputs.has_code_changes == 'true'
5555
uses: ./.actions/.github/workflows/setup
5656
with:
5757
torch-commit: ${{ inputs.torch-commit }}
5858
- name: Build
59-
if: ${{ inputs.has_code_changes == 'true' }}
59+
if: inputs.has_code_changes == 'true'
6060
shell: bash
6161
run: |
6262
cd pytorch/xla/infra/ansible
6363
ansible-playbook playbook.yaml -vvv -e "stage=build arch=amd64 accelerator=tpu src_root=${GITHUB_WORKSPACE} bundle_libtpu=0 build_cpp_tests=1 git_versioned_xla_build=1 cache_suffix=-ci" --skip-tags=fetch_srcs,install_deps
6464
- name: Upload wheel
65-
if: ${{ inputs.has_code_changes == 'true' }}
65+
if: inputs.has_code_changes == 'true'
6666
uses: actions/upload-artifact@v4
6767
with:
6868
name: torch-xla-wheels
6969
path: /dist/*.whl
7070
- name: Upload CPP test binaries
71-
if: ${{ inputs.has_code_changes == 'true' }}
71+
if: inputs.has_code_changes == 'true'
7272
uses: actions/upload-artifact@v4
7373
with:
7474
name: cpp-test-bin
7575
path: /tmp/test/bin
7676
- name: Report no code changes
77-
if: ${{ inputs.has_code_changes == 'false' }}
77+
if: inputs.has_code_changes == 'false'
7878
run: |
7979
echo "No code changes were detected that require running the full test suite."
8080

.github/workflows/_docs.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,50 +29,50 @@ jobs:
2929
BRANCH_NAME: ${{ github.ref_name }}
3030
steps:
3131
- name: Fetch wheels
32-
if: ${{ inputs.has_code_changes == 'true' }}
32+
if: inputs.has_code_changes == 'true'
3333
uses: actions/download-artifact@v4
3434
with:
3535
name: torch-xla-wheels
3636
path: /tmp/wheels/
3737
- name: Install wheels
38-
if: ${{ inputs.has_code_changes == 'true' }}
38+
if: inputs.has_code_changes == 'true'
3939
shell: bash
4040
run: |
4141
pip install /tmp/wheels/*.whl
4242
- name: Checkout PyTorch/XLA Repo
43-
if: ${{ inputs.has_code_changes == 'true' }}
43+
if: inputs.has_code_changes == 'true'
4444
uses: actions/checkout@v4
4545
with:
4646
path: pytorch/xla
4747
- name: Build docs
48-
if: ${{ inputs.has_code_changes == 'true' }}
48+
if: inputs.has_code_changes == 'true'
4949
shell: bash
5050
run: |
5151
cd pytorch/xla/docs
5252
pip install -r requirements.txt
5353
sphinx-build -b html source build
5454
- name: Checkout GitHub Pages
55-
if: ${{ inputs.has_code_changes == 'true' }}
55+
if: inputs.has_code_changes == 'true'
5656
uses: actions/checkout@v4
5757
with:
5858
path: gh-pages
5959
ref: gh-pages
6060
token: ${{ github.event_name == 'push' && secrets.torchxla-bot-token || github.token }}
6161
- name: Merge changes
62-
if: ${{ inputs.has_code_changes == 'true' }}
62+
if: inputs.has_code_changes == 'true'
6363
shell: bash
6464
run: |
6565
subdir=${{ env.BRANCH_NAME == 'master' && 'master' || format('{0}/{1}', 'release', env.BRANCH_NAME) }}
6666
mkdir -p gh-pages/$subdir
6767
cp -fR pytorch/xla/docs/build/* gh-pages/$subdir
6868
- name: Upload preview as artifact
69-
if: ${{ inputs.has_code_changes == 'true' }}
69+
if: inputs.has_code_changes == 'true'
7070
uses: actions/upload-artifact@v4
7171
with:
7272
name: github-pages
7373
path: pytorch/xla/docs/build/
7474
- name: Deploy
75-
if: ${{ inputs.has_code_changes == 'true' }} && github.event_name == 'push'
75+
if: inputs.has_code_changes == 'true' && github.event_name == 'push'
7676
shell: bash
7777
run: |
7878
cd gh-pages
@@ -82,6 +82,6 @@ jobs:
8282
git diff --cached --exit-code || git commit -m "Update doc from commit ${{ github.sha }}"
8383
git push origin gh-pages
8484
- name: Report no code changes
85-
if: ${{ inputs.has_code_changes == 'false' }}
85+
if: inputs.has_code_changes == 'false'
8686
run: |
8787
echo "No code changes were detected that require running the full test suite."

.github/workflows/_test.yml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
runs-on: ${{ inputs.runner }}
4747
container:
4848
image: ${{ inputs.dev-image }}
49-
options: "${{ inputs.install-cuda-plugin && '--gpus all' || '' }} --shm-size 16g"
49+
options: "${{ inputs.install-cuda-plugin == true && '--gpus all' || '' }} --shm-size 16g"
5050
strategy:
5151
fail-fast: false
5252
matrix:
@@ -81,58 +81,62 @@ jobs:
8181
BAZEL_JOBS: 16
8282
BAZEL_REMOTE_CACHE: 1
8383
steps:
84+
- name: Debug has_code_changes and its comparison
85+
run: |
86+
echo "Raw value of inputs.has_code_changes: '${{ inputs.has_code_changes }}'"
87+
echo "Is (inputs.has_code_changes == 'true')? : ${{ inputs.has_code_changes == 'true' }}"
8488
- name: Checkout actions
85-
if: ${{ inputs.has_code_changes == 'true' }}
89+
if: inputs.has_code_changes == 'true'
8690
uses: actions/checkout@v4
8791
with:
8892
sparse-checkout: |
8993
.github/workflows/setup
9094
path: .actions
9195
- name: Setup
92-
if: ${{ inputs.has_code_changes == 'true' }}
96+
if: inputs.has_code_changes == 'true'
9397
uses: ./.actions/.github/workflows/setup
9498
with:
9599
torch-commit: ${{ inputs.torch-commit }}
96100
cuda: ${{ inputs.install-cuda-plugin && true || false }}
97101
wheels-artifact: torch-xla-wheels
98102
cuda-plugin-artifact: ${{ inputs.install-cuda-plugin && 'cuda-plugin' || null }}
99103
- name: Fetch CPP test binaries
100-
if: ${{ inputs.has_code_changes == 'true' }} && ${{ matrix.run_cpp_tests }}
104+
if: inputs.has_code_changes == 'true' && matrix.run_cpp_tests
101105
uses: actions/download-artifact@v4
102106
with:
103107
name: cpp-test-bin
104108
path: /tmp/test/bin
105109
# GitHub Actions doesn't preserve executable permissions
106110
# https://github.com/actions/download-artifact?tab=readme-ov-file#permission-loss
107111
- name: Set CPP test permissions
108-
if: ${{ inputs.has_code_changes == 'true' }} && ${{ matrix.run_cpp_tests }}
112+
if: inputs.has_code_changes == 'true' && matrix.run_cpp_tests
109113
run: |
110114
chmod +x /tmp/test/bin/*
111115
ls -l /tmp/test/bin
112116
- name: Check GPU
113-
if: ${{ inputs.has_code_changes == 'true' }} && ${{ inputs.install-cuda-plugin }}
117+
if: inputs.has_code_changes == 'true' && inputs.install-cuda-plugin
114118
run: nvidia-smi
115119
- name: Install test deps
116-
if: ${{ inputs.has_code_changes == 'true' }}
120+
if: inputs.has_code_changes == 'true'
117121
shell: bash
118122
run: |
119123
# TODO: Add these in setup.py
120124
pip install fsspec
121125
pip install rich
122126
- name: Checkout PyTorch Repo
123-
if: ${{ inputs.has_code_changes == 'true' }}
127+
if: inputs.has_code_changes == 'true'
124128
uses: actions/checkout@v4
125129
with:
126130
repository: pytorch/pytorch
127131
path: pytorch
128132
ref: ${{ inputs.torch-commit }}
129133
- name: Checkout PyTorch/XLA Repo
130-
if: ${{ inputs.has_code_changes == 'true' }}
134+
if: inputs.has_code_changes == 'true'
131135
uses: actions/checkout@v4
132136
with:
133137
path: pytorch/xla
134138
- name: Extra CI deps
135-
if: ${{ inputs.has_code_changes == 'true' }}
139+
if: inputs.has_code_changes == 'true'
136140
shell: bash
137141
run: |
138142
set -x
@@ -143,11 +147,11 @@ jobs:
143147
pip install -r pytorch/xla/benchmarks/requirements.txt
144148
fi
145149
- name: Test
146-
if: ${{ inputs.has_code_changes == 'true' }}
150+
if: inputs.has_code_changes == 'true'
147151
shell: bash
148152
run: pytorch/xla/.github/scripts/run_tests.sh pytorch/ pytorch/xla/ $USE_COVERAGE
149153
- name: Upload coverage results
150-
if: ${{ inputs.has_code_changes == 'true' }} && ${{ inputs.collect-coverage }}
154+
if: inputs.has_code_changes == 'true' && inputs.collect-coverage
151155
shell: bash
152156
env:
153157
CIRCLE_WORKFLOW_ID: ${{ github.run_id }}
@@ -192,6 +196,6 @@ jobs:
192196
fi
193197
fi
194198
- name: Report no code changes
195-
if: ${{ inputs.has_code_changes == 'false' }}
199+
if: inputs.has_code_changes == 'false'
196200
run: |
197201
echo "No code changes were detected that require running the full test suite."

.github/workflows/_test_requiring_torch_cuda.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ jobs:
5252
BAZEL_REMOTE_CACHE: 1
5353
steps:
5454
- name: Checkout actions
55-
if: ${{ inputs.has_code_changes == 'true' }}
55+
if: inputs.has_code_changes == 'true'
5656
uses: actions/checkout@v4
5757
with:
5858
sparse-checkout: |
5959
.github/workflows/setup
6060
path: .actions
6161
- name: Setup
62-
if: ${{ inputs.has_code_changes == 'true' }}
62+
if: inputs.has_code_changes == 'true'
6363
uses: ./.actions/.github/workflows/setup
6464
with:
6565
torch-commit: ${{ inputs.torch-commit }}
@@ -68,10 +68,10 @@ jobs:
6868
cuda-plugin-artifact: cuda-plugin
6969
cuda-torch-artifact: torch-with-cuda
7070
- name: Check GPU
71-
if: ${{ inputs.has_code_changes == 'true' }}
71+
if: inputs.has_code_changes == 'true'
7272
run: nvidia-smi
7373
- name: Install wheels
74-
if: ${{ inputs.has_code_changes == 'true' }}
74+
if: inputs.has_code_changes == 'true'
7575
shell: bash
7676
run: |
7777
pip install /tmp/wheels/*.whl
@@ -86,42 +86,42 @@ jobs:
8686
python -c "import torch; assert torch.cuda.is_available()"
8787
echo "CUDA is available for PyTorch."
8888
- name: Checkout PyTorch Repo
89-
if: ${{ inputs.has_code_changes == 'true' }}
89+
if: inputs.has_code_changes == 'true'
9090
uses: actions/checkout@v4
9191
with:
9292
repository: pytorch/pytorch
9393
path: pytorch
9494
ref: ${{ inputs.torch-commit }}
9595
- name: Checkout PyTorch/XLA Repo
96-
if: ${{ inputs.has_code_changes == 'true' }}
96+
if: inputs.has_code_changes == 'true'
9797
uses: actions/checkout@v4
9898
with:
9999
path: pytorch/xla
100100
- name: Extra CI deps
101-
if: ${{ inputs.has_code_changes == 'true' }} && ${{ matrix.run_triton_tests }}
101+
if: inputs.has_code_changes == 'true' && matrix.run_triton_tests
102102
shell: bash
103103
run: |
104104
set -x
105105
pip install -U --pre jax jaxlib "jax-cuda12-plugin[with_cuda]" jax-cuda12-pjrt -f https://storage.googleapis.com/jax-releases/jax_nightly_releases.html
106106
- name: Install Triton
107-
if: ${{ inputs.has_code_changes == 'true' }}
107+
if: inputs.has_code_changes == 'true'
108108
shell: bash
109109
run: |
110110
cd pytorch
111111
make triton
112112
- name: Python Tests
113-
if: ${{ inputs.has_code_changes == 'true' }} && ${{ matrix.run_python_tests }}
113+
if: inputs.has_code_changes == 'true' && matrix.run_python_tests
114114
shell: bash
115115
run: |
116116
set -xue
117117
PJRT_DEVICE=CUDA python pytorch/xla/test/test_operations.py -v
118118
PJRT_DEVICE=CUDA python pytorch/xla/test/dynamo/test_dynamo.py -v
119119
- name: Triton Tests
120-
if: ${{ inputs.has_code_changes == 'true' }} && ${{ matrix.run_triton_tests }}
120+
if: inputs.has_code_changes == 'true' && matrix.run_triton_tests
121121
shell: bash
122122
run: |
123123
PJRT_DEVICE=CUDA TRITON_PTXAS_PATH=/usr/local/cuda-12.3/bin/ptxas python pytorch/xla/test/test_triton.py
124124
- name: Report no code changes
125-
if: ${{ inputs.has_code_changes == 'false' }}
125+
if: inputs.has_code_changes == 'false'
126126
run: |
127127
echo "No code changes were detected that require running the full test suite."

0 commit comments

Comments
 (0)