Repository: sopherapps/xml_stream (language: python)

Issue:
Add CI via Github Actions
#### What's up

After reviewing #1 , I realized there is need for a proper Continuous Integration set up so as to catch major issues before a pull request is reviewed.


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml
new file mode 100644
index 0000000..c8f9de7
--- /dev/null
+++ b/.github/workflows/cd.yml
@@ -0,0 +1,75 @@
+on:
+  push:
+    branches:
+      - master
+    paths:
+      - "**.py"
+      - "**.xml"
+      - "requirements.txt"
+      - "deployment.yml"
+      - ".gitignore"
+      - ".github/workflows/**"
+      - "README.md"
+jobs:
+  test:
+    runs-on: ubuntu-18.04
+    strategy:
+      matrix:
+        python-version: [3.6, 3.7, 3.8, 3.9]
+
+    steps:
+      - name: Checkout the commit
+        uses: actions/checkout@v2
+
+      - name: Set up Python ${{ matrix.python-version }}
+        uses: actions/setup-python@v2
+        with:
+          python-version: ${{ matrix.python-version }}
+
+      - name: Install dependencies
+        run: |
+          python -m pip install --upgrade pip
+          python --version
+          pip install -r requirements.txt
+
+      - name: download huge file
+        run: |
+          cd $GITHUB_WORKSPACE
+          wget http://aiweb.cs.washington.edu/research/projects/xmltk/xmldata/data/SwissProt/SwissProt.xml
+          mv SwissProt.xml test/huge_mock.xml
+
+      - name: Run tests
+        run: |
+          cd $GITHUB_WORKSPACE
+          python -m unittest
+
+  build:
+    needs: test
+    runs-on: ubuntu-18.04
+    strategy:
+      matrix:
+        python-version: [3.6, 3.7, 3.8, 3.9]
+
+    steps:
+      - name: Checkout the commit
+        uses: actions/checkout@v2
+
+      - name: Set up Python ${{ matrix.python-version }}
+        uses: actions/setup-python@v2
+        with:
+          python-version: ${{ matrix.python-version }}
+
+      - name: Install dependencies
+        run: |
+          cd $GITHUB_WORKSPACE
+          python -m pip install --upgrade pip
+          python --version
+          pip install -r requirements.txt
+
+      - name: Build
+        run: |
+          python setup.py sdist bdist_wheel
+
+      - name: Upload to pypi
+        run: |
+          twine upload -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} dist/*
\ No newline at end of file
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..64771fe
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,41 @@
+on:
+  pull_request:
+    paths:
+      - "**.py"
+      - "**.xml"
+      - "requirements.txt"
+      - "deployment.yml"
+      - ".gitignore"
+      - ".github/workflows/**"
+jobs:
+  test:
+    runs-on: ubuntu-18.04
+    strategy:
+      matrix:
+        python-version: [3.6, 3.7, 3.8, 3.9]
+
+    steps:
+      - name: Checkout the commit
+        uses: actions/checkout@v2
+
+      - name: Set up Python ${{ matrix.python-version }}
+        uses: actions/setup-python@v2
+        with:
+          python-version: ${{ matrix.python-version }}
+
+      - name: Install dependencies
+        run: |
+          python -m pip install --upgrade pip
+          python --version
+          pip install -r requirements.txt
+
+      - name: download huge file
+        run: |
+          cd $GITHUB_WORKSPACE
+          wget http://aiweb.cs.washington.edu/research/projects/xmltk/xmldata/data/SwissProt/SwissProt.xml
+          mv SwissProt.xml test/huge_mock.xml
+
+      - name: Run tests
+        run: |
+          cd $GITHUB_WORKSPACE
+          python -m unittest
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index f9db92b..a03b99e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -138,4 +138,6 @@ dmypy.json
 cython_debug/
 
 # test mock file
-huge_mock.xml
\ No newline at end of file
+huge_mock.xml
+
+.idea/
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
deleted file mode 100644
index 105ce2d..0000000
--- a/.idea/inspectionProfiles/profiles_settings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<component name="InspectionProjectProfileManager">
-  <settings>
-    <option name="USE_PROJECT_PROFILE" value="false" />
-    <version value="1.0" />
-  </settings>
-</component>
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index bced091..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6 (xml_stream)" project-jdk-type="Python SDK" />
-</project>
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index 44604fa..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="ProjectModuleManager">
-    <modules>
-      <module fileurl="file://$PROJECT_DIR$/.idea/xml_stream.iml" filepath="$PROJECT_DIR$/.idea/xml_stream.iml" />
-    </modules>
-  </component>
-</project>
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 94a25f7..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="VcsDirectoryMappings">
-    <mapping directory="$PROJECT_DIR$" vcs="Git" />
-  </component>
-</project>
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
deleted file mode 100644
index 7a813ce..0000000
--- a/.idea/workspace.xml
+++ /dev/null
@@ -1,166 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="ChangeListManager">
-    <list default="true" id="ceb31947-feba-41ba-97f9-42799eee34aa" name="Default Changelist" comment="">
-      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
-    </list>
-    <option name="SHOW_DIALOG" value="false" />
-    <option name="HIGHLIGHT_CONFLICTS" value="true" />
-    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
-    <option name="LAST_RESOLUTION" value="IGNORE" />
-  </component>
-  <component name="FileTemplateManagerImpl">
-    <option name="RECENT_TEMPLATES">
-      <list>
-        <option value="Python Script" />
-      </list>
-    </option>
-  </component>
-  <component name="Git.Settings">
-    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
-  </component>
-  <component name="ProjectId" id="1i1XFF8HT3uj8lpT6BPtGN6wIa9" />
-  <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
-  <component name="ProjectViewState">
-    <option name="hideEmptyMiddlePackages" value="true" />
-    <option name="showExcludedFiles" value="true" />
-    <option name="showLibraryContents" value="true" />
-  </component>
-  <component name="PropertiesComponent">
-    <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
-    <property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
-    <property name="last_opened_file_path" value="$PROJECT_DIR$/xml_stream/_utils.py" />
-  </component>
-  <component name="RecentsManager">
-    <key name="CopyFile.RECENT_KEYS">
-      <recent name="$PROJECT_DIR$/test" />
-    </key>
-  </component>
-  <component name="RunManager" selected="Python tests.Unittests in test_read_string.py">
-    <configuration name="Unittests for test_read_file.TestReadXmlString.test_read_xml_file_for_employees" type="tests" factoryName="Unittests" temporary="true" nameIsGenerated="true">
-      <module name="xml_stream" />
-      <option name="INTERPRETER_OPTIONS" value="" />
-      <option name="PARENT_ENVS" value="true" />
-      <option name="SDK_HOME" value="" />
-      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/test" />
-      <option name="IS_MODULE_SDK" value="true" />
-      <option name="ADD_CONTENT_ROOTS" value="true" />
-      <option name="ADD_SOURCE_ROOTS" value="true" />
-      <option name="_new_additionalArguments" value="&quot;&quot;" />
-      <option name="_new_target" value="&quot;test_read_file.TestReadXmlString.test_read_xml_file_for_employees&quot;" />
-      <option name="_new_targetType" value="&quot;PYTHON&quot;" />
-      <method v="2" />
-    </configuration>
-    <configuration name="Unittests for test_read_string.TestReadXmlString.test_read_xml_string_for_employees" type="tests" factoryName="Unittests" temporary="true" nameIsGenerated="true">
-      <module name="xml_stream" />
-      <option name="INTERPRETER_OPTIONS" value="" />
-      <option name="PARENT_ENVS" value="true" />
-      <option name="SDK_HOME" value="" />
-      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/test" />
-      <option name="IS_MODULE_SDK" value="true" />
-      <option name="ADD_CONTENT_ROOTS" value="true" />
-      <option name="ADD_SOURCE_ROOTS" value="true" />
-      <option name="_new_additionalArguments" value="&quot;&quot;" />
-      <option name="_new_target" value="&quot;test_read_string.TestReadXmlString.test_read_xml_string_for_employees&quot;" />
-      <option name="_new_targetType" value="&quot;PYTHON&quot;" />
-      <method v="2" />
-    </configuration>
-    <configuration name="Unittests for test_read_string.TestReadXmlString.test_read_xml_string_for_operations_department" type="tests" factoryName="Unittests" temporary="true" nameIsGenerated="true">
-      <module name="xml_stream" />
-      <option name="INTERPRETER_OPTIONS" value="" />
-      <option name="PARENT_ENVS" value="true" />
-      <option name="SDK_HOME" value="" />
-      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/test" />
-      <option name="IS_MODULE_SDK" value="true" />
-      <option name="ADD_CONTENT_ROOTS" value="true" />
-      <option name="ADD_SOURCE_ROOTS" value="true" />
-      <option name="_new_additionalArguments" value="&quot;&quot;" />
-      <option name="_new_target" value="&quot;test_read_string.TestReadXmlString.test_read_xml_string_for_operations_department&quot;" />
-      <option name="_new_targetType" value="&quot;PYTHON&quot;" />
-      <method v="2" />
-    </configuration>
-    <configuration name="Unittests in test_read_file.py" type="tests" factoryName="Unittests" temporary="true" nameIsGenerated="true">
-      <module name="xml_stream" />
-      <option name="INTERPRETER_OPTIONS" value="" />
-      <option name="PARENT_ENVS" value="true" />
-      <option name="SDK_HOME" value="" />
-      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/test" />
-      <option name="IS_MODULE_SDK" value="true" />
-      <option name="ADD_CONTENT_ROOTS" value="true" />
-      <option name="ADD_SOURCE_ROOTS" value="true" />
-      <option name="_new_additionalArguments" value="&quot;&quot;" />
-      <option name="_new_target" value="&quot;$PROJECT_DIR$/test/test_read_file.py&quot;" />
-      <option name="_new_targetType" value="&quot;PATH&quot;" />
-      <method v="2" />
-    </configuration>
-    <configuration name="Unittests in test_read_string.py" type="tests" factoryName="Unittests" temporary="true" nameIsGenerated="true">
-      <module name="xml_stream" />
-      <option name="INTERPRETER_OPTIONS" value="" />
-      <option name="PARENT_ENVS" value="true" />
-      <option name="SDK_HOME" value="" />
-      <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/test" />
-      <option name="IS_MODULE_SDK" value="true" />
-      <option name="ADD_CONTENT_ROOTS" value="true" />
-      <option name="ADD_SOURCE_ROOTS" value="true" />
-      <option name="_new_additionalArguments" value="&quot;&quot;" />
-      <option name="_new_target" value="&quot;$PROJECT_DIR$/test/test_read_string.py&quot;" />
-      <option name="_new_targetType" value="&quot;PATH&quot;" />
-      <method v="2" />
-    </configuration>
-    <recent_temporary>
-      <list>
-        <item itemvalue="Python tests.Unittests in test_read_string.py" />
-        <item itemvalue="Python tests.Unittests in test_read_file.py" />
-        <item itemvalue="Python tests.Unittests for test_read_file.TestReadXmlString.test_read_xml_file_for_employees" />
-        <item itemvalue="Python tests.Unittests for test_read_string.TestReadXmlString.test_read_xml_string_for_employees" />
-        <item itemvalue="Python tests.Unittests for test_read_string.TestReadXmlString.test_read_xml_string_for_operations_department" />
-      </list>
-    </recent_temporary>
-  </component>
-  <component name="SvnConfiguration">
-    <configuration />
-  </component>
-  <component name="TaskManager">
-    <task active="true" id="Default" summary="Default task">
-      <changelist id="ceb31947-feba-41ba-97f9-42799eee34aa" name="Default Changelist" comment="" />
-      <created>1601075965305</created>
-      <option name="number" value="Default" />
-      <option name="presentableId" value="Default" />
-      <updated>1601075965305</updated>
-    </task>
-    <servers />
-  </component>
-  <component name="WindowStateProjectService">
-    <state x="675" y="134" width="626" height="844" key="refactoring.ChangeSignatureDialog" timestamp="1611323670137">
-      <screen x="67" y="34" width="1853" height="1046" />
-    </state>
-    <state x="675" y="134" width="626" height="844" key="refactoring.ChangeSignatureDialog/67.34.1853.1046@67.34.1853.1046" timestamp="1611323670137" />
-  </component>
-  <component name="XDebuggerManager">
-    <breakpoint-manager>
-      <breakpoints>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/test/test_read_file.py</url>
-          <line>137</line>
-          <option name="timeStamp" value="34" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/xml_stream/data_types.py</url>
-          <line>45</line>
-          <option name="timeStamp" value="44" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/test/test_read_file.py</url>
-          <line>136</line>
-          <option name="timeStamp" value="55" />
-        </line-breakpoint>
-        <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
-          <url>file://$PROJECT_DIR$/test/test_read_file.py</url>
-          <line>139</line>
-          <option name="timeStamp" value="56" />
-        </line-breakpoint>
-      </breakpoints>
-    </breakpoint-manager>
-  </component>
-</project>
\ No newline at end of file
diff --git a/.idea/xml_stream.iml b/.idea/xml_stream.iml
deleted file mode 100644
index be85b6a..0000000
--- a/.idea/xml_stream.iml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module type="PYTHON_MODULE" version="4">
-  <component name="NewModuleRootManager">
-    <content url="file://$MODULE_DIR$">
-      <excludeFolder url="file://$MODULE_DIR$/env" />
-    </content>
-    <orderEntry type="jdk" jdkName="Python 3.6 (xml_stream)" jdkType="Python SDK" />
-    <orderEntry type="sourceFolder" forTests="false" />
-  </component>
-  <component name="PyDocumentationSettings">
-    <option name="format" value="PLAIN" />
-    <option name="myDocStringFormat" value="Plain" />
-  </component>
-</module>
\ No newline at end of file
diff --git a/README.md b/README.md
index f9debf6..a989f47 100644
--- a/README.md
+++ b/README.md
@@ -185,6 +185,10 @@ of the data as `xml.etree.ElementTree.Element` object by default, or as dicts wh
   
 - Download a huge xml file for test purposes and save it in the `/test` folder as `huge_mock.xml`
 
+  ```sh
+  wget http://aiweb.cs.washington.edu/research/projects/xmltk/xmldata/data/SwissProt/SwissProt.xml && mv SwissProt.xml test/huge_mock.xml
+  ```
+
 - Run the test command
 
   ```bash
diff --git a/setup.py b/setup.py
index fe31f88..cd8aecc 100644
--- a/setup.py
+++ b/setup.py
@@ -9,7 +9,7 @@
 
 setup(
     name="xml_stream",
-    version="0.0.7",
+    version="0.0.8",
     description="""
     A simple XML file and string reader to read big XML files and strings using iterators
     with optional conversion to dict
diff --git a/xml_stream/__init__.py b/xml_stream/__init__.py
index 69bbdf9..d6f983a 100644
--- a/xml_stream/__init__.py
+++ b/xml_stream/__init__.py
@@ -3,7 +3,7 @@
 from xml.etree import cElementTree as ElementTree
 from xml.etree.cElementTree import Element
 
-__version__ = "0.0.7"
+__version__ = "0.0.8"
 
 from .data_types import XmlDictElement, XmlListElement
 


Test patch:
diff --git a/test/test_read_file.py b/test/test_read_file.py
index ff59781..cd0f346 100644
--- a/test/test_read_file.py
+++ b/test/test_read_file.py
@@ -98,13 +98,13 @@ def setUp(self) -> None:
     def test_read_huge_xml_file_to_dict(self):
         """Can read a very big xml file easily to return iterator of dicts when to_dict is set to True"""
         if os.path.isfile(self.huge_mock_file_path):
-            for element in read_xml_file(self.small_mock_file_path, records_tag='staff', to_dict=True):
+            for element in read_xml_file(self.small_mock_file_path, records_tag='Entry', to_dict=True):
                 self.assertIsInstance(element, dict)
 
     def test_read_huge_xml_file_to_xml_element(self):
         """Can read a very big xml file easily to return iterator of xml.etree.ElementTree.Element by default"""
         if os.path.isfile(self.huge_mock_file_path):
-            for element in read_xml_file(self.small_mock_file_path, records_tag='staff'):
+            for element in read_xml_file(self.small_mock_file_path, records_tag='Entry'):
                 self.assertIsInstance(element, Element)
 
     def test_read_xml_file_to_dict_for_staff(self):