From 5ce8b9904b4cc1672904d07bbbd9ec3c5576b4c3 Mon Sep 17 00:00:00 2001 From: Ray Luo Date: Tue, 6 Apr 2021 16:15:48 -0700 Subject: [PATCH 1/5] CI Proper way to install this package --- .github/workflows/python-package.yml | 57 ++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/python-package.yml diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 0000000..15a03e0 --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,57 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: CI + +on: + push: + pull_request: + branches: [ dev ] + # This guards against unknown PR until a community member vet it and label it. + types: [ labeled ] + +jobs: + ci: + + runs-on: ${{ matrix.os }} + strategy: + matrix: + python-version: [3.7, 3.8, 3.9, 2.7] + os: [ubuntu-latest, windows-latest, macos-latest] + include: + # https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-environment-variables-in-a-matrix + - python-version: 3.7 + toxenv: "py37" + - python-version: 3.8 + toxenv: "py38" + - python-version: 3.9 + toxenv: "py39" + - python-version: 2.7 + toxenv: "py27" + - python-version: 3.9 + os: ubuntu-latest + lint: "true" + steps: + - 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 -m pip install pylint tox + pip install . + - name: Lint + if: ${{ matrix.lint == 'true' }} + run: | + pylint msal_extensions + # stop the build if there are Python syntax errors or undefined names + #flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + #flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test + env: + TOXENV: ${{ matrix.toxenv }} + run: | + tox From e82a72abc864684120c1c278ffbc52465299f5bf Mon Sep 17 00:00:00 2001 From: Ray Luo Date: Tue, 6 Apr 2021 17:39:48 -0700 Subject: [PATCH 2/5] Install Linux dependencies --- .github/workflows/python-package.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 15a03e0..fad70bb 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -37,6 +37,16 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} + - name: Install Linux dependencies for Python 2 + if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '2.7' }} + run: | + sudo apt update + sudo apt install python-dev libgirepository1.0-dev libcairo2-dev gir1.2-secret-1 + - name: Install Linux dependencies for Python 3 + if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version != '2.7' }} + run: | + sudo apt update + sudo apt install python3-dev libgirepository1.0-dev libcairo2-dev gir1.2-secret-1 - name: Install dependencies run: | python -m pip install --upgrade pip From 80eb2b0adfda6734f39708fa564681ca438a61a5 Mon Sep 17 00:00:00 2001 From: Ray Luo Date: Tue, 6 Apr 2021 18:03:14 -0700 Subject: [PATCH 3/5] Install PyGObject Different way to install python-gi Try also pip install pygobject --- .github/workflows/python-package.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index fad70bb..1449fbe 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -41,13 +41,18 @@ jobs: if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '2.7' }} run: | sudo apt update - sudo apt install python-dev libgirepository1.0-dev libcairo2-dev gir1.2-secret-1 + sudo apt install python-dev libgirepository1.0-dev libcairo2-dev gir1.2-secret-1 python-gi - name: Install Linux dependencies for Python 3 if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version != '2.7' }} run: | sudo apt update - sudo apt install python3-dev libgirepository1.0-dev libcairo2-dev gir1.2-secret-1 - - name: Install dependencies + sudo apt install python3-dev libgirepository1.0-dev libcairo2-dev gir1.2-secret-1 python3-gi + - name: Opt In to Install PyGObject + if: ${{ matrix.os == 'ubuntu-latest' }} + run: | + python -m pip install --upgrade pip + python -m pip install pygobject + - name: Install Python dependencies run: | python -m pip install --upgrade pip python -m pip install pylint tox From c16d56ba52a02cbfbd9225630aa6c3e99e20f870 Mon Sep 17 00:00:00 2001 From: Ray Luo Date: Fri, 16 Apr 2021 23:31:04 -0700 Subject: [PATCH 4/5] Apply learnings from recent docker experiment minor adjustment --- .github/workflows/python-package.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 1449fbe..cc177e6 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -41,13 +41,13 @@ jobs: if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '2.7' }} run: | sudo apt update - sudo apt install python-dev libgirepository1.0-dev libcairo2-dev gir1.2-secret-1 python-gi + sudo apt install python-dev libgirepository1.0-dev libcairo2-dev gir1.2-secret-1 gnome-keyring - name: Install Linux dependencies for Python 3 if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version != '2.7' }} run: | sudo apt update - sudo apt install python3-dev libgirepository1.0-dev libcairo2-dev gir1.2-secret-1 python3-gi - - name: Opt In to Install PyGObject + sudo apt install python3-dev libgirepository1.0-dev libcairo2-dev gir1.2-secret-1 gnome-keyring + - name: Install PyGObject on Linux if: ${{ matrix.os == 'ubuntu-latest' }} run: | python -m pip install --upgrade pip @@ -55,7 +55,7 @@ jobs: - name: Install Python dependencies run: | python -m pip install --upgrade pip - python -m pip install pylint tox + python -m pip install pylint tox pytest pip install . - name: Lint if: ${{ matrix.lint == 'true' }} @@ -65,7 +65,15 @@ jobs: #flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide #flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test + - name: Test on Linux with encryption + if: ${{ matrix.os == 'ubuntu-latest' }} + run: | + # Don't know why, but the pytest and "." have to be re-installed again for them to be used + echo "echo secret_placeholder | gnome-keyring-daemon --unlock; pip install pytest .; pytest" > linux_test.sh + chmod +x linux_test.sh + sudo dbus-run-session -- ./linux_test.sh + - name: Test on other platforms without encryption + if: ${{ matrix.os != 'ubuntu-latest' }} env: TOXENV: ${{ matrix.toxenv }} run: | From 22ccf9b2fe6d57bc668949b8ff617cba521a7f17 Mon Sep 17 00:00:00 2001 From: Ray Luo Date: Wed, 14 Apr 2021 17:56:20 -0700 Subject: [PATCH 5/5] Temporarily disable lint --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index cc177e6..d2eac20 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -60,7 +60,7 @@ jobs: - name: Lint if: ${{ matrix.lint == 'true' }} run: | - pylint msal_extensions + #pylint msal_extensions # stop the build if there are Python syntax errors or undefined names #flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide