Skip to content

Commit

Permalink
Merge pull request #439 from aapatre/develop
Browse files Browse the repository at this point in the history
Fix enrollment issues and bump library versions (#438)
  • Loading branch information
cullzie committed Feb 21, 2024
2 parents 6ccbbad + dcff56a commit 1705269
Show file tree
Hide file tree
Showing 12 changed files with 294 additions and 114 deletions.
20 changes: 20 additions & 0 deletions .github/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
changelog:
exclude:
labels:
- ignore-for-release
authors:
- octocat
- restyled-commits
categories:
- title: "Breaking Changes :hammer_and_wrench:"
labels:
- breaking-change
- title: "New Features :tada:"
labels:
- enhancement
- title: "Bug Fixes :bug:"
labels:
- bug
- title: Other Changes
labels:
- "*"
61 changes: 61 additions & 0 deletions .github/workflows/publish-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
on:
workflow_dispatch:
inputs:
pypi_token:
description: 'The pypi token to publish with'
required: true
pypi_url:
description: 'The pypi url to publish to'
required: true
pypi_variable:
description: 'The pypi variable'
required: true
# push:
# tags:
# - '[0-9]+.[0-9]+.[0-9]+'

name: Publish Release

jobs:
publish-to-pypi:
name: Publish to pypi
strategy:
fail-fast: false
matrix:
python-version: [ 3.11 ]
poetry-version: [ 1.3.2 ]
os: [ ubuntu-latest ]

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Run image
uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Publish
env:
PYPI_TOKEN: ${{ inputs.pypi_token }}
PYPI_URL: ${{ inputs.pypi_url }}
PYPI_VARIABLE: ${{ inputs.pypi_variable }}
run: |
poetry config repositories.$PYPI_VARIABLE $PYPI_URL
poetry config pypi-token.$PYPI_VARIABLE $PYPI_TOKEN
poetry publish --build -r $PYPI_VARIABLE
# create-github-release:
# name: Create GitHub Release
# runs-on: ubuntu-latest
# needs: publish-to-pypi
# permissions:
# contents: write
# steps:
# - name: Checkout code
# uses: actions/checkout@v3
# - name: Create Release
# run: gh release create ${{ github.ref }} --generate-notes
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ jobs:
UDEMY_PASSWORD: ${{ secrets.UDEMY_PASSWORD }}
CI_TEST: "True"
run: |
poetry run python run_enroller.py --browser=chrome --debug
poetry run python run_enroller.py --debug
58 changes: 58 additions & 0 deletions .github/workflows/start-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Start Release

on:
workflow_dispatch:
inputs:
version:
description: 'Semver type of new version (major / minor / patch)'
required: true
type: choice
options:
- patch
- minor
- major
environment:
description: 'The environment to deploy for'
required: true
type: choice
default: master
options:
- master
- develop

jobs:
bump-version:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Check out the content (source branch). Use a deploy key so that
# when we push changes, it will trigger the release workflow
# run that runs on: tag. (Using the GitHub token would
# not run the workflow to prevent infinite recursion.)
- name: Check out source
uses: actions/checkout@v2
with:
ssh-key: ${{ secrets.DEPLOY_KEY }}
env_vars: |
DEPLOYMENT_ENVIRONMENT=${{ github.event.inputs.environment }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set up cache
uses: actions/cache@v2
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install --only dev
- name: Setup Git
run: |
git config user.name 'octocat'
git config user.email '20401034+cullzie@users.noreply.github.com'
- name: Bump version
run: poetry run bumpver update --push --${{ github.event.inputs.version }}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [4.1.4] - 2023-07-26

### Fixed
- Fixing issues with enrollment
- Updating libraries

## [4.1.3] - 2023-03-07

### Added
Expand Down Expand Up @@ -122,6 +128,8 @@ can continue as normal
project running locally. Suitable for users who are not looking forward to
contribute.

[4.1.4]:
https://github.com/aapatre/Automatic-Udemy-Course-Enroller-GET-PAID-UDEMY-COURSES-for-FREE/releases/tag/v4.1.4
[4.1.3]:
https://github.com/aapatre/Automatic-Udemy-Course-Enroller-GET-PAID-UDEMY-COURSES-for-FREE/releases/tag/v4.1.3
[4.1.2]:
Expand Down
40 changes: 21 additions & 19 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,35 @@ classifiers = [

[tool.poetry.dependencies]
python = "^3.8"
selenium = "^3.141.0"
beautifulsoup4 = "^4.11.1"
"ruamel.yaml" = "^0.16.13"
cloudscraper = "^1.2.60"
requests = "^2.27.1"
webdriver-manager = "^3.7.0"
aiohttp = {extras = ["speedups"], version = "^3.8.1"}
price-parser = "^0.3.4"
# Rest based dependencies
beautifulsoup4 = "4.11.1"
"ruamel.yaml" = "0.17.32"
cloudscraper = "1.2.71"
requests = "2.31.0"
aiohttp = {extras = ["speedups"], version = "3.8.4"}
price-parser = "0.3.4"
# UI based dependencies
selenium = "4.10.0"
webdriver-manager = "3.8.6"

[tool.poetry.dev-dependencies]
black = "^22.3.0"
isort = "^5.10.1"
pytest = "^7.1.2"
black = "^22.12.0"
isort = "^5.12.0"
pytest = "^7.4.0"
pytest-cov = "^3.0.0"
pytest-asyncio = "^0.18.3"
bumpver = "^2022.1116"
bumpver = "^2022.1120"
flake8 = "^5.0.4"
flake8-bugbear = "^22.9.23"
flake8-docstrings = "^1.6.0"
flake8-isort = "^5.0.0"
flake8-bugbear = "^22.12.6"
flake8-docstrings = "^1.7.0"
flake8-isort = "^5.0.3"

[tool.isort]
profile = "black"

[tool.bumpver]
current_version = "4.1.3"
version_pattern = "MAJOR.MINOR.PATCH"
current_version = "v4.1.3"
version_pattern = "vMAJOR.MINOR.PATCH"
commit_message = "Bump version {old_version} -> {new_version}"
commit = true
tag = true
Expand All @@ -50,10 +52,10 @@ push = false
[tool.bumpver.file_patterns]
"pyproject.toml" = [
'current_version = "{version}"',
'version = "{version}"',
'^version = "{pep440_version}"',
]
"setup.py" = [
'version="{version}"',
'version="{pep440_version}"',
]

[build-system]
Expand Down
12 changes: 6 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
aiohttp[speedups]==3.8.1
aiohttp[speedups]==3.8.4
beautifulsoup4==4.11.1
ruamel.yaml==0.16.13
requests==2.27.1
cloudscraper==1.2.60
webdriver-manager==3.7.0
selenium==3.141.0
ruamel.yaml==0.17.32
requests==2.31.0
cloudscraper==1.2.71
price-parser==0.3.4
webdriver-manager==3.8.6
selenium==4.10.0
12 changes: 6 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
),
python_requires=">=3.8, <4",
install_requires=[
"aiohttp[speedups]==3.8.1",
"aiohttp[speedups]==3.8.4",
"beautifulsoup4==4.11.1",
"ruamel.yaml==0.16.13",
"requests==2.27.1",
"cloudscraper==1.2.60",
"webdriver-manager==3.7.0",
"selenium==3.141.0",
"ruamel.yaml==0.17.32",
"requests==2.31.0",
"cloudscraper==1.2.71",
"webdriver-manager==3.8.6",
"selenium==4.10.0",
"price-parser==0.3.4",
],
setup_requires=["pytest-runner"],
Expand Down
33 changes: 23 additions & 10 deletions tests/core/test_driver_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,25 @@
)
@mock.patch("udemy_enroller.driver_manager.webdriver")
@mock.patch("udemy_enroller.driver_manager.ChromeDriverManager")
@mock.patch("udemy_enroller.driver_manager.ChromeService")
@mock.patch("udemy_enroller.driver_manager.GeckoDriverManager")
@mock.patch("udemy_enroller.driver_manager.FirefoxService")
@mock.patch("udemy_enroller.driver_manager.EdgeChromiumDriverManager")
@mock.patch("udemy_enroller.driver_manager.EdgeService")
@mock.patch("udemy_enroller.driver_manager.IEDriverManager")
@mock.patch("udemy_enroller.driver_manager.IEService")
@mock.patch("udemy_enroller.driver_manager.OperaDriverManager")
@mock.patch("udemy_enroller.driver_manager.ChromeType")
def test_driver_manager_init(
_,
mock_opera_driver_manager,
mock_internet_explorer_service,
mock_internet_explorer_driver_manager,
mock_edge_service,
mock_edge_driver_manager,
mock_firefox_service,
mock_firefox_driver_manager,
mock_chrome_service,
mock_chrome_driver_manager,
mock_selenium_web_driver,
browser_name,
Expand All @@ -57,32 +65,35 @@ def test_driver_manager_init(
else:
if browser_name in ("chrome",):
mock_selenium_web_driver.Chrome.assert_called_once_with(
mock_chrome_driver_manager().install(), options=None
service=mock_chrome_service(mock_chrome_driver_manager().install()),
options=None,
)
assert dm.driver == mock_selenium_web_driver.Chrome()
elif browser_name in ("chromium",):
mock_selenium_web_driver.Chrome.assert_called_once_with(
mock_chrome_driver_manager().install()
service=mock_chrome_service(mock_chrome_driver_manager().install())
)
assert dm.driver == mock_selenium_web_driver.Chrome()
elif browser_name in VALID_FIREFOX_STRINGS:
mock_selenium_web_driver.Firefox.assert_called_once_with(
executable_path=mock_firefox_driver_manager().install()
service=mock_firefox_service(mock_firefox_driver_manager().install())
)
assert dm.driver == mock_selenium_web_driver.Firefox()
elif browser_name in VALID_OPERA_STRINGS:
mock_selenium_web_driver.Opera.assert_called_once_with(
executable_path=mock_opera_driver_manager().install()
mock_chrome_service.assert_called_once_with(
mock_opera_driver_manager().install()
)
assert dm.driver == mock_selenium_web_driver.Opera()
assert dm.driver == mock_selenium_web_driver.Remote()
elif browser_name in VALID_EDGE_STRINGS:
mock_selenium_web_driver.Edge.assert_called_once_with(
mock_edge_driver_manager().install()
service=mock_edge_service(mock_edge_driver_manager().install())
)
assert dm.driver == mock_selenium_web_driver.Edge()
elif browser_name in VALID_INTERNET_EXPLORER_STRINGS:
mock_selenium_web_driver.Ie.assert_called_once_with(
mock_internet_explorer_driver_manager().install()
service=mock_internet_explorer_service(
mock_internet_explorer_driver_manager().install()
)
)
assert dm.driver == mock_selenium_web_driver.Ie()

Expand All @@ -96,25 +107,27 @@ def test_driver_manager_init(
ids=("chrome is ci build", "chrome is not ci build"),
)
@mock.patch("udemy_enroller.driver_manager.webdriver")
@mock.patch("udemy_enroller.driver_manager.ChromeService")
@mock.patch("udemy_enroller.driver_manager.ChromeOptions")
@mock.patch("udemy_enroller.driver_manager.ChromeDriverManager")
@mock.patch("udemy_enroller.driver_manager.ChromeType")
def test_driver_manager_ci_build(
_,
mock_chrome_driver_manager,
mock_chrome_options,
mock_chrome_service,
mock_selenium_web_driver,
browser_name,
is_ci_build,
):

dm = DriverManager(browser_name, is_ci_build=is_ci_build)

if is_ci_build:
options = mock_chrome_options()
else:
options = None
mock_selenium_web_driver.Chrome.assert_called_once_with(
mock_chrome_driver_manager().install(), options=options
service=mock_chrome_service(mock_chrome_driver_manager().install()),
options=options,
)
assert dm.driver == mock_selenium_web_driver.Chrome()
Loading

0 comments on commit 1705269

Please sign in to comment.