-
Notifications
You must be signed in to change notification settings - Fork 6
116 lines (110 loc) · 3.41 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: CI
on:
pull_request:
branches:
- '*'
jobs:
test-backend:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.8]
services:
postgres:
image: postgres:11.5
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/dev-requirements.txt') }}
- name: Install dependencies
run: |
sudo apt-get install libpq-dev # required b/c it has pg_config which is needed to build psycopg2
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r dev-requirements.txt
- name: Test with pytest
env:
SLACK_API_TOKEN: ""
DATABASE_URL: "postgres://postgres:postgres@localhost:5432/postgres"
DJANGO_SETTINGS_MODULE: "penny_university.settings.ci"
SECRET_KEY: "6db7242adc5570c3bb2d12b2e161b1930650f9669a457fb3"
run: |
pytest
- name: Flake8
run: |
flake8
test-frontend:
runs-on: ubuntu-latest
strategy:
matrix:
node: [ '12' ]
steps:
- uses: actions/checkout@v1
- name: Set Up Node ${{ matrix.node }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
# TODO add dependency caching here
- name: Install Dependencies
working-directory: ./penny_university_frontend
run: |
npm install
- name: Run Tests
working-directory: ./penny_university_frontend
run: |
CI=true npm test
- name: Eslint
working-directory: ./penny_university_frontend
run: |
npm run lint
- name: Build Frontend
# this broke deployment once, so better check
working-directory: ./penny_university_frontend
env:
CI: false
REACT_APP_API_ROOT: "/api/"
run: |
npm install
npm run build
test-integration:
runs-on: ubuntu-16.04
strategy:
matrix:
node: [ '12' ]
steps:
- uses: actions/checkout@v1
- name: Add Heroku credentials
run: |
echo "machine api.heroku.com" > ~/.netrc
echo " login [email protected]" >> ~/.netrc
echo " password ${{ secrets.HEROKU_API_KEYs }}" >> ~/.netrc
echo "machine git.heroku.com" >> ~/.netrc
echo " login [email protected]" >> ~/.netrc
echo " password ${{ secrets.HEROKU_API_KEY }}" >> ~/.netrc
- name: Deploy to QA
run: |
git remote add qa https://git.heroku.com/penny-qa.git
./script/deploy_to_qa
- name: Cypress Run
uses: cypress-io/github-action@v2
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
with:
headless: true
record: true
working-directory: ./penny_university/tests/integration