snmp_profiles: add SwOs and Edgeswitch #1541
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Test Build | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
name: Ansible Test Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install dependencies | |
run: sudo apt install python3 | |
- name: Install dependencies | |
run: pip3 install -r requirements.txt --upgrade pip | |
- name: Determine branch name | |
run: | | |
BRANCH="${GITHUB_BASE_REF#refs/heads/}" | |
echo "Building for $BRANCH" | |
echo "BRANCH=$BRANCH" >> "$GITHUB_ENV" | |
- name: Determine changed locations | |
run: | | |
CHANGED_HOSTS=$(git diff --diff-filter=d --name-only "origin/$BRANCH" | grep 'host_vars/' | sed 's/host_vars\/\(.*\)\/.*/\1/' | sort | uniq | sed -z 's/\n/,/g;s/,$//') | |
echo "Building for $CHANGED_HOSTS" | |
echo "CHANGED_HOSTS=$CHANGED_HOSTS" >> "$GITHUB_ENV" | |
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/$BRANCH" | grep 'locations/' | sed 's/locations\/\(.*\)\.yml/location_\1/' | sed -z 's/-/_/g;s/\n/,/g;s/,$//') | |
CHANGED_LOCATIONS=${CHANGED_LOCATIONS:+$CHANGED_LOCATIONS,}$CHANGED_SINGE_FILE_LOCATIONS | |
CHANGED_OTHER=$(git diff --diff-filter=d --name-only "origin/$BRANCH" | grep -xP '(inventory|roles)/.+' | sed -z 's/\n/,/g;s/,$//') | |
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" | |
- if: ${{ github.event_name == 'pull_request' }} | |
name: Build changed locations | |
run: | | |
if [ -n "${CHANGED_HOSTS}" ] || [ -n "${CHANGED_LOCATIONS}" ] ; then | |
ansible-playbook play.yml --limit "${CHANGED_HOSTS:+$CHANGED_HOSTS,}$CHANGED_LOCATIONS" | |
fi | |
mkdir -p ./tmp/images | |
- if: ${{ github.event_name == 'push' }} | |
name: Update wiki.freifunk.net | |
run: | | |
ansible-playbook play.yml --tags wiki --limit "${CHANGED_HOSTS:+$CHANGED_HOSTS,}$CHANGED_LOCATIONS" | |
continue-on-error: true | |
- if: ${{ github.event_name == 'pull_request' }} | |
name: Store build output | |
uses: actions/upload-artifact@v1 | |
with: | |
name: ansibleimages | |
path: ./tmp/images |