Skip to content

Commit dc5376b

Browse files
abort workflow if no changes found
1 parent 6b7555c commit dc5376b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,32 +32,37 @@ jobs:
3232
| sort \
3333
| uniq > changed_samples.txt
3434
if [ -s changed_samples.txt ]; then
35+
echo "should_continue=true" >> $GITHUB_ENV
3536
echo "The following samples have changed:"
3637
cat changed_samples.txt
3738
else
39+
echo "should_continue=false" >> $GITHUB_ENV
3840
echo "No samples have changed. Exiting..."
3941
fi
40-
4142
- name: Install Golang
4243
uses: actions/setup-go@v5
4344
with:
4445
go-version-file: tools/testing/go.mod
4546
cache-dependency-path: |
4647
tools/testing/go.sum
48+
if: env.should_continue == 'true'
4749

4850
- name: Build the test tool using Go
4951
run: |
5052
go mod tidy
5153
go build ./cmd/loadtest
5254
working-directory: tools/testing/
55+
if: env.should_continue == 'true'
5356

5457
- name: Install Defang
5558
run: |
5659
eval "$(curl -fsSL s.defang.io/install)"
60+
if: env.should_continue == 'true'
5761

5862
- name: Run tests
5963
id: run-tests
6064
shell: bash # implies set -o pipefail, so pipe below will keep the exit code from loadtest
65+
if: env.should_continue == 'true'
6166
env:
6267
FIXED_VERIFIER_PK: ${{ secrets.FIXED_VERIFIER_PK }}
6368
TEST_AWS_ACCESS_KEY: ${{ secrets.TEST_AWS_ACCESS_KEY }}
@@ -92,16 +97,14 @@ jobs:
9297
run: |
9398
SAMPLES=$(sed 's|^samples/||' changed_samples.txt | paste -s -d ',' -)
9499
echo "Running tests for samples: $SAMPLES"
95-
96100
mkdir output
97101
# concurrency is set to 10 to avoid exhausting our fargate vCPU limits when running
98102
# kaniko builds, which consume 4 vCPUs each. the limit is currently set to 60--6.5 of
99103
# which are used to run the staging stack. So floor((60-6.5)/4) = 13 is our upper limit
100104
./tools/testing/loadtest -c fabric-staging.defang.dev:443 --timeout=15m --concurrency=10 -s $SAMPLES -o output --markdown=true | tee output/summary.log | grep -v '^\s*[-*]' # removes load sample log lines
101-
102105
- name: Upload Output as Artifact
103106
uses: actions/upload-artifact@v4
104-
if: success() || steps.run-tests.outcome == 'failure' # Always upload result unless cancelled
107+
if: env.should_continue == 'true' && (success() || steps.run-tests.outcome == 'failure') # Always upload result unless cancelled
105108
with:
106109
name: program-output
107110
path: output/**

0 commit comments

Comments
 (0)