Skip to content

Build

Build #108

Workflow file for this run

name: Build
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
release:
types:
- published
jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [3.7, 3.8, 3.9]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
miniconda-version: "latest"
activate-environment: ent
channels: conda-forge
- name: Bash
shell: bash -l {0}
run: |
conda install -c conda-forge enterprise_extensions pytest pytest-cov coverage twine -y
python -m pip install -e .
conda info
conda list
#- name: Run lint
# run: make lint
- name: Test with pytest
shell: bash -l {0}
run: make test
- name: Codecov
uses: codecov/codecov-action@v1
build:
needs: [tests]
name: Build source distribution
runs-on: ubuntu-latest
# if: github.event_name == 'release'
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.9"
- name: Build
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
pip install -r requirements_dev.txt
make dist
- name: Test deployability
run: |
pip install twine
twine check dist/*
- name: Test the sdist
run: |
mkdir tmp
cd tmp
python -m venv venv-sdist
venv-sdist/bin/python -m pip install --upgrade pip setuptools wheel
venv-sdist/bin/python -m pip install ../dist/la_forge*.tar.gz
venv-sdist/bin/python -c "import la_forge;print(la_forge.__version__)"
- name: Test the wheel
run: |
mkdir tmp2
cd tmp2
python -m venv venv-wheel
venv-wheel/bin/python -m pip install --upgrade pip setuptools
venv-wheel/bin/python -m pip install ../dist/la_forge*.whl
venv-wheel/bin/python -c "import la_forge;print(la_forge.__version__)"
- uses: actions/upload-artifact@v2
with:
name: dist
path: dist/*
deploy:
needs: [tests, build]
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Download wheel/dist from build
uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload dist/*