Skip to content

Commit

Permalink
Merge pull request #21 from akrherz/ci
Browse files Browse the repository at this point in the history
CI Updates
  • Loading branch information
akrherz authored Sep 22, 2023
2 parents 7c52a06 + 76b226f commit 60e5f9f
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 23 deletions.
53 changes: 40 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,63 @@
name: Install and Test
on: [push, pull_request]
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 }})
runs-on: ubuntu-latest
strategy:
matrix:
PYTHON_VERSION: ["3.8", "3.9", "3.10"]
PYTHON_VERSION: ["3.9", "3.10", "3.11"]
env:
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Add /etc/hosts entries
run: |
echo 127.0.0.1 rtstats.local | sudo tee -a /etc/hosts
echo 127.0.0.1 memcached.local | sudo tee -a /etc/hosts
echo 127.0.0.1 rtstatstest | sudo tee -a /etc/hosts
# 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 CI from ci-tooling
- name: Copy default settings
run: |
cp config/settings.json-in config/settings.json
- name: Setup Postgres
run: |
git clone --depth 1 https://github.com/akrherz/ci_tooling.git .ci_tooling
. .ci_tooling/postgres.sh
sudo ln -s `pwd` /opt/rtstats
. .ci_tooling/miniconda.sh
. .ci_tooling/mod_wsgi.sh
pip install --upgrade pip
cp config/settings.json-in config/settings.json
export PATH="/usr/lib/postgresql/11/bin:$PATH"
psql -c 'CREATE ROLE runner SUPERUSER LOGIN CREATEDB;' -U postgres || true
cd database; sh bootstrap.sh
python schema_manager.py
cd ..
- name: Install requirements via pip
run: |
python -m pip install -r pip_requirements.txt
- name: Setup and run example
run: |
sudo ln -s `pwd` /opt/rtstats
cat test/rtstats_example.txt | python app/run.py
sudo cat /var/log/apache2/error.log
12 changes: 10 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
ci:
autoupdate_schedule: quarterly
repos:
- repo: https://github.com/python/black
rev: 22.8.0
- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.0.290"
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]

6 changes: 0 additions & 6 deletions conda_requirements.txt

This file was deleted.

4 changes: 2 additions & 2 deletions database/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
psql -c "create user nobody with password 'secret';" -U postgres
psql -c "create user ldm with password 'secret';" -U postgres

psql -c "create database rtstats;" -U postgres
psql -f init/rtstats.sql -U postgres rtstats
createdb -O ldm -U postgres rtstats
psql -f init/rtstats.sql -U ldm rtstats
7 changes: 7 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dependencies:
- matplotlib-base
- pandas
- psycopg2
- python-memcached
- pytz
- twisted
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
[tool.black]
line-length = 79

[tool.ruff]
select = ["E", "F", "I"]
target-version = "py39"

0 comments on commit 60e5f9f

Please sign in to comment.