Compatibility with tera #249
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: CI | |
on: [ push, pull_request ] | |
jobs: | |
build: | |
env: | |
REPOLOGY_CONFIG: repology-test.conf.default | |
POSTGRESQL: 15 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
curl -s https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - | |
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main $POSTGRESQL" > /etc/apt/sources.list.d/pgdg.list' | |
sudo apt-get update | |
sudo apt-get install postgresql-$POSTGRESQL postgresql-server-dev-$POSTGRESQL tidy | |
- name: Install libversion | |
run: | | |
mkdir _libversion | |
cd _libversion | |
curl -sL https://github.com/repology/libversion/archive/master.tar.gz | tar -xzf- --strip-components 1 | |
cmake . | |
make | |
sudo make install | |
sudo ldconfig | |
- name: Install postgresql-libversion | |
run: | | |
mkdir _postgresql-libversion | |
cd _postgresql-libversion | |
curl -sL https://github.com/repology/postgresql-libversion/archive/master.tar.gz | tar -xzf- --strip-components 1 | |
make | |
sudo make install | |
- name: Install python dependencies | |
run: | | |
pip install -r requirements.txt | |
pip install -r requirements-dev.txt | |
pip install codecov | |
- name: Prepare database | |
run: | | |
sudo sed -i -e 's|peer|trust|' /etc/postgresql/$POSTGRESQL/main/pg_hba.conf | |
sudo sed -i -e 's|5433|5432|' /etc/postgresql/$POSTGRESQL/main/postgresql.conf | |
sudo pg_ctlcluster $POSTGRESQL main restart | |
sudo -u postgres psql -c "CREATE DATABASE repology_test;" | |
sudo -u postgres psql -c "CREATE USER repology_test WITH PASSWORD 'repology_test'" | |
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE repology_test TO repology_test" | |
sudo -u postgres psql -d repology_test -c "GRANT CREATE ON SCHEMA public TO PUBLIC" | |
sudo -u postgres psql -d repology_test -c "CREATE EXTENSION IF NOT EXISTS pg_trgm" | |
sudo -u postgres psql -d repology_test -c "CREATE EXTENSION IF NOT EXISTS libversion" | |
psql -U repology_test < testdata/repology_test.sql | |
- name: Update repology config | |
run: | | |
# https://packages.ubuntu.com/kinetic/all/fonts-dejavu-core/filelist | |
echo "BADGE_FONT = '/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf'" >> $REPOLOGY_CONFIG | |
echo "BADGE_FONT_BOLD = '/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf'" >> $REPOLOGY_CONFIG | |
- name: Test all target | |
run: make | |
- name: Check with flake8 | |
run: make flake8 | |
- name: Check with mypy | |
run: make mypy | |
- name: Run unit tests | |
run: make test | |
env: | |
PYTEST_ARGS: --cov-report=xml --cov=repologyapp | |
- name: Push coverage info | |
run: codecov |