Skip to content

Commit cfd6274

Browse files
exit early if no samples changed
1 parent 838a94b commit cfd6274

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

.github/workflows/deploy-changed-samples.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,12 @@ jobs:
3737
| uniq \
3838
| while read -r dir; do [ -d "$dir" ] && echo "$dir"; done > changed_samples.txt
3939
if [ ! -s changed_samples.txt ]; then
40+
echo "should_continue=false" >> $GITHUB_ENV
4041
echo "No samples have changed. Exiting..."
41-
exit 0
42+
else
43+
echo "should_continue=true" >> $GITHUB_ENV
44+
echo "The following samples have changed:"
45+
cat changed_samples.txt
4246
fi
4347
4448
- name: Install Golang
@@ -47,20 +51,24 @@ jobs:
4751
go-version-file: tools/testing/go.mod
4852
cache-dependency-path: |
4953
tools/testing/go.sum
54+
if: env.should_continue == 'true'
5055

5156
- name: Build the test tool using Go
5257
run: |
5358
go mod tidy
5459
go build ./cmd/loadtest
5560
working-directory: tools/testing/
61+
if: env.should_continue == 'true'
5662

5763
- name: Install Defang
5864
run: |
5965
eval "$(curl -fsSL s.defang.io/install)"
66+
if: env.should_continue == 'true'
6067

6168
- name: Run tests
6269
id: run-tests
6370
shell: bash # implies set -o pipefail, so pipe below will keep the exit code from loadtest
71+
if: env.should_continue == 'true'
6472
env:
6573
FIXED_VERIFIER_PK: ${{ secrets.FIXED_VERIFIER_PK }}
6674
TEST_AWS_ACCESS_KEY: ${{ secrets.TEST_AWS_ACCESS_KEY }}
@@ -104,7 +112,7 @@ jobs:
104112
105113
- name: Upload Output as Artifact
106114
uses: actions/upload-artifact@v4
107-
if: success() || steps.run-tests.outcome == 'failure' # Always upload result unless cancelled
115+
if: env.should_continue == 'true' && (success() || steps.run-tests.outcome == 'failure') # Always upload result unless cancelled
108116
with:
109117
name: program-output
110118
path: output/**

0 commit comments

Comments
 (0)