generated from ansys/template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI: udpate pipelines CI: udpate pipelines
- Loading branch information
1 parent
e212443
commit 76f26b1
Showing
2 changed files
with
182 additions
and
38 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 |
---|---|---|
|
@@ -7,80 +7,232 @@ on: | |
branches: | ||
- main | ||
|
||
env: | ||
MAIN_PYTHON_VERSION: '3.10' | ||
PACKAGE_NAME: 'ansys-optislang-core' | ||
IMPORT_NAME: 'ansys.optislang.core' | ||
|
||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
|
||
jobs: | ||
|
||
style: | ||
name: Code style | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.7 | ||
python-version: ${{ env.MAIN_PYTHON_VERSION }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip flit tox | ||
python -m pip install --upgrade pip tox | ||
- name: Test with tox | ||
run: tox -e style | ||
|
||
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 | ||
reporter: github-pr-check | ||
level: error | ||
filter_mode: nofilter | ||
fail_on_error: true | ||
vale_flags: "--config=doc/.vale.ini" | ||
|
||
tests: | ||
name: Tests and coverage | ||
name: Tests | ||
needs: [style] | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [windows-latest, ubuntu-latest] | ||
python-version: ['3.7', '3.8', '3.9', '3.10'] | ||
os: [windows-latest, ubuntu-latest, macos-latest] | ||
cfg: | ||
- {python-version: "3.7", toxenv: "py37"} | ||
- {python-version: "3.8", toxenv: "py38"} | ||
- {python-version: "3.9", toxenv: "py39"} | ||
- {python-version: "3.10", toxenv: "py310"} | ||
fail-fast: false | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
- name: Clone repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.cfg.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
python-version: ${{ matrix.cfg.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip flit tox tox-gh-actions | ||
python -m pip install --upgrade pip tox | ||
- name: Test with tox | ||
# Only the tox environment specified in the tox.ini gh-actions is run | ||
run: tox | ||
run: tox -e ${{ matrix.cfg.toxenv }}-cov | ||
|
||
- name: Install package | ||
run: | | ||
python -m pip install -r requirements/requirements_build.txt | ||
python -m pip install . | ||
- name: Store version | ||
run: | | ||
echo "::set-output name=PACKAGE_VERSION::$(python -c "from ${{ env.IMPORT_NAME }} import __version__; print(__version__)")" | ||
id: version | ||
|
||
- name: Generate wheelhouse | ||
run: | | ||
pip wheel . -w wheelhouse | ||
- name: Zip wheelhouse | ||
uses: vimtor/action-zip@v1 | ||
with: | ||
files: wheelhouse | ||
dest: ${{ env.PACKAGE_NAME }}-v${{ steps.version.outputs.PACKAGE_VERSION }}-wheelhouse-${{ runner.os }}-${{ matrix.cfg.python-version }}.zip | ||
|
||
- name: Upload Wheelhouse | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ env.PACKAGE_NAME }}-v${{ steps.version.outputs.PACKAGE_VERSION }}-wheelhouse-${{ runner.os }}-${{ matrix.cfg.python-version }} | ||
path: '*.zip' | ||
retention-days: 7 | ||
|
||
- name: Upload coverage results as artifacts | ||
uses: actions/upload-artifact@v3 | ||
if: | | ||
(matrix.cfg.python-version == env.MAIN_PYTHON_VERSION) && | ||
(runner.os == 'Linux') | ||
with: | ||
name: HTML-Coverage | ||
path: .cov/html | ||
retention-days: 7 | ||
|
||
# - name: Upload coverage to Codecov | ||
# uses: codecov/codecov-action@v3 | ||
# if: | | ||
# (matrix.cfg.python-version == env.MAIN_PYTHON_VERSION) && | ||
# (runner.os == 'Linux') | ||
# with: | ||
# files: .cov/coverage.xml | ||
|
||
docs: | ||
name: Documentation | ||
runs-on: ubuntu-latest | ||
needs: [docs-style] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.7 | ||
- name: Install OS packages | ||
run: | | ||
sudo apt update | ||
sudo apt install pandoc | ||
python-version: ${{ env.MAIN_PYTHON_VERSION }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip flit tox | ||
sudo apt-get update && sudo apt-get install pandoc | ||
python -m pip install --upgrade pip tox | ||
- name: Generate the documentation with tox | ||
run: tox -e doc | ||
|
||
- name: Upload documentation as artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: HTML-Documentation | ||
path: .tox/doc_out | ||
retention-days: 7 | ||
|
||
# - name: Deploy documentation to gh-pages | ||
# if: github.event_name == 'push' && contains(github.ref, 'refs/tags') | ||
# uses: JamesIves/[email protected] | ||
# with: | ||
# token: ${{ secrets.github_token }} | ||
# branch: gh-pages | ||
# folder: .tox/doc_out | ||
# clean: true | ||
# single-commit: true | ||
|
||
build: | ||
name: Build library | ||
needs: [tests, docs] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.7 | ||
python-version: ${{ env.MAIN_PYTHON_VERSION }} | ||
|
||
- name: Install dependencies and build the library | ||
run: | | ||
python -m pip install --upgrade pip flit | ||
python -m pip install --upgrade pip | ||
python -m pip install -r requirements/requirements_build.txt | ||
flit build | ||
python -m build | ||
python -m twine check dist/* | ||
- name: Upload wheel and binaries as artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ env.PACKAGE_NAME }}-packages | ||
path: dist/ | ||
retention-days: 7 | ||
|
||
release: | ||
name: Release project | ||
if: github.event_name == 'push' && contains(github.ref, 'refs/tags') | ||
needs: [build] | ||
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 private PyPi | ||
run: | | ||
pip install twine | ||
python -m twine upload --skip-existing ./**/*.whl | ||
python -m twine upload --skip-existing ./**/*.tar.gz | ||
env: | ||
TWINE_USERNAME: PAT | ||
TWINE_PASSWORD: ${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }} | ||
TWINE_REPOSITORY_URL: https://pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/upload | ||
|
||
# - 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.PYPI_TOKEN }} | ||
|
||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
./**/*.whl | ||
./**/*.tar.gz | ||
./**/*.zip |
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