Skip to content

givedirectly/Google-Partnership

Repository files navigation

Google - Partnership

Repository to store the work done by Google Fellows during 2019

  • This project uses yarn for dependency management. Install and run yarn install to install all dependencies. If you ever see an issue with missing dependencies, try running this command again.

Making changes and locally staging

  • Go to the Firestore database while logged in as gd-earthengine-user@givedirectly.org and add your Google account's email address to the list of users. This will give you access to user-drawn features on the disaster map.

  • Download this git repository. You will probably have to add ssh keys to your account so that you can access this repository. Googling "github add ssh keys" is good enough. Current instructions available. However, if you work for Google and get a failed command when you run ssh-add, try specifying /usr/bin/ssh-add, since there is a Google-specific ssh-add binary that otherwise gets invoked.

  • Start the local web server by running yarn run ws --directory docs --port 8080. and visit the page at localhost:8080 (we recommend in Chrome).

  • In order to view all features without incurring server traffic expenses, sign up to whitelist yourself with earth engine (usually takes ~1-2 business days to get approved).

  • Install clang-format, probably using brew install clang-format.

  • Set up auto-lint: echo ./pre-push-hook.sh > .git/hooks/pre-push

  • [Optional] Run ./lint.sh --fix to run clang-format and eslint on all relevant files and (with --fix) format in place. Clang-format checking and eslint will run automatically on git push (without --fix) so this just saves you the extra commits.

Running tests

  • Node 12 is required to run tests. You can install it on Macs in various ways. The nvm manager is recommended. Be sure to use Node 12, not Node 13 or higher! Our test runner Cypress is not compatible with Node 13.

  • A service account secret .json file is used to credential the test runner. Get the file either from a collaborator or by logging into the Service Accounts page as gd-earthengine-test-user@givedirectly.org and generating a new key for firebase-adminsdk-j6emn@mapping-test-data.iam.gserviceaccount.com.

  • Save the file locally somewhere outside of your local download of this repository.

  • Set export GOOGLE_APPLICATION_CREDENTIALS=/path/to/secret.json in your shell (most likely in your ~/.bashrc on linux, ~/.bash_profile on mac). Remember to startup a new terminal window for changes to take effect.

  • Start the local web server as described above.

  • Test changes locally.

    yarn run cypress run # --browser chrome ## (only needed on Linux)
  • [Optional] Travis CI runs on each push to a PR, unless the commit message has '[skip ci]' inside it. You can trigger a run manually from the Travis main page. Runs are recorded to the Cypress dashboard.

  • [Optional] Ask a collaborator to add you to the existing cypress dashboard for this project. The dashboard tracks Travis CI runs and provides easy access to output files, footage of the test being run, etc.

  • [Optional] If you are running on Linux and seeing issues with Chrome, or working on a Google internal machine, install and use Chromium for tests. Install via the usual apt-get-style channels. This should be relatively straightforward on most systems, but is difficult/impossible on Google-internal machines. If you have difficulty, you can download a latest version and unzip it. Then create a link, via sudo ln -s /path/to/file/in/extracted/zip/named/chrome-wrapper /usr/bin/chromium so that Cypress knows how to find it easily.

  • For more details on our testing setup, see the README.

Other tools

  • [Optional] Install ogr2ogr command line tool (part of the gdal library) if you ever need to convert between geo-data types. This will most often be used to convert geo data to earth engine-friendly formats.

    brew install gdal
    ogr2ogr -f "ESRI Shapefile" destination_data.shp "source-data.json"

Helpful Links

License

license

This project is licensed under the terms of the MIT license.

About

Repository to store the work done by Google Fellows during 2019

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published