Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Windows CI #21

Merged
merged 13 commits into from
Oct 20, 2023
2 changes: 1 addition & 1 deletion .github/workflows/docker-build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

name: Docker build and push
name: Docker build

on:
workflow_dispatch:
Expand Down
47 changes: 45 additions & 2 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
name: Python tests
name: Tests

on: [push]
on:
workflow_dispatch:
push:
branches:
- 'main'
tags:
- 'v*.*.*'
pull_request:
branches:
- 'main'

jobs:
main-tests:
Expand Down Expand Up @@ -36,3 +45,37 @@ jobs:
run: |
tox run -e pep8
tox run -e py -- tests

windows-main-tests:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Install tox (and any other packages)
run: pip install tox
- name: Run tox
run: |
tox run -e pep8
tox run -e py -- tests
tox run -e py -- integration-tests

windows-compatibility-tests:
runs-on: windows-latest
strategy:
matrix:
python: ["3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install tox (and any other packages)
run: pip install tox
- name: Run tox
run: |
tox run -e pep8
tox run -e py -- tests
10 changes: 4 additions & 6 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Contributing code
3. Write a test for your new feature/bugfix and run it, ensuring
that it fails on the current implementation::

py.test tests/test_my_code.py
pytest tests/test_my_code.py

NameErrors, ImportErrors, SyntaxErrors, etc. do not count (they indicate the
API is wrong).
Expand All @@ -29,9 +29,7 @@ Contributing code

tox run

Optionally, run integration tests (you must have Redis_ server
version 2.8 or later in your path; do ``redis-server --version``
to check)::
Optionally, run integration tests::

tox run -- integration-tests

Expand All @@ -41,10 +39,10 @@ Contributing code
``n-issue-abbrev`` where ``n`` is the issue number and
``issue-abbrev`` is a very short abbreviation of the issue title)
and ensure that the build passes. The build is defined in
``.gitlab-ci.yml`` (``.travis.yml`` and ``appveyor.yml`` for public
``.gitlab-ci.yml`` (``.github/workflows`` for public
builds); tox is configured in ``tox.ini``. The build
includes unit tests, integration tests, and style checks and runs on
Python 3.5 across multiple platforms; if it fails, please
Python 3.8 across multiple platforms; if it fails, please
find the error in the build log, fix it, and try again.
9. Add a line to ``CHANGELOG`` under the current version-in-progress
describing your changes simply and concisely. Add yourself to ``AUTHORS``
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Tutorial
:target: https://badge.fury.io/py/concrete
.. image:: https://github.com/hltcoe/concrete-python/actions/workflows/tox.yml/badge.svg
:target: https://github.com/hltcoe/concrete-python/actions/workflows/tox.yml
.. image:: https://ci.appveyor.com/api/projects/status/0346c3lu11vj8xqj?svg=true
:target: https://ci.appveyor.com/project/cjmay/concrete-python-f3iqf
.. image:: https://github.com/hltcoe/concrete-python/actions/workflows/docker-build-and-push.yml/badge.svg
:target: https://github.com/hltcoe/concrete-python/actions/workflows/docker-build-and-push.yml


Concrete-python is the Python interface to Concrete_, a
Expand Down
15 changes: 0 additions & 15 deletions appveyor.yml

This file was deleted.

11 changes: 6 additions & 5 deletions integration-tests/test_create_comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,23 @@
from pytest import fixture, mark
from concrete.util import CommunicationReader
from concrete.validate import validate_communication
import os
import sys
from subprocess import Popen, PIPE


@fixture
def text():
return u'''\
return '''\
Madame Magloire comprit, et elle alla chercher sur la cheminée de la \
chambre à coucher de monseigneur les deux chandeliers d'argent \
qu'elle posa sur la table tout allumés.

qu'elle posa sur la table tout allumés.\
''' + os.linesep + os.linesep + '''\
—Monsieur le curé, dit l'homme, vous êtes bon. Vous ne me méprisez \
pas. Vous me recevez chez vous. Vous allumez vos cierges pour moi. \
Je ne vous ai pourtant pas caché d'où je viens et que je suis un homme \
malheureux.
'''
malheureux.\
''' + os.linesep


@fixture
Expand Down
29 changes: 16 additions & 13 deletions integration-tests/test_file_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,33 +193,36 @@ def test_CommunicationReader_nested_zip_file():


def test_CommunicationReader_dir_without_recursive():
root_path = os.path.join('tests', 'testdata', 'a', 'c')
with raises(ValueError):
CommunicationReader("tests/testdata/a/c")
CommunicationReader(root_path)


def test_CommunicationReader_dir():
reader = CommunicationReader("tests/testdata/a/c", recursive=True)
root_path = os.path.join('tests', 'testdata', 'a', 'c')
reader = CommunicationReader(root_path, recursive=True)
[filenames, comms] = zip(*sorted((f, c) for (c, f) in reader))
assert hasattr(comms[0], 'sentenceForUUID')
assert hasattr(comms[1], 'sentenceForUUID')
assert u'two' == comms[0].id
assert u'three' == comms[1].id
assert u'tests/testdata/a/c/simple_2.concrete' == filenames[0]
assert u'tests/testdata/a/c/simple_3.concrete' == filenames[1]
assert 'two' == comms[0].id
assert 'three' == comms[1].id
assert os.path.join(root_path, 'simple_2.concrete') == filenames[0]
assert os.path.join(root_path, 'simple_3.concrete') == filenames[1]


def test_CommunicationReader_nested_dir():
reader = CommunicationReader("tests/testdata/a", recursive=True)
root_path = os.path.join('tests', 'testdata', 'a')
reader = CommunicationReader(root_path, recursive=True)
[filenames, comms] = zip(*sorted((f, c) for (c, f) in reader))
assert hasattr(comms[0], 'sentenceForUUID')
assert hasattr(comms[1], 'sentenceForUUID')
assert hasattr(comms[2], 'sentenceForUUID')
assert u'one' == comms[0].id
assert u'two' == comms[1].id
assert u'three' == comms[2].id
assert u'tests/testdata/a/b/simple_1.concrete' == filenames[0]
assert u'tests/testdata/a/c/simple_2.concrete' == filenames[1]
assert u'tests/testdata/a/c/simple_3.concrete' == filenames[2]
assert 'one' == comms[0].id
assert 'two' == comms[1].id
assert 'three' == comms[2].id
assert os.path.join(root_path, 'b', 'simple_1.concrete') == filenames[0]
assert os.path.join(root_path, 'c', 'simple_2.concrete') == filenames[1]
assert os.path.join(root_path, 'c', 'simple_3.concrete') == filenames[2]


def test_CommunicationReader_explicit_single_file():
Expand Down