From 197cbbc2ad4ceadb0e09987820f19780f4846aa1 Mon Sep 17 00:00:00 2001 From: adelhpour <> Date: Thu, 7 Dec 2023 19:13:36 -0800 Subject: [PATCH 1/4] GitHub actions workflow is created This workflow - runs if there is either a new pull request or a commit to the 'develop' branch - tests all the python tests which are present in the 'tellurium/tests' repository - upload the artifacts to PyPI in case a commit is made into the 'develop' repository and the tests are passed --- .github/workflows/main.yml | 48 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..1b3dfb75 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,48 @@ +name: Python Tests and Wheel + +on: + pull_request: + branches: + - '*' + push: + branches: + - develop + +jobs: + test-and-build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.11 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Run Python Tests + run: | + pytest tellurium/tests + continue-on-error: true + + - name: Build Wheel if Tests Pass + if: success() + run: | + python setup.py bdist_wheel + continue-on-error: true + + - name: Upload to PyPI + if: success() && github.event_name == 'push' && github.ref == 'refs/heads/develop' + run: | + python -m pip install --upgrade pip + pip install twine + twine upload dist/* + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} From b2f88598df29c46e3b63c9fa35e60bc49bf4d025 Mon Sep 17 00:00:00 2001 From: adelhpour <> Date: Thu, 7 Dec 2023 19:22:57 -0800 Subject: [PATCH 2/4] In GitHub workflow: - libncurses is now install before running the tests - a check if the version is changed is added before uploading the artifacts --- .github/workflows/main.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1b3dfb75..23485b99 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,6 +21,11 @@ jobs: with: python-version: 3.11 + - name: Install libncurses.so.5 + run: | + sudo apt-get update + sudo apt-get install -y libncurses5 + - name: Install dependencies run: | python -m pip install --upgrade pip @@ -38,7 +43,7 @@ jobs: continue-on-error: true - name: Upload to PyPI - if: success() && github.event_name == 'push' && github.ref == 'refs/heads/develop' + if: success() && github.event_name == 'push' && github.ref == 'refs/heads/develop' && github.event.before != '0000000000000000000000000000000000000000' && paths('tellurium/Versions.txt') run: | python -m pip install --upgrade pip pip install twine From a8928c0db30cbba0b3c5750d20e75b8a0be9b1f2 Mon Sep 17 00:00:00 2001 From: adelhpour <> Date: Thu, 7 Dec 2023 19:24:03 -0800 Subject: [PATCH 3/4] In GitHub workflow: - continue on error action is removed --- .github/workflows/main.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 23485b99..5f7b4d48 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -34,13 +34,11 @@ jobs: - name: Run Python Tests run: | pytest tellurium/tests - continue-on-error: true - name: Build Wheel if Tests Pass if: success() run: | python setup.py bdist_wheel - continue-on-error: true - name: Upload to PyPI if: success() && github.event_name == 'push' && github.ref == 'refs/heads/develop' && github.event.before != '0000000000000000000000000000000000000000' && paths('tellurium/Versions.txt') From abfd715a8a1737078948aa1a697cdd83441d6f77 Mon Sep 17 00:00:00 2001 From: adelhpour <> Date: Thu, 7 Dec 2023 19:25:50 -0800 Subject: [PATCH 4/4] In GitHub workflow: - removing the check on the change in the versions.txt file --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5f7b4d48..6f3bd7dc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,7 +41,7 @@ jobs: python setup.py bdist_wheel - name: Upload to PyPI - if: success() && github.event_name == 'push' && github.ref == 'refs/heads/develop' && github.event.before != '0000000000000000000000000000000000000000' && paths('tellurium/Versions.txt') + if: success() && github.event_name == 'push' && github.ref == 'refs/heads/develop' run: | python -m pip install --upgrade pip pip install twine