Merge pull request #566 from colts661/ywang_sample_summary_project #1394
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: microsetta-private-api CI | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
jobs: | |
# derived from https://github.com/actions/example-services/blob/master/.github/workflows/postgres-service.yml | |
postgres-runner-job: | |
runs-on: ubuntu-latest | |
# Service containers to run with `runner-job` | |
services: | |
# Label used to access the service container | |
postgres: | |
# Docker Hub image | |
image: postgres:13.4 | |
env: | |
POSTGRES_DB: ag_test | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
# based on https://github.com/actions/example-services/blob/master/.github/workflows/postgres-service.yml#L44-L72 | |
- 5432/tcp | |
steps: | |
# Downloads a copy of the code in your repository before running CI tests | |
- name: Check out repository code | |
uses: actions/checkout@v2 | |
- name: Setup for conda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
python-version: 3.7 | |
- name: Install | |
shell: bash -l {0} | |
env: | |
MFR_URL: "${{ secrets.MFR_URL }}" | |
MFR_TEST_APIKEY: "${{ secrets.MFR_TEST_APIKEY }}" | |
MFR_STUDY: "${{ secrets.MFR_STUDY }}" | |
FUNDRAZR_TEST_APIKEY: "${{ secrets.FUNDRAZR_TEST_APIKEY }}" | |
FUNDRAZR_TEST_URL: "${{ secrets.FUNDRAZR_TEST_URL }}" | |
FUNDRAZR_TEST_ORG: "${{ secrets.FUNDRAZR_TEST_ORG }}" | |
VS_ENDPOINT: "${{ secrets.VS_ENDPOINT }}" | |
VS_USER: "${{ secrets.VS_USER }}" | |
VS_PASSWORD: "${{ secrets.VS_PASSWORD }}" | |
VS_CRYPTOKEY: "${{ secrets.VS_CRYPTOKEY }}" | |
VS_REGCODE: "${{ secrets.VS_REGCODE }}" | |
GOOGLE_GEOCODING_KEY: "${{ secrets.GOOGLE_GEOCODING_KEY }}" | |
run: | | |
# pull out the port so we can modify the configuration file easily | |
pgport=${{ job.services.postgres.ports[5432] }} | |
sed -i "s/self.port = 5432/self.port = $pgport/" microsetta_private_api/config_manager.py | |
# use hashes to avoid delimiter overlap with a URL | |
python set_github_secrets.py | |
# PGPASSWORD is read by pg_restore, which is called by the build_db process. | |
export PGPASSWORD=postgres | |
conda create --yes -n test-microsetta-private python=3.9 | |
conda activate test-microsetta-private | |
conda install --yes --file ci/conda_requirements.txt | |
pip install -r ci/pip_requirements.txt | |
pip install -e . --no-deps | |
# establish database state | |
python microsetta_private_api/LEGACY/build_db.py | |
- name: Test | |
shell: bash -l {0} | |
run: | | |
conda activate test-microsetta-private | |
# workaround for Python bpo-44413 | |
# https://bugs.python.org/issue44413 | |
# discussed further in Debian 1001774 | |
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1001774 | |
sudo timedatectl set-timezone America/Los_Angeles | |
make test | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: flake8 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.7 | |
- name: install dependencies | |
run: python -m pip install --upgrade pip | |
- name: lint | |
run: | | |
pip install -q flake8 | |
make lint | |