Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
bitlogik committed Aug 25, 2020
0 parents commit a889ef2
Show file tree
Hide file tree
Showing 1,808 changed files with 126,572 additions and 0 deletions.
226 changes: 226 additions & 0 deletions .azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
# Azure CI/CD for guardata

trigger:
branches:
include:
- '*'
tags:
include:
- '*'

variables:
python.version: '3.6'
postgresql.version: '10'
winfsp.version: '1.7.20172'
pytest.base_args: |
--log-level=DEBUG \
--durations=10 -v \
debug.stress_flaky_tests: 0

jobs:

#################################################################################
# Step 0: Wheel build

- job: 's0_build_wheel'
displayName: 'Build wheel'
timeoutInMinutes: 10
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: self
submodules: true
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
- bash: |
set -eux
sudo apt-get update
python --version
pip install -r pre-requirements.txt
displayName: 'Bootstrap'
- bash: |
set -eux
python setup.py bdist_wheel
displayName: 'Build Wheel'
- publish: dist/
artifact: wheel


#################################################################################
# Step 1: Tests

- job: 's1_qa'
displayName: 'Q&A'
timeoutInMinutes: 5
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: self
submodules: true
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
- bash: |
set -eux
sudo apt-get update
python --version
pip install pre-commit
displayName: 'Bootstrap'
- bash: |
set -eux
# Run all pre-commit hooks on all files
pre-commit run --all-files --show-diff-on-failure
displayName: 'Pre-commit hooks check'
#################################################################################

- job: 's1_linux_test'
displayName: 'Linux tests'
dependsOn: s0_build_wheel
timeoutInMinutes: 60
pool:
vmImage: 'ubuntu-latest'
variables:
PGINSTALLATION: '/usr/lib/postgresql/$(postgresql.version)/bin'
steps:
- checkout: self
submodules: true
- download: current
artifact: wheel
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
- bash: |
set -eux
sudo apt-get update
python --version
pip install -r pre-requirements.txt
sudo apt-get install \
postgresql-$(postgresql.version) \
desktop-file-utils # Provides `update-desktop-database` used by `tests/scripts/run_testenv.sh`
psql --version
displayName: 'Bootstrap'
- bash: |
set -eux
# Remove the guardata folder (force to use the wheel)
rm -rf guardata
# Install the guardata wheel with all dependencies
WHEEL=$(ls $(Pipeline.Workspace)/wheel/guardata-*.whl)
echo $WHEEL
pip install $WHEEL[all]
# Check dependency compatibility
pip check guardata[all]
displayName: 'Install'
- bash: |
set -eux
py.test $(pytest.base_args) \
tests --runmountpoint --runslow \
-n auto --max-worker-restart=0 -x \
--junitxml=test-results-memory.xml
displayName: 'Tests memory'
- bash: |
set -eux
py.test $(pytest.base_args) \
tests/backend tests/test_cli.py --postgresql --runslow \
-n auto --max-worker-restart=0 -x \
--junitxml=test-results-postgresql.xml
displayName: 'Tests postgresql'
# TODO: run gui tests with xvfb
# - bash: |
# set -eux
# py.test $(pytest.base_args) \
# tests -m gui --runmountpoint --runslow --rungui -x \
# --junitxml=test-results-gui.xml
# displayName: 'Tests GUI'
- task: PublishTestResults@2
inputs:
testResultsFiles: '$(Agent.TempDirectory)/test-results-*.xml'
testRunTitle: 'Linux'
condition: succeededOrFailed()


#################################################################################

- job: 's1_windows_test'
displayName: 'Windows tests'
dependsOn: s0_build_wheel
timeoutInMinutes: 60
pool:
vmImage: 'windows-latest'
variables:
PGINSTALLATION: C:\\Program Files\\PostgreSQL\\$(postgresql.version)\\bin
steps:
- checkout: self
submodules: true
- download: current
artifact: wheel
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
architecture: 'x64'
- bash: |
set -eux
python.exe --version
pip install -r pre-requirements.txt
choco install -y --no-progress winfsp --pre --version=$(winfsp.version)
# Install winfsp-test and put it in PATH
mkdir winfsp-test
curl -L https://github.com/billziss-gh/winfsp/releases/download/v1.7/winfsp-tests-1.7.20172.zip -o winfsp-test/winfsp-tests.zip
unzip winfsp-test/winfsp-tests.zip -d winfsp-test
echo "##vso[task.prependpath]$(Build.SourcesDirectory)\\winfsp-test"
displayName: 'Bootstrap'
- bash: |
set -eux
# Remove the guardata folder from the source to force use of the wheel
rm -rf guardata
# Install the guardata wheel with all dependencies
WHEEL_DIRECTORY=`python -c 'print(r"$(Pipeline.Workspace)/wheel".replace("\\\\", "/"))'`
WHEEL=$(ls $WHEEL_DIRECTORY/guardata-*.whl)
echo $WHEEL
pip install $WHEEL[all]
# Check dependency compatibility
pip check guardata[all]
# Check winfsp-tests availability
python.exe -c "import winfspy.tests.winfsp_tests"
displayName: 'Install'
- bash: |
set -eux
# Install pytest-repeat
pip install pytest-repeat
# Repeat flaky tests X times
py.test tests --runmountpoint --runslow --rungui -m flaky --count $(debug.stress_flaky_tests) -v
displayName: 'Debug: stress flaky tests'
condition: and(succeeded(), gt(variables['debug.stress_flaky_tests'], 0))
- bash: |
set -eux
py.test $(pytest.base_args) \
tests -n auto --max-worker-restart=0 -x \
--junitxml=test-results-fast.xml
displayName: 'Tests fast'
- bash: |
set -eux
py.test $(pytest.base_args) \
tests --runmountpoint --runslow -m mountpoint -x \
--junitxml=test-results-mountpoint.xml
displayName: 'Tests mountpoint'
- bash: |
set -eux
py.test $(pytest.base_args) \
tests --runmountpoint --runslow --rungui -m gui -x \
--junitxml=test-results-gui.xml
displayName: 'Tests GUI'
- bash: |
set -eux
py.test $(pytest.base_args) \
tests --runslow -m slow \
-n auto --max-worker-restart=0 -x \
--junitxml=test-results-slow.xml
displayName: 'Tests slow'
- task: PublishTestResults@2
inputs:
testResultsFiles: '$(Agent.TempDirectory)/test-results-*.xml'
testRunTitle: 'Windows'
condition: succeededOrFailed()

5 changes: 5 additions & 0 deletions .babel.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[extractors]
qt = guardata.client.gui.babel_qt_extractor:extract_qt

[qt: **.ts]
[python: **.py]
77 changes: 77 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
venv/
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log

# PyBuilder
target/

# gnupg stuff
random_seed

# PyQt resource bundle, automatically generated
guardata/client/gui/_resources_rc.py

# PyQtforms, automatically generated
guardata/client/gui/ui/*.py
!guardata/client/gui/ui/__init__.py

# QtCreator temporary files
*.ui.autosave

# History html file, automatically generated
guardata/client/gui/rc/generated_misc/

# Temporary files
*~
*#
.#*
Loading

0 comments on commit a889ef2

Please sign in to comment.