Commit adf6d2ae authored by Gmodena's avatar Gmodena
Browse files

Merge branch 'refactor-packaging' into 'main'

Packaging ImageMatching as a Python wheel

See merge request gmodena/ImageMatching!32
parents 7cb80f12 b3ace785
Pipeline #1062 passed with stages
in 54 seconds
name: build
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.7, ]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
make venv
- name: Lint python files with flake8
run: |
make flake8
- uses: olafurpg/setup-scala@v10
with:
java-version: adopt@1.8
- name: Install Apache Spark
run: |
# This command will install vanilla spark under ./spark-2.4.8-bin-hadoop2.7
make install_spark
- name: Test with pytest
run: |
export SPARK_HOME=$(pwd)/spark-2.4.8-bin-hadoop2.7
export PYTHONPATH=${SPARK_HOME}/python:${SPARK_HOME}/python/lib/py4j-0.10.7-src.zip:${PYTHONPATH}
export PATH=${PATH}:${SPARK_HOME}/bin:${SPARK_HOME}/sbin
make test
build/
dist/
venv/
algorunner.egg-info
.ipynb_checkpoints/
image: "python:3.7"
stages:
- build
- test
- publish
build-job:
stage: build
script:
- |
# convert notebook to pyspark script
make py
artifacts:
paths:
- build/algorithm.py
expire_in: 1 week
# TODO(gmodena): investigate why CI_JOB_TOKEN is not expanded correctly when set in .pypirc
publish-package:
stage: publish
when: manual
script:
- make venv
- . venv/bin/activate; python setup.py sdist bdist_wheel
- TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token ./venv/bin/python -m twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/* --verbose