Skip to content

Commit

Permalink
github: build less and faster
Browse files Browse the repository at this point in the history
- only build if actual code has changed, not for any non-code changes
- only build configs, not full images
- fix test build AP hostname
  • Loading branch information
pktpls committed Dec 16, 2023
1 parent 44536a3 commit bd06ad9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/testbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,16 @@ jobs:
CHANGED_LOCATIONS=$(git diff --diff-filter=d --name-only "origin/$BRANCH" | grep 'group_vars/location_' | sed 's/group_vars\/\(.*\)\/.*/\1/' | sort | uniq | sed -z 's/\n/,/g;s/,$//')
CHANGED_SINGE_FILE_LOCATIONS=$(git diff --diff-filter=d --name-only "origin/master" | grep 'locations/' | sed 's/locations\/\(.*\)\.yml/location_\1/' | sed -z 's/\n/,/g;s/,$//')
CHANGED_LOCATIONS=${CHANGED_LOCATIONS:+$CHANGED_LOCATIONS,}$CHANGED_SINGE_FILE_LOCATIONS
if [ -z "${CHANGED_LOCATIONS}" ]; then
CHANGED_LOCATIONS="sama-core,sama-nord-nf-5ghz,l105-gw"
CHANGED_OTHER=$(git diff --diff-filter=d --name-only "origin/master" | grep -xP '(inventory|roles)/.+')
if [ -z "${CHANGED_LOCATIONS}" ] && [ -n "${CHANGED_OTHER}" ]; then
CHANGED_LOCATIONS="sama-core,sama-nord-5ghz,l105-gw"
fi
echo "Building for $CHANGED_LOCATIONS"
echo "CHANGED_LOCATIONS=$CHANGED_LOCATIONS" >> "$GITHUB_ENV"
- name: Build changed locations
run: |
ansible-playbook play.yml --tags image --limit "${CHANGED_HOSTS:+$CHANGED_HOSTS,}$CHANGED_LOCATIONS"
ansible-playbook play.yml --limit "${CHANGED_HOSTS:+$CHANGED_HOSTS,}$CHANGED_LOCATIONS"
- name: Store build output
uses: actions/upload-artifact@v1
Expand Down

0 comments on commit bd06ad9

Please sign in to comment.