-
Notifications
You must be signed in to change notification settings - Fork 63
133 lines (119 loc) · 4.51 KB
/
build.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Install and Test
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
build-linux:
defaults:
run:
# Ensures environment gets sourced right
shell: bash -l {0}
name: Python (${{ matrix.PYTHON_VERSION }}) with IEM Data (${{ matrix.WITH_IEM_DATA }})
runs-on: ubuntu-latest
strategy:
matrix:
PYTHON_VERSION: ["3.11"]
WITH_IEM_DATA: ["YES", "NO"]
env:
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
WITH_IEM_DATA: ${{ matrix.WITH_IEM_DATA }}
steps:
- uses: actions/checkout@v4
- name: Add /etc/hosts entries
run: |
cat .github/workflows/etchosts.txt | sudo tee -a /etc/hosts
- name: Copy PHP Settings
run: |
cp config/settings.inc.php.in config/settings.inc.php
# setup conda-forge with micromamba
- name: Setup Python
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment.yml
condarc: |
channels:
- conda-forge
- defaults
create-args: >-
python=${{ env.PYTHON_VERSION }}
environment-name: prod
cache-environment: true
- name: Setup Postgres
run: |
git clone --depth 1 https://github.com/akrherz/iem-database.git database
git clone --depth 1 https://github.com/akrherz/ci_tooling.git .ci_tooling
. .ci_tooling/postgres.sh
cd database; sh bootstrap.sh
python schema_manager.py
- name: Setup Memcached
run: |
. .ci_tooling/memcached.sh
- name: Setup Apache
run: |
# need apache2-dev for mod-wsgi to build
sudo apt-get install apache2 apache2-dev
- name: Install Python requirements from pip
run: |
# mod_wsgi is here and needs apxs from above
python -m pip install -r pip_requirements.txt
- name: Setup IEM Data
if: ${{ matrix.WITH_IEM_DATA }} == "YES"
run: |
python database/store_test_data.py
python scripts/dbutil/sync_stations.py
- name: Configure Webfarm Server
run: |
. .ci_tooling/iemwebfarm.sh
sudo mkdir -p /mesonet/www/logs
sudo ln -s `pwd` /opt/iem
sudo ln -s $HOME/micromamba /opt/miniconda3
echo `pwd`
chmod 755 $HOME
sudo apt-get install librrd-dev
sudo service memcached start
sudo a2enmod headers rewrite proxy proxy_http proxy_balancer ssl lbmethod_byrequests cgi expires authz_groupfile
# we do things the old fashioned way, we earn it
sudo a2dissite 000-default.conf
sudo cp .github/ci_support/mod_wsgi.conf /etc/apache2/sites-enabled/
echo '<VirtualHost *:80>' | sudo tee /etc/apache2/sites-enabled/iem.conf > /dev/null
cat config/mesonet.inc | sudo tee -a /etc/apache2/sites-enabled/iem.conf > /dev/null
echo '</VirtualHost>' | sudo tee -a /etc/apache2/sites-enabled/iem.conf > /dev/null
# This may be a requirement for mod-wsgi to properly find python tooling?
echo "export PATH=/home/runner/micromamba/envs/prod/bin:$PATH" | sudo tee -a /etc/apache2/envvars > /dev/null
# Newer PROJ needs this
echo "export PROJ_LIB=/home/runner/micromamba/envs/prod/share/proj" | sudo tee -a /etc/apache2/envvars > /dev/null
MOD_WSGI_SO=$(find $HOME/micromamba/envs/prod -type f -name 'mod_wsgi*.so')
echo $MOD_WSGI_SO
echo "LoadModule wsgi_module $MOD_WSGI_SO" | sudo tee -a /etc/apache2/mods-enabled/wsgi.load > /dev/null;
echo "WSGIApplicationGroup %{GLOBAL}" | sudo tee -a /etc/apache2/mods-enabled/wsgi.load > /dev/null;
# Create tmp folder for matplotlib
sudo mkdir -p /var/cache/matplotlib
sudo chown www-data /var/cache/matplotlib
# restart apache
sudo service apache2 stop
sudo service apache2 start
sudo systemctl status apache2.service -l
- name: Smoke Test mod_wsgi_startup.py
run: |
python /opt/iem/deployment/mod_wsgi_startup.py
- name: Run IEM Production checks
run: |
git clone --depth 1 https://github.com/akrherz/iem-production-checks.git .ipc
SERVICE=http://iem.local pytest -n 4 .ipc/tests/test_*.py
- name: Run mod_wsgi smoke test
run: |
set -e
pytest -n 4 test/test_mod_wsgi.py
- name: View Apache Logs
if: failure()
run: |
sudo systemctl status apache2 -l
sudo cat /var/log/apache2/error.log
- name: View PHP-FPM Logs
if: failure()
run: |
sudo cat /var/log/php*-fpm.log