Omnibus #2151
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
# Lots of daryl's codes use aliases defined in /etc/hosts | |
- name: Add /etc/hosts entries | |
run: | | |
cat .github/workflows/etchosts.txt | sudo tee -a /etc/hosts | |
# Copy repo's default settings into the real position | |
- name: Copy PHP Setting Defaults | |
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 | |
# Get postgresql running and setup the database | |
- name: Setup Postgres | |
run: | | |
set -e | |
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 | |
cd .ci_tooling | |
. postgres.sh | |
cd .. | |
cd database; sh bootstrap.sh | |
python schema_manager.py | |
# Get memcached running | |
- name: Setup Memcached | |
run: | | |
set -e | |
cd .ci_tooling | |
. memcached.sh | |
# Get apache running, which is needed to build mod_wsgi | |
- name: Configure IEM Webfarm Server | |
run: | | |
set -e | |
cd .ci_tooling | |
. iemwebfarm.sh | |
# conda-forge does not have everything we need, yet | |
- name: Install Python requirements from pip | |
run: | | |
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: Setup Directory Paths | |
run: | | |
set -e | |
sudo ln -s `pwd` /opt/iem | |
sudo ln -s $HOME/micromamba /opt/miniconda3 | |
- name: Configure Webfarm Server | |
run: | | |
set -e | |
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 | |
# ci_tooling places a mod_wsgi conf with startup disabled, we enable it | |
sudo sed -i 's/# WSGIImportScript/WSGIImportScript/' /etc/apache2/sites-enabled/mod_wsgi.conf | |
# restart apache | |
sudo service apache2 restart | |
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 |