pacifica/pacifica-proxy

View on GitHub
appveyor.yml

Summary

Maintainability
Test Coverage
version: 0.1.{build}
pull_requests:
  do_not_increment_build_number: true

services:
  - postgresql

environment:
  PGUSER: postgres
  PGPASSWORD: Password12!
  PGSQL_PATH: C:\Program Files\PostgreSQL\9.6
  PEEWEE_URL: postgres://postgres:Password12!@localhost/pacifica_metadata
  matrix:
    - PYTHON: C:\Python36-x64
    - PYTHON: C:\Python37-x64
    - PYTHON: C:\Python38-x64

install:
  - ps: >
      & "$env:PYTHON\python.exe" -m virtualenv C:\pacifica;
      Invoke-WebRequest -Uri "http://nginx.org/download/nginx-1.14.0.zip" -OutFile nginx.zip;
      Expand-Archive "nginx.zip" -DestinationPath "C:\nginx";
      $nginx_conf = (Get-Content travis\nginx.conf.in);
      pushd C:\nginx\nginx-1.14.0;
      $nginx_conf.replace('@@ROOT_DIR@@', $PWD.path.replace('\', '\\')).replace('@@CONF_DIR@@', "C:\\nginx\\nginx-1.14.0\\conf") | Out-File -filepath C:\nginx\nginx-1.14.0\conf\nginx.conf;
      dos2unix C:\nginx\nginx-1.14.0\conf\nginx.conf;
      popd;
      Start-Process C:\nginx\nginx-1.14.0\nginx.exe -WorkingDirectory "C:\nginx\nginx-1.14.0";
      C:\pacifica\Scripts\activate.ps1;
      python -m pip install --upgrade pip setuptools wheel;
      pip install -r requirements-dev.txt;
      pip install .;
      echo "done";

build: off

before_test:
  - ps: >
      $env:PATH = "${env:PGSQL_PATH}\bin;${env:PYTHON}\Scripts;${env:PATH}";
      createdb pacifica_metadata;
      C:\pacifica\Scripts\activate.ps1;
      $env:METADATA_CPCONFIG = "$PWD/travis/metadata/server.conf";
      $env:ARCHIVEINTERFACE_CPCONFIG = "$PWD/travis/archivei/server.conf";
      pacifica-metadata-cmd dbsync;
      Start-Process C:\pacifica\Scripts\pacifica-metadata.exe -RedirectStandardError metadata-error.log -RedirectStandardOutput metadata-output.log;
      Start-Process C:\pacifica\Scripts\pacifica-archiveinterface.exe -RedirectStandardError archive-error.log -RedirectStandardOutput archive-output.log;
      $MD_VERSION = `pip show pacifica-metadata | grep Version: | awk '{ print $2 }';
      Invoke-WebRequest https://github.com/pacifica/pacifica-metadata/archive/v${MD_VERSION}.zip -OutFile pacifica-metadata.zip;
      Expand-Archive pacifica-metadata.zip -DestinationPath C:\pacifica-metadata;
      pushd C:\pacifica-metadata\pacifica-metadata-${MD_VERSION};
      sleep 10; Invoke-WebRequest http://localhost:8121/users;
      python tests\test_files\loadit_test.py;
      popd;
      Invoke-WebRequest -InFile README.md -Method PUT -Headers @{'Last-Modified'='Sun, 06 Nov 1994 08:49:37 GMT'} http://127.0.0.1:8080/104;
      $size = (Get-Item README.md).length;
      $hash = (Get-FileHash -Algorithm sha1 readme.md).hash;
      '{ "hashsum": "'+$hash.ToLower()+'", "hashtype": "sha1", "size": '+$size+'}' | Invoke-WebRequest -Method POST -Headers @{ "content-type" = "application/json" } http://127.0.0.1:8121/files?_id=104;


test_script:
  - ps: >
      C:\pacifica\Scripts\activate.ps1;
      pre-commit run -a;
      $env:PROXY_CPCONFIG = "$PWD/server.conf";
      cd tests;
      coverage run -m pytest -xsv;
      coverage report --include='*pacifica/proxy/*' -m --fail-under=100;