-
Notifications
You must be signed in to change notification settings - Fork 1
83 lines (79 loc) · 2.87 KB
/
Copy pathdeploy-to-test.yml
File metadata and controls
83 lines (79 loc) · 2.87 KB
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
name: Deploy to test
on:
push:
branches:
- dev
jobs:
test:
name: Unit tests
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: '3.12'
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Unit tests
run: |
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install -r requirements_for_test.txt
export DB_SECRET="{'dbClusterIdentifier':'none','password':'secret','dbname':'accessibility_monitoring_app','engine':'postgres','port':5432,'host':'localhost','username':'admin'}"
export DB_NAME=bucket-name
export ALLOWED_HOSTS='localhost 127.0.0.1 0.0.0.0'
export SECRET_KEY=1234
export DEBUG=TRUE
npm i
make static_files_process
make test
int-test:
needs: test
name: Integration tests
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Integration tests
run: |
cd stack_tests/integration_tests
docker compose up --abort-on-container-exit
deploy:
needs: int-test
name: Deploy to AWS
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install AWS Copilot
run: |
mkdir -p $GITHUB_WORKSPACE/bin
# download copilot
# curl -Lo copilot https://github.com/aws/copilot-cli/releases/latest/download/copilot-linux && chmod +x copilot && sudo mv copilot /usr/local/bin/copilot && copilot --help
curl -Lo copilot-linux https://github.com/aws/copilot-cli/releases/latest/download/copilot-linux && \
# make copilot bin executable
sudo chmod +x copilot-linux && \
# move to path
sudo mv copilot-linux $GITHUB_WORKSPACE/bin/copilot && \
# add to PATH
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH
- name: Deploy to AWS
run: |
copilot svc deploy --name viewer-svc --env testenv && \
copilot svc deploy --name amp-svc --env testenv
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_COPILOT }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_COPILOT }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION_COPILOT }}
- name: Smoke tests
run: |
docker compose --file stack_tests/smoke_tests/test-platform.docker-compose.yml up --abort-on-container-exit && \
docker compose --file stack_tests/smoke_tests_viewer/test-viewer.docker-compose.yml up --abort-on-container-exit
env:
SMOKE_TESTS_USERNAME: ${{ secrets.SMOKE_TESTS_USERNAME }}
SMOKE_TESTS_PASSWORD: ${{ secrets.SMOKE_TESTS_PASSWORD }}