Update release-please.yml #318
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
name: release-please | |
jobs: | |
continuous-integration: | |
name: Continuous integration ${{ matrix.os }} python ${{ matrix.python-version }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ${{ fromJSON(vars.BUILD_OS)}} | |
python-version: ${{ fromJSON(vars.PYTHON_VERSIONS)}} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Installing dependencies | |
shell: bash -l {0} | |
run: | | |
conda install -c conda-forge cython numpy scipy scikit-image scikit-learn pyamg flake8 pytest networkx osqp matplotlib -y | |
- name: Checking formatting of code | |
shell: bash -l {0} | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 LoopStructural --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 LoopStructural --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Building and install | |
shell: bash -l {0} | |
run: | | |
python setup.py install build_ext --inplace | |
pip install . | |
- name: pytest | |
shell: bash -l {0} | |
run: | | |
pytest | |
documentation-test: | |
runs-on: ubuntu-latest | |
#needs: continuous-integration | |
steps: | |
- uses: actions/checkout@v2 | |
- run: | | |
cp CHANGELOG.md docs/source/getting_started/CHANGELOG.md | |
docker build . -t=lsdocs -f docs/Dockerfile | |
docker run -v $(pwd):/LoopStructural lsdocs bash LoopStructural/docs/build_docs.sh | |
- name: upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
path: docs/build/html | |
release-please: | |
runs-on: ubuntu-latest | |
needs: documentation-test | |
if: github.ref == 'refs/heads/master' | |
steps: | |
- uses: GoogleCloudPlatform/release-please-action@v3.5.0 | |
id: release | |
with: | |
release-type: python | |
package-name: LoopStructural | |
#version-file: LoopStructural/version.py | |
outputs: | |
release_created: ${{ steps.release.outputs.release_created }} | |
# if a release is created then run the deploy scripts for github.io, conda, pypi and docker | |
documentation-deploy: | |
runs-on: ubuntu-latest | |
needs: release-please | |
if: ${{ needs.release-please.outputs.release_created }} | |
steps: | |
- uses: actions/checkout@v2 | |
- run: | | |
cp CHANGELOG.md docs/source/getting_started/CHANGELOG.md | |
docker build . -t=lsdocs -f docs/Dockerfile | |
docker run -v $(pwd):/LoopStructural lsdocs bash LoopStructural/docs/build_docs.sh | |
- name: Deploy 🚀 | |
uses: JamesIves/github-pages-deploy-action@4.1.3 | |
with: | |
branch: gh-pages # The branch the action should deploy to. | |
folder: docs/build/html # The folder the action should deploy. | |
conda-deploy: | |
name: Uploading to Loop3d for python ${{ matrix.os }}) | |
needs: ["documentation-test", "continuous-integration"] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ${{ fromJSON(vars.BUILD_OS)}} | |
python-version: ${{ fromJSON(vars.PYTHON_VERSIONS)}} | |
steps: | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
python-version: ${{ matrix.python-version }} | |
- uses: actions/checkout@v2 | |
- name: update submodules | |
# shell: bash -l {0} | |
run: | | |
git submodule update --init --recursive | |
- name: Add msbuild to PATH | |
if: matrix.os == 'windows-latest' | |
uses: microsoft/setup-msbuild@v1.0.2 | |
- name: Conda build' | |
env: | |
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }} | |
shell: bash -l {0} | |
run: | | |
conda install -c conda-forge conda-build scikit-build numpy cython anaconda-client -y | |
conda build -c anaconda -c conda-forge -c loop3d --output-folder conda conda --numpy 1.21 | |
conda install anaconda-client -y | |
- name: upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: conda | |
path: conda | |
make_sdist: | |
needs: ["documentation-test", "continuous-integration"] | |
name: Make SDist | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build SDist | |
run: | | |
pip install numpy cython | |
python setup.py sdist | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: dist/*.tar.gz | |
build_wheels: | |
needs: ["documentation-test", "continuous-integration"] | |
name: Build wheels | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.12.0 | |
env: | |
CIBW_ARCHS_MACOS: x86_64 universal2 | |
CIBW_BUILD: "cp36-* cp37-* cp38-* cp39-* cp310*" | |
CIBW_BEFORE_BUILD: "pip install numpy cython" #make sure numpy is the same version as required by LS | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: ./wheelhouse/*.whl | |
upload_to_pypi: | |
needs: ["release-please","build_wheels","make_sdist","conda-deploy"] | |
runs-on: ubuntu-latest | |
#if: ${{ needs.release-please.outputs.release_created }} | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
- uses: actions/download-artifact@v3 | |
with: | |
name: conda | |
path: conda | |
- uses: pypa/gh-action-pypi-publish@v1.6.4 | |
with: | |
skip_existing: true | |
verbose: true | |
user: ${{ secrets.PYPI_USERNAME }} | |
password: ${{ secrets.PYPI_PASSWORD }} | |
- uses: conda-incubator/setup-miniconda@v2 | |
- name: upload all files to conda-forge | |
shell: bash -l {0} | |
env: | |
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }} | |
run: | | |
conda install -c anaconda anaconda-client -y | |
anaconda upload --label main conda/*/*.tar.bz2 | |