Skip to content

Commit

Permalink
testing script to update map
Browse files Browse the repository at this point in the history
Signed-off-by: vsoch <[email protected]>
  • Loading branch information
vsoch committed Feb 16, 2020
1 parent f566770 commit caf05c4
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/update-map.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Update USRSE Map

on:
pull_request: []
schedule:
# Run once a week on Sunday
- cron: 0 0 * * 0

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v1

- name: Install dependencies and run script
run: |
sudo apt-get update && sudo apt-get install -y python3 python3-pip wget
sudo pip3 install -r requirements.txt
# Ensure using a particular version
wget -O scripts/_update_map.py https://raw.githubusercontent.com/USRSE/usrse-map/f56677018ebc3f4f65eca185e8ecf9d5e0968b8c/scripts/update_map.py
chmod +x scripts/_update_map.py
python3 scripts/_update_map.py
- name: Test Newly Generated Data
run: pytest -v -x tests/test_*.py

- name: Checkout New Branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH_AGAINST: "master"
run: |
echo "GitHub Actor: ${GITHUB_ACTOR}"
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git branch
git checkout -b update/member-map-$(date '+%Y-%m-%d')
git branch
git config --global user.name "github-actions"
git config --global user.email "[email protected]"
git add _data/locations.csv
git commit -m "Automated deployment to update Member Map $(date '+%Y-%m-%d')" --allow-empty
git push origin update/member-map-$(date '+%Y-%m-%d')
export BRANCH_FROM="update/member-map-$(date '+%Y-%m-%d')"
wget https://raw.githubusercontent.com/USRSE/usrse-map/f56677018ebc3f4f65eca185e8ecf9d5e0968b8c/scripts/pull-request.sh
chmod +x ./pull-request.sh
/bin/bash -e ./pull-request.sh
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#uszipcode==0.2.4
geopy==1.21.0
requests
pytest
4 changes: 4 additions & 0 deletions scripts/update_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ def main():
counts[line] = 0
counts[line] += 1

# Alert user about unknown locations
print("UNKNOWN:\n %s\n" % "\n".join(unknown))
print("MISSING:\n %s" % "\n".join(missing))

# Generate list of names with latitude and longitude for each
# [name, lat, long, count]
locations = [["name", "lat", "lng", "count"]]
Expand Down

0 comments on commit caf05c4

Please sign in to comment.