Skip to content

raylim build

raylim build #237

Workflow file for this run

name: luna build and deploy
run-name: ${{ github.actor }} build
on: [push]
jobs:
build:
runs-on: ubuntu-20.04
container:
image: mambaorg/micromamba:1.0.0
options: --user root
steps:
- name: Install required packages
run: |
apt-get update
apt-get install -y build-essential libgdal-dev liblapack-dev libblas-dev gfortran libgl1 git curl make
git config --system --add safe.directory *
- uses: actions/checkout@v3
- uses: actions/cache@v3
id: cache
with:
path: ./venv
key: ${{ runner.os }}-${{ hashFiles('environment.yml', 'poetry.lock', 'pyproject.toml')}}
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
micromamba create -y -p ./venv -f environment.yml
. ./venv/bin/activate
poetry export --without-hashes -f requirements.txt --dev | SETUPTOOLS_USE_DISTUTILS=stdlib pip install --no-deps -r /dev/stdin
- name: Build project
run: |
. ./venv/bin/activate
poetry config virtualenvs.create false
poetry build
pip install --no-deps --force-reinstall dist/*.whl
- name: Lint with flake8
run: |
. ./venv/bin/activate
# 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 with pytest
run: |
. ./venv/bin/activate
export LUNA_HOME=$PWD
pytest -v --capture=tee-sys --show-capture=all tests --cov-report=xml --junitxml=./luna-tests/results.xml
- name: Build mkdocs
run: |
. ./venv/bin/activate
export LUNA_HOME=$PWD
mkdocs build
- name: Deploy mkdocs
if: github.event_name == 'push' && github.ref == 'refs/heads/dev'
run: |
. ./venv/bin/activate
export LUNA_HOME=$PWD
mkdocs gh-deploy --force
deploy:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-20.04
container:
image: mambaorg/micromamba:1.0.0
options: --user root
steps:
- name: Install required packages
run: |
apt-get update
apt-get install -y git
- uses: actions/checkout@v3
- name: Build project
run: |
micromamba create -y -p ./venv -f environment.yml
. ./venv/bin/activate
poetry config virtualenvs.create false
poetry build
# temporarily turn branch protection off for semantic release
- name: Branch protection OFF
uses: octokit/request-action@v2.x
with:
route: PUT /repos/msk-mind/luna/branches/master/protection
repository: ${{ github.repository }}
required_status_checks: |
null
enforce_admins: |
null
required_pull_request_reviews: |
null
restrictions: |
null
env:
GITHUB_TOKEN: ${{ secrets.GIT_ADMIN_TOKEN }}
# create a git release
- name: Release pyluna
uses: relekang/python-semantic-release@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
pypi_token: ${{ secrets.PYPI_TOKEN }}
# turn branch protection back on
- name: Branch protection ON
uses: octokit/request-action@v2.x
with:
route: PUT /repos/msk-mind/luna/branches/master/protection
repository: ${{ github.repository }}
required_status_checks: |
null
enforce_admins: |
null
required_pull_request_reviews: |
required_approving_review_count: 1
restrictions: |
null
env:
GITHUB_TOKEN: ${{ secrets.GIT_ADMIN_TOKEN }}
- name: Publish pyluna to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
packages_dir: ./dist