-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #105 from AzureAD/release-0.3.1
Release 0.3.1
- Loading branch information
Showing
16 changed files
with
319 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
# 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 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 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 gnome-keyring | ||
- name: Install PyGObject on Linux | ||
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 pytest | ||
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 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: | | ||
tox | ||
cd: | ||
needs: ci | ||
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags') || github.ref == 'refs/heads/master') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
- name: Build a package for release | ||
run: | | ||
python -m pip install build --user | ||
python -m build --sdist --wheel --outdir dist/ . | ||
- name: Publish to TestPyPI | ||
uses: pypa/gh-action-pypi-publish@v1.4.2 | ||
if: github.ref == 'refs/heads/master' | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
repository_url: https://test.pypi.org/legacy/ | ||
- name: Publish to PyPI | ||
if: startsWith(github.ref, 'refs/tags') | ||
uses: pypa/gh-action-pypi-publish@v1.4.2 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -332,3 +332,5 @@ ASALocalRun/ | |
|
||
# MFractors (Xamarin productivity tool) working folder | ||
.mfractor/ | ||
|
||
.eggs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# TODO: Can this Dockerfile use multi-stage build? | ||
# Final size 690MB. (It would be 1.16 GB if started with python:3 as base) | ||
FROM python:3-slim | ||
|
||
# Install Generic PyGObject (sans GTK) | ||
#The following somehow won't work: | ||
#RUN apt-get update && apt-get install -y python3-gi python3-gi-cairo | ||
RUN apt-get update && apt-get install -y \ | ||
libcairo2-dev \ | ||
libgirepository1.0-dev \ | ||
python3-dev | ||
RUN pip install "pygobject>=3,<4" | ||
|
||
# Install MSAL Extensions dependencies | ||
# Don't know how to get container talk to dbus on host, | ||
# so we choose to create a self-contained image by installing gnome-keyring | ||
RUN apt-get install -y \ | ||
gir1.2-secret-1 \ | ||
gnome-keyring | ||
|
||
# Not strictly necessary, but we include a pytest (which is only 3MB) to facilitate testing. | ||
RUN pip install "pytest>=6,<7" | ||
|
||
# Install MSAL Extensions. Upgrade the pinned version number to trigger a new image build. | ||
RUN pip install "msal-extensions==0.3" | ||
|
||
# This setup is inspired from https://github.com/jaraco/keyring#using-keyring-on-headless-linux-systems-in-a-docker-container | ||
ENTRYPOINT ["dbus-run-session", "--"] | ||
# Note: gnome-keyring-daemon needs previleged mode, therefore can not be run by a RUN command. | ||
CMD ["sh", "-c", "echo default_secret | gnome-keyring-daemon --unlock; bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/bash | ||
IMAGE_NAME=msal-extensions:latest | ||
|
||
docker build -t $IMAGE_NAME - < Dockerfile | ||
|
||
echo "==== Integration Test for Persistence on Linux (libsecret) ====" | ||
echo "After seeing the bash prompt, run the following to test encryption on Linux:" | ||
echo " pip install -e ." | ||
echo " pytest" | ||
docker run --rm -it \ | ||
--privileged \ | ||
-w /home -v $PWD:/home \ | ||
$IMAGE_NAME \ | ||
$1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.