1+ name : CI
2+
3+ on :
4+ workflow_dispatch :
5+ pull_request :
6+ push :
7+ branches :
8+ - master
9+ - staging
10+
11+ env :
12+ PYENV_VERSION : ' 3.10'
13+ DJANGO_SECRET_KEY : ${{secrets.SECRET_KEY}}
14+ DJANGO_SETTINGS_MODULE : config.settings.test
15+ DATABASE_URL : postgres://${PGUSER}:${PGPASSWORD}@127.0.0.1:5432/test
16+ DOC_PROCESSING_URL : http://localhost/process
17+ ENVIRONMENT : local
18+ API_CALLBACK : http://localhost
19+ DJANGO_COOKIE_DOMAIN : .test.documentcloud.org
20+ REDIS_PROCESSING_URL : redis://localhost:6379
21+ PROCESSING_TOKEN : PROCESSING_TOKEN
22+ MINIO_URL : minio.documentcloud.org
23+ SERVERLESS : False
24+ AWS_DEFAULT_REGION : us-east-1
25+ AWS_ACCESS_KEY_ID : ${{secrets.AWS_ACCESS_KEY_ID}}
26+ AWS_SECRET_ACCESS_KEY : ${{secrets.AWS_SECRET_ACCESS_KEY}}
27+ PROGRESS_URL : http://localhost/progress
28+ TIMEOUTS : 15,30,60,120
29+ IMPORT_URL : http://localhost/import
30+ SIDEKICK_PROCESSING_URL : http://localhost/process
31+ REDIS_URL : redis://localhost:6379
32+ JWT_VERIFYING_KEY : ' tk'
33+ SQUARELET_SECRET : ${{secrets.SQUARELET_SECRET}}
34+
35+
36+ jobs :
37+ check :
38+ runs-on : ubuntu-latest
39+
40+ services :
41+ redis :
42+ image : redis
43+ ports :
44+ - 6379:6379
45+ options : >-
46+ --health-cmd "redis-cli ping"
47+ --health-interval 10s
48+ --health-timeout 5s
49+ --health-retries 5
50+ steps :
51+ - uses : actions/checkout@v4
52+ with :
53+ submodules : recursive
54+ - uses : actions/setup-python@v5
55+ with :
56+ python-version : " 3.10"
57+ cache : " pip" # caching pip dependencies
58+
59+ - name : Install
60+ run : |
61+ pip install -r requirements/local.txt
62+
63+ - name : Lint
64+ run : pylint documentcloud
65+
66+ - name : Isort
67+ run : isort --check-only -rc documentcloud
68+
69+ - name : Formatting
70+ run : black --check documentcloud --exclude migrations
71+
72+ test :
73+ runs-on : ubuntu-latest
74+
75+ services :
76+ redis :
77+ image : redis
78+ ports :
79+ - 6379:6379
80+ options : >-
81+ --health-cmd "redis-cli ping"
82+ --health-interval 10s
83+ --health-timeout 5s
84+ --health-retries 5
85+
86+ postgres :
87+ image : postgres
88+ env :
89+ POSTGRES_USER : test
90+ POSTGRES_PASSWORD : postgres
91+ POSTGRES_DB : muckrock
92+ # Set health checks to wait until postgres has started
93+ options : >-
94+ --health-cmd pg_isready
95+ --health-interval 10s
96+ --health-timeout 5s
97+ --health-retries 5
98+ ports :
99+ # Maps tcp port 5432 on service container to the host
100+ - 5432:5432
101+
102+ steps :
103+
104+ - name : Checkout
105+ uses : actions/checkout@v4
106+
107+ - name : Install Python
108+ uses : actions/setup-python@v5
109+ with :
110+ python-version : " 3.10"
111+ cache : " pip" # caching pip dependencies
112+
113+ - name : Install requirements
114+ run : |
115+ pip install -r requirements/local.txt
116+
117+
118+ - name : Test
119+ run : pytest documentcloud -m "not solr"
120+ env :
121+ # use the credentials for the service container
122+ PG_USER : ${{secrets.PG_USER}}
123+ PG_PASSWORD : ${{secrets.PG_PASSWORD}}
124+ DATABASE_URL : postgres://${PGUSER}:${PGPASSWORD}@127.0.0.1:5432/test
0 commit comments