Skip to content

ci: release please needs v? #360

ci: release please needs v?

ci: release please needs v? #360

on:
push:
name: release-please
jobs:
linting:
name: Linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black ruff
- name: Autoformat with black
run: |
black .
- name: Lint with ruff
run: |
ruff check LoopStructural --fix
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "style: style fixes by ruff and autoformatting by black"
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@v4
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python }}
- name: Installing dependencies
shell: bash -l {0}
run: |
conda install -c conda-forge numpy scipy scikit-image scikit-learn pytest networkx osqp matplotlib -y
- name: Building and install
shell: bash -l {0}
run: |
pip install . --user
- name: pytest
shell: bash -l {0}
run: |
pytest
documentation-test:
runs-on: ubuntu-latest
#needs: continuous-integration
steps:
- uses: actions/checkout@v4
- 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@v4
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@v4
- 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: ["ubuntu-latest"]
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@v4
- name: update submodules
# shell: bash -l {0}
run: |
git submodule update --init --recursive
- 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
conda convert -p all conda/linux-64/*.tar.bz2 -f -o conda
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@v4
- name: Build SDist
run: |
pip install numpy
python setup.py sdist
pip wheel -w wheelhouse .
- uses: actions/upload-artifact@v3
with:
name: dist
path: dist/*.tar.gz
- uses: actions/upload-artifact@v3
with:
name: dist
path: wheelhouse/*.whl
upload_to_pypi:
needs: ["release-please", "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