-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
162c0df
commit 03a270f
Showing
1 changed file
with
154 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
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 FoldOptLib --fix | ||
- uses: stefanzweifel/git-auto-commit-action@v5 | ||
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@v3 | ||
|
||
with: | ||
python-version: ${{ matrix.python }} | ||
- name: Installing dependencies | ||
shell: bash -l {0} | ||
run: | | ||
conda install -c conda-forge numpy scipy pytest matplotlib mplstereonet ipywidgets loopstructural -y | ||
- name: Building and install | ||
shell: bash -l {0} | ||
run: | | ||
pip install . --user | ||
- name: pytest | ||
shell: bash -l {0} | ||
run: | | ||
pytest | ||
release-please: | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/main' | ||
steps: | ||
- uses: GoogleCloudPlatform/release-please-action@v4 | ||
id: release | ||
with: | ||
release-type: python | ||
package-name: FoldOptLib | ||
version-file: FoldOptLib/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 | ||
|
||
conda-deploy: | ||
name: Building conda package 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@v3 | ||
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 numpy scipy loopstructural 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@v4 | ||
with: | ||
name: conda-${{ matrix.os }}-${{ matrix.python-version }} | ||
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 build | ||
python -m build | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: dist | ||
path: dist/ | ||
|
||
upload_to_conda: | ||
needs: ["release-please", "conda-deploy"] | ||
runs-on: ${{matrix.os}} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: ["ubuntu-latest"] | ||
python-version: ${{ fromJSON(vars.PYTHON_VERSIONS)}} | ||
if: ${{ needs.release-please.outputs.release_created }} | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: conda-${{ matrix.os }}-${{ matrix.python-version }} | ||
path: conda | ||
- uses: conda-incubator/setup-miniconda@v3 | ||
- 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 | ||
upload_to_pypi: | ||
needs: ["release-please", "conda-deploy"] | ||
runs-on: "ubuntu-latest" | ||
|
||
if: ${{ needs.release-please.outputs.release_created }} | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: dist | ||
path: dist | ||
- uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
skip_existing: true | ||
verbose: true | ||
user: ${{ secrets.PYPI_USERNAME }} | ||
password: ${{ secrets.PYPI_PASSWORD }} |