Skip to content

Commit 11d3db0

Browse files
committed
feat: Add package publishing workflow (#99)
Also adds github ci workflow and removes circleci config as part of #100
1 parent 72705b6 commit 11d3db0

File tree

23 files changed

+585
-110
lines changed

23 files changed

+585
-110
lines changed

.circleci/config.yml

Lines changed: 0 additions & 78 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Python CI
2+
on:
3+
pull_request: {}
4+
workflow_dispatch: {}
5+
push:
6+
branches: [master]
7+
8+
concurrency:
9+
group: "${{ github.workflow }}-${{ github.ref }}"
10+
cancel-in-progress: true
11+
12+
jobs:
13+
commitlint:
14+
uses: openedx/.github/.github/workflows/commitlint.yml@master
15+
16+
run_tests:
17+
name: tests
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
matrix:
21+
os: [ubuntu-20.04]
22+
python-version: ['3.8']
23+
toxenv: [py38-django32, quality]
24+
25+
steps:
26+
- uses: actions/checkout@v3
27+
- name: setup python
28+
uses: actions/setup-python@v4
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
32+
- name: Install pip
33+
run: pip install -r requirements/pip.txt
34+
35+
- name: Install Dependencies
36+
run: pip install -r requirements/ci.txt
37+
38+
- name: Run Tests
39+
env:
40+
TOXENV: ${{ matrix.toxenv }}
41+
run: tox

.github/workflows/pypi-publish.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: pypi-publish
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch: {}
7+
8+
jobs:
9+
publish-package:
10+
runs-on: ubuntu-20.04
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
16+
- name: setup python
17+
uses: actions/setup-python@v3
18+
with:
19+
python-version: 3.8
20+
21+
- name: Install pip
22+
run: pip install pip
23+
24+
- name: Install Dependencies
25+
run: pip install setuptools wheel
26+
27+
- name: Build package
28+
run: python setup.py sdist bdist_wheel
29+
30+
- name: Publish to PyPi
31+
uses: pypa/gh-action-pypi-publish@release/v1
32+
with:
33+
user: __token__
34+
password: ${{ secrets.PYPI_PUBLISH_TOKEN }}

Makefile

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
.DEFAULT_GOAL := help
44

5-
FIREFOX_VERSION := "94.0.1"
5+
FIREFOX_VERSION := "67.0"
66
FIREFOX_LINUX_ARCH := $(shell uname -m)
77

88
help: ## display this help message
@@ -24,19 +24,43 @@ clean: ## remove generated byte code, coverage reports, and build artifacts
2424
rm -fr dist/
2525
rm -fr *.egg-info
2626

27+
# Define PIP_COMPILE_OPTS=-v to get more information during make upgrade.
28+
PIP_COMPILE = pip-compile --upgrade $(PIP_COMPILE_OPTS)
29+
30+
upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade
31+
upgrade: ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
32+
pip install -qr requirements/pip-tools.txt
33+
# Make sure to compile files after any other files they include!
34+
$(PIP_COMPILE) --allow-unsafe -o requirements/pip.txt requirements/pip.in
35+
$(PIP_COMPILE) -o requirements/pip-tools.txt requirements/pip-tools.in
36+
pip install -qr requirements/pip.txt
37+
pip install -qr requirements/pip-tools.txt
38+
$(PIP_COMPILE) -o requirements/base.txt requirements/base.in
39+
$(PIP_COMPILE) -o requirements/ci.txt requirements/ci.in
40+
$(PIP_COMPILE) -o requirements/dev.txt requirements/dev.in
41+
2742
quality: ## check coding style with pycodestyle and pylint
2843
pycodestyle poll --max-line-length=120
2944
pylint poll
3045

3146
node_requirements: ## Install requirements for handlebar templates i18n extraction
3247
npm install
3348

34-
python_requirements: ## install development environment requirements
35-
pip install -r requirements.txt --exists-action w
36-
pip install -r requirements-dev.txt --exists-action w
49+
python_requirements: install_linux_dev_firefox ## install development environment requirements
50+
pip install wheel
51+
pip install -r requirements/base.txt --exists-action w
52+
pip install -r requirements/dev.txt --exists-action w
53+
ifeq ($(VIRTUAL_ENV),)
3754
cd ./src/xblock-sdk && \
38-
pip install -r requirements/base.txt && \
39-
pip install -r requirements/test.txt
55+
pip install -r requirements/base.txt && \
56+
pip install -r requirements/test.txt
57+
else
58+
cd $(VIRTUAL_ENV)/src/xblock-sdk && \
59+
pip install -r requirements/base.txt && \
60+
pip install -r requirements/test.txt
61+
endif
62+
pip uninstall -y selenium
63+
pip install selenium==3.4.1
4064
pip install -e .
4165

4266
requirements: node_requirements python_requirements ## install development environment requirements
@@ -52,15 +76,16 @@ install_linux_dev_firefox: ## Downloads custom version of firefox for Selenium i
5276
--output .firefox/firefox.tar.bz2
5377

5478
cd .firefox && tar -xvjf firefox.tar.bz2
55-
cd .geckodriver && wget https://github.com/mozilla/geckodriver/releases/download/v0.15.0/geckodriver-v0.15.0-linux64.tar.gz
56-
cd .geckodriver && tar -xzf geckodriver-v0.15.0-linux64.tar.gz
79+
cd .geckodriver && wget https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz
80+
cd .geckodriver && tar -xzf geckodriver-v0.26.0-linux64.tar.gz
5781

5882
linux_dev_test: ## Run tests in development environment to use custom firefox
59-
PATH=.firefox/firefox/:.geckodriver/:$(PATH) make test
83+
mkdir -p var
84+
PATH=.firefox/firefox/:.geckodriver/:$(PATH) xvfb-run python run_tests.py
6085

6186
test: ## run tests in the current virtualenv
62-
mkdir -p var # for var/workbench.log
63-
python run_tests.py --with-coverage --cover-package=poll
87+
mkdir -p var
88+
DJANGO_SETTINGS_MODULE=workbench.settings pytest
6489

6590
selfcheck: ## check that the Makefile is well-formed
6691
@echo "The Makefile is well-formed."

poll/poll.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1220,7 +1220,7 @@ def vote(self, data, suffix=''):
12201220

12211221
# Make sure the answer values are sane.
12221222
for key, value in data.items():
1223-
if value not in answers.keys():
1223+
if value not in answers:
12241224
result['success'] = False
12251225
result['errors'].append(
12261226
self.ugettext(

poll/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
# http://django-statici18n.readthedocs.io/en/latest/settings.html
6666

6767
with open(os.path.join(BASE_DIR, 'poll/translations/config.yaml'), 'r') as locale_config_file:
68-
locale_config = yaml.load(locale_config_file)
68+
locale_config = yaml.load(locale_config_file, Loader=yaml.SafeLoader)
6969

7070
LANGUAGES = [
7171
(code, code,)

pylintrc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ disable=
2424
unused-argument,
2525
useless-object-inheritance,
2626
import-outside-toplevel,
27-
super-with-arguments
27+
super-with-arguments,
28+
consider-using-f-string,
29+
unspecified-encoding,
30+
redundant-u-string-prefix
2831

2932
[SIMILARITIES]
3033
min-similarity-lines=8

requirements-dev.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Internationalization and Localization requirements
2-
-e 'git://github.com/edx/xblock-sdk.git@v0.1.6#egg=xblock-sdk==v0.1.6 ; python_version == "2.7"'
3-
-e 'git://github.com/edx/xblock-sdk.git#egg=xblock-sdk ; python_version > "2.7"'
2+
-e 'git+https://github.com/openedx/xblock-sdk.git@v0.1.6#egg=xblock-sdk==v0.1.6 ; python_version == "2.7"'
3+
-e 'git+https://github.com/openedx/xblock-sdk.git@0.4.0#egg=xblock-sdk==0.4.0 ; python_version > "2.7"'
44

55
Django~=1.11; python_version == '2.7'
66
Django>=2.2, <3.3; python_version > '2.7'
@@ -15,4 +15,3 @@ edx-i18n-tools==0.5.0
1515
pycodestyle==2.4.0
1616
pylint
1717
tox==3.14.0
18-
django-nose==1.4.6

requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
markdown
2-
-e git://github.com/edx/xblock-utils.git@2.1.0#egg=xblock-utils
2+
-e git+https://github.com/openedx/xblock-utils.git@2.2.0#egg=xblock-utils
33
ddt
44
mock
5-
django-nose==1.4.6
65
bleach==3.1.5
76
-e .

requirements/base.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Core requirements for using this application
2+
-c constraints.txt
3+
4+
markdown
5+
-e git+https://github.com/openedx/xblock-utils.git@2.2.0#egg=xblock-utils
6+
ddt
7+
mock
8+
bleach==5.0.0

0 commit comments

Comments
 (0)