-
Notifications
You must be signed in to change notification settings - Fork 9
111 lines (91 loc) · 3.32 KB
/
main.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
name: CI
on: [push, pull_request]
jobs:
integration:
name: Integration Tests (${{ matrix.browser }}, Python ${{ matrix.python }}, Node ${{ matrix.node }})
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.10"]
node: ["16"]
browser: ["chrome", "firefox"]
steps:
- uses: actions/checkout@v3
- name: Install Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install Chrome Webdriver
if: ${{ matrix.browser == 'chrome' }}
run: |
python3 -m venv venv
source venv/bin/activate
pip install seleniumbase
sudo apt-get install -y google-chrome-stable
seleniumbase install chromedriver
deactivate
rm -rf venv
- name: Install Firefox Webdriver
if: ${{ matrix.browser == 'firefox' }}
run: |
# Python by default installs from snap.
# This isn't supported by geckodriver.
#
# The clean solution would be to use a sane distribution
# that doesn't use snap-based firefox by default.
# But GitHub Actions doesn't offer this.
sudo add-apt-repository ppa:mozillateam/ppa
sudo apt-get -qq -y update
echo '
Package: *
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 1001
Package: firefox
Pin: version 1:1snap1-0ubuntu2
Pin-Priority: -1
' | sudo tee /etc/apt/preferences.d/mozilla-firefox > /dev/null
sudo apt-get -y install firefox
python3 -m venv venv
source venv/bin/activate
sudo apt-get install -y firefox
pip install seleniumbase
seleniumbase install geckodriver
deactivate
rm -rf venv
- name: Run 'poetry install'
run: |
pip install poetry
poetry config virtualenvs.create false
poetry install
- name: Install Node ${{ matrix.node }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- name: Run 'yarn install'
run: yarn install
- name: Run 'yarn build'
run: yarn build
- name: Check if 'black' has been run
run:
black --exclude 'migrations' --check .
- name: Run 'pytest'
env:
SELENIUM_WEBDRIVER: ${{ matrix.browser }}
ENABLE_GEOCACHE_TEST: '1'
run: pytest
smoke:
name: Docker Smoke Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: 'Build Docker Container'
run: docker build -t jacobsalumni/membermanagement .
- name: 'Run Docker Container'
run: |
docker run --rm -d --name=smoke -e DJANGO_SECRET_KEY=smoke -p 8080:80 jacobsalumni/membermanagement
sleep 10
- name: 'Check that the healthcheck API responds'
run: |
curl http://localhost:8080/healthcheck/
curl -L http://localhost:8080/healthcheck/static
docker stop smoke