Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create metapackage #35

Merged
merged 34 commits into from
Aug 4, 2022
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a9ad52c
Mv PyAnsys folder to src/pyansys and remove build folder
RobPasMue Jul 29, 2022
c8a2621
Adapt gitignore
RobPasMue Jul 29, 2022
17cb8d9
Point docs to proper folder
RobPasMue Jul 29, 2022
2ee426d
Adapt to pyproject.toml and create install configs
RobPasMue Jul 29, 2022
55c443c
Import version in __init__ file
RobPasMue Jul 29, 2022
d515f79
"all" dependencies should be explicitly mentioned
RobPasMue Jul 29, 2022
858b92d
WIP on poetry
RobPasMue Jul 29, 2022
6d14422
Implementing pre-commit + cleaning reqs
RobPasMue Aug 1, 2022
381c798
Add vale config
RobPasMue Aug 1, 2022
46c78cc
Removing reqs file
RobPasMue Aug 1, 2022
8f81a40
Updating vale accepted words
RobPasMue Aug 1, 2022
0c5bceb
Creating an actual CI
RobPasMue Aug 1, 2022
d948704
Update docs build stage
RobPasMue Aug 1, 2022
d7bfc59
Change jobs description
RobPasMue Aug 1, 2022
32e84fa
Update .github/workflows/ci-build.yml
RobPasMue Aug 1, 2022
1344505
Removing _version and simplifying things
RobPasMue Aug 1, 2022
0162138
Remove unnecessary line
RobPasMue Aug 1, 2022
d7097d2
Simplifyinf conf.py
RobPasMue Aug 1, 2022
61c2184
Generate wheelhouse for different targets
RobPasMue Aug 1, 2022
72e56ec
Missing target in extras-import stage for wheel build
RobPasMue Aug 1, 2022
c1e3c1a
Limit to Python 3 for now
RobPasMue Aug 1, 2022
885c5d2
Merge branch 'feat/create-metapackage' of https://github.com/pyansys/…
RobPasMue Aug 1, 2022
47f15ec
Wheelhouse already generates all imports
RobPasMue Aug 1, 2022
d8c02b1
Comment problematic dependencies for now
RobPasMue Aug 1, 2022
9a014aa
Install wheelhouse when needed
RobPasMue Aug 1, 2022
afd8164
Remove Python 3.10 version for now
RobPasMue Aug 1, 2022
a150773
Improve description of extras jobs
RobPasMue Aug 1, 2022
b8781fb
Upgrade pip
RobPasMue Aug 1, 2022
f1a1fdc
Remove pip upgrades - did not solve the problem
RobPasMue Aug 1, 2022
17d3845
Update pyproject.toml
RobPasMue Aug 1, 2022
499d8ab
Apply suggestions from code review by @akaszynski
RobPasMue Aug 4, 2022
64d2a3c
Commiting @jorgepiloto's suggestion
RobPasMue Aug 4, 2022
304df0f
Pre-commit check
RobPasMue Aug 4, 2022
24241d4
Apply suggestions from code review
RobPasMue Aug 4, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
282 changes: 256 additions & 26 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,289 @@
# Build documentation
name: Documentation Build
name: GitHub CI
on:
pull_request:
workflow_dispatch:
push:
tags:
- "*"
branches:
- main

on: [push, pull_request, workflow_dispatch]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
PACKAGE_NAME: pyansys
MAIN_PYTHON_VERSION: '3.9'

jobs:
docs_build:
runs-on: ubuntu-20.04

style:
name: Code Style Check
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup Python
uses: actions/[email protected]
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- name: Install pre-commit
run: pip install pre-commit

- name: Run pre-commit
run: pre-commit run --all-files --show-diff-on-failure

docs-style:
name: Documentation Style Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Running Vale
uses: errata-ai/vale-action@reviewdog
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
files: '["doc", "README.rst"]'
reporter: github-pr-check
level: error
filter_mode: nofilter
fail_on_error: true
vale_flags: "--config=doc/.vale.ini"

core-import:
name: Build core PyAnsys packages
runs-on: ${{ matrix.os }}
needs: [style]
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
# python-version: ['3.7', '3.8', '3.9', '3.10']
RobPasMue marked this conversation as resolved.
Show resolved Hide resolved
python-version: ['3.7', '3.8', '3.9']
fail-fast: false

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: ${{ matrix.python-version }}

- name: Style Check
- name: Linux pip cache
uses: actions/cache@v3
if: ${{ runner.os == 'Linux' }}
with:
path: ~/.cache/pip
key: Python-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}-core
restore-keys: |
Python-${{ runner.os }}-${{ matrix.python-version }}

- name: Window pip cache
uses: actions/cache@v3
if: ${{ runner.os == 'Windows' }}
with:
path: ~\AppData\Local\pip\Cache
key: Python-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}-core
restore-keys: |
Python-${{ runner.os }}-${{ matrix.python-version }}

- name: MacOS pip cache
uses: actions/cache@v3
if: ${{ runner.os == 'macOS' }}
with:
path: ~/Library/Caches/pip
key: Python-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}-core
restore-keys: |
Python-${{ runner.os }}-${{ matrix.python-version }}

- name: Install core PyAnsys packages
run: |
pip install -r requirements_style.txt --disable-pip-version-check
make
pip install .

- name: Smoke test
run: python -c "from pyansys import __version__; print(__version__)"

- name: Store version
run: |
echo "::set-output name=PYANSYS_VERSION::$(python -c "from pyansys import __version__; print(__version__)")"
id: version

- name: Generate wheelhouse
run: |
pip install wheel
pip wheel . -w wheelhouse

- name: Zip wheelhouse
uses: vimtor/action-zip@v1
with:
files: wheelhouse
dest: ${{ env.PACKAGE_NAME }}-v${{ steps.version.outputs.PYANSYS_VERSION }}-wheelhouse-${{ runner.os }}-${{ matrix.python-version }}-core.zip

- name: Upload Wheelhouse
uses: actions/upload-artifact@v3
with:
name: ${{ env.PACKAGE_NAME }}-v${{ steps.version.outputs.PYANSYS_VERSION }}-wheelhouse-${{ runner.os }}-${{ matrix.python-version }}-core
path: '*.zip'
retention-days: 7

extras-import:
name: Build extras PyAnsys packages
runs-on: ${{ matrix.os }}
needs: [style, core-import]
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
# python-version: ['3.7', '3.8', '3.9', '3.10']
RobPasMue marked this conversation as resolved.
Show resolved Hide resolved
python-version: ['3.7', '3.8', '3.9']
extras-version: ['fluent-all', 'mapdl-all', 'all']
fail-fast: false

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Linux pip cache
uses: actions/cache@v3
if: ${{ runner.os == 'Linux' }}
with:
path: ~/.cache/pip
key: Python-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}-${{ matrix.extras-version }}
restore-keys: |
Python-${{ runner.os }}-${{ matrix.python-version }}

- name: Window pip cache
uses: actions/cache@v3
if: ${{ runner.os == 'Windows' }}
with:
path: ~\AppData\Local\pip\Cache
key: Python-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}-${{ matrix.extras-version }}
restore-keys: |
Python-${{ runner.os }}-${{ matrix.python-version }}

- name: MacOS pip cache
uses: actions/cache@v3
if: ${{ runner.os == 'macOS' }}
with:
path: ~/Library/Caches/pip
key: Python-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}-${{ matrix.extras-version }}
restore-keys: |
Python-${{ runner.os }}-${{ matrix.python-version }}

- name: Install ${{ matrix.extras-version }} PyAnsys packages
run: |
pip install .[${{ matrix.extras-version }}]

- name: Smoke test
run: python -c "from pyansys import __version__; print(__version__)"

docs-build:
name: Building Documentation
runs-on: ubuntu-latest
needs: [docs-style]

steps:
- uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- name: Build Documentation
run: |
pip install -r requirements_docs.txt
pip install .[docs]
make -C doc html
touch doc/build/html/.nojekyll

- name: Upload Documentation
uses: actions/upload-artifact@v2.2.1
uses: actions/upload-artifact@v3
with:
name: Documentation
path: doc/build/html
retention-days: 7

- name: Deploy Docs
uses: JamesIves/github-pages-deploy-action@4.1.0
uses: JamesIves/github-pages-deploy-action@v4.4.0
if: startsWith(github.event.ref, 'refs/tags')
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: doc/build/html
CLEAN: true

- name: Lint package dist
package:
name: Package library
runs-on: ubuntu-latest
needs: [docs-build, core-import]
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: Python-${{ runner.os }}-${{ env.MAIN_PYTHON_VERSION }}-${{ hashFiles('pyproject.toml') }}-core
restore-keys: |
Python-${{ runner.os }}-${{ env.MAIN_PYTHON_VERSION }}

- name: Install dependencies and build the library
run: |
pip install twine
python setup.py sdist
twine check dist/*
python -m pip install --upgrade pip poetry twine
python -m poetry build
python -m twine check dist/*

- name: Upload to PyPi
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
- name: Install PyAnsys from wheel
run: |
twine upload --skip-existing dist/*
pip install dist/*.whl

- name: Upload wheel and binaries
uses: actions/upload-artifact@v3
with:
name: PyAnsys-packages
path: dist/
retention-days: 7

release:
name: Release project
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs: [docs-build, core-import, package]
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- uses: actions/download-artifact@v3

- name: Display structure of downloaded files
run: ls -R

- name: Upload to Public PyPi
run: |
pip install twine
twine upload --skip-existing ./**/*.whl
twine upload --skip-existing ./**/*.tar.gz
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN }}
TWINE_REPOSITORY_URL: "https://upload.pypi.org/legacy/"
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
RobPasMue marked this conversation as resolved.
Show resolved Hide resolved

- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
./**/*.zip
./**/*.whl
./**/*.tar.gz
Loading