-
Notifications
You must be signed in to change notification settings - Fork 21
71 lines (66 loc) · 2.34 KB
/
check-deployments.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
name: Check deployments
on:
workflow_dispatch:
pull_request:
branches:
- main
- master
- develop
defaults:
# Set shell for steps inside containers (default=sh)
run:
shell: bash
jobs:
#--------------------------------------------------------------
# COLLECT DEPLOYMENTS
#--------------------------------------------------------------
collect:
name: 🍱 collect deployments
# For public repos use runs-on: ubuntu-latest
# For private repos use runs-on: self-hosted
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- id: set-matrix
run: |
MATRIX=$(cat build_targets.json | jq -c)
echo $MATRIX
cat <<< matrix=$MATRIX >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
#--------------------------------------------------------------
# CHECK DEPLOYMENTS
#--------------------------------------------------------------
check-deployments:
needs: [collect]
name: 🔍 check deployment
# For public repos use runs-on: ubuntu-latest
# For private repos use runs-on: self-hosted
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.collect.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
# To test whether the deployment package is up to date,
# we only check the application code (excluding dependencies).
- run: |
NAME=${{ matrix.name }}
RUNTIME=${{ matrix.runtime }}
DEPLOYMENT=deployment-$NAME-$RUNTIME.zip
#
echo NAME=$NAME RUNTIME=$RUNTIME
#
cp $DEPLOYMENT ${DEPLOYMENT}_original
cd $NAME
zip -r ../$DEPLOYMENT .
cd ..
#
# Compare length and names of files in Zip.
echo "***Comparing deployment package to source code for $DEPLOYMENT"
# Building in Docker doesn't work, some files are still different.
[[ -f $DEPLOYMENT ]] || { echo "Deployment file not found."; exit 1; }
diff \
<(unzip -vqq $DEPLOYMENT | awk '{$2=""; $3=""; $4=""; $5=""; $6=""; print}' | sort -k3 -f) \
<(unzip -vqq ${DEPLOYMENT}_original | awk '{$2=""; $3=""; $4=""; $5=""; $6=""; print}' | sort -k3 -f)
echo "***Comparison completed. Deployment package is up to date."