Skip to content

feat: Allow using a topic from outside of the module #63

feat: Allow using a topic from outside of the module

feat: Allow using a topic from outside of the module #63

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@v3
- 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@v3
# 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."