2828 - name : Identify changed samples
2929 run : |
3030 echo "Identifying changed samples..."
31- echo $(git diff --name-only HEAD main | grep '^samples/' | awk -F'/' '{print $1"/"$2}' | sort | uniq) > changed_samples.txt
31+ bash scripts/changed-samples.sh > changed_samples.txt
3232
3333 - name : Run Docker Compose Up and down
3434 run : |
@@ -38,22 +38,10 @@ jobs:
3838 echo $CHANGED_FILES
3939
4040 # Iterate over the changed samples and run them one at a time with docker locally
41- for sample in $CHANGED_FILES; do
42- (
43- echo "up $sample"
44- cd $sample
45-
46- docker compose up
47-
48- echo "down $sample"
49- docker compose down --detach
50-
51- echo "Started and stopped $sample successfully"
52-
53- cd ..
54- ) &
55- done
56- wait
41+ for sample in $CHANGED_FILES; do
42+ if ! bash scripts/compose-sample.sh $sample; then
43+ echo "Failed to compose up and down $sample"
44+ fi
5745 done
5846
5947 deploy_samples :
7664 - name : Identify changed samples
7765 run : |
7866 echo "Identifying changed samples..."
79- echo $(git diff --name-only HEAD main | grep '^samples/' | awk -F'/' '{print $1"/"$2}' | sort | uniq) > changed_samples.txt
67+ bash scripts/changed-samples.sh > changed_samples.txt
8068
8169 - name : Install defang
8270 shell : bash
@@ -100,21 +88,9 @@ jobs:
10088
10189 # Iterate over the changed samples and deploy them one at a time
10290 for sample in $CHANGED_FILES; do
103- (
104- echo "Deploying $sample"
105- cd $sample
106-
107- # deploy the sample
108- defang compose up
109-
110- echo "Deprovisioning $sample"
111- # teardown the sample
112- defang compose down --detach
113-
114- echo "Deployed and deprovisioned $sample successfully"
91+ echo "Deploying $sample"
11592
116- cd ..
117- ) &
118- done
119- wait
93+ if ! bash scripts/deploy-sample.sh $sample; then
94+ echo "Failed to deploy and deprovision $sample"
95+ fi
12096 done
0 commit comments