CI Release #36
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
name: CI Release | |
on: | |
push: | |
tags: | |
- "v*" | |
schedule: | |
- cron: "0 13 * * 0" | |
#┌───────────── minute (0 - 59) | |
#│ ┌───────────── hour (0 - 23) | |
#│ │ ┌───────────── day of the month (1 - 31) | |
#│ │ │ ┌───────────── month (1 - 12) | |
#│ │ │ │ ┌───────────── day of the week (0 - 6), 0 being Sunday | |
#│ │ │ │ │ | |
#│ │ │ │ │ | |
#│ │ │ │ │ | |
#* * * * * | |
env: | |
PACKAGE_NAME: 'ansys-dpf-post' | |
MODULE: 'post' | |
DOCUMENTATION_CNAME: 'post.docs.pyansys.com' | |
MAIN_PYTHON_VERSION: '3.10' | |
ANSYS_VERSION: '241' | |
jobs: | |
debug: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Show the Github context for the triggered event | |
run: echo "$GITHUB_CONTEXT" | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
style: | |
name: "Style Check" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: "Setup Python" | |
uses: actions/setup-python@v4.7.0 | |
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 | |
tests: | |
name: tests | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
ANSYS_VERSION: ["241"] | |
suffix: [".pre0"] | |
python-version: ["3.8", "3.9", "3.10"] | |
os: ["windows-latest", "ubuntu-latest"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: "Set licensing if necessary" | |
if: env.ANSYS_VERSION > 231 | |
shell: bash | |
run: | | |
echo "ANSYS_DPF_ACCEPT_LA=Y" >> $GITHUB_ENV | |
echo "ANSYSLMD_LICENSE_FILE=1055@${{ secrets.LICENSE_SERVER }}" >> $GITHUB_ENV | |
- name: "Build Package" | |
uses: ansys/pydpf-actions/build_package@v2.3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
ANSYS_VERSION: ${{ matrix.ANSYS_VERSION }} | |
PACKAGE_NAME: ${{env.PACKAGE_NAME}} | |
MODULE: ${{env.MODULE}} | |
dpf-standalone-TOKEN: ${{secrets.DPF_PIPELINE}} | |
install_extras: plotting | |
wheel: true | |
wheelhouse: true | |
standalone_suffix: ${{ matrix.suffix }} | |
- name: "Prepare Testing Environment" | |
uses: ansys/pydpf-actions/prepare_tests@v2.3 | |
with: | |
DEBUG: true | |
- name: "List installed packages" | |
shell: bash | |
run: pip list | |
- name: "Test Docstrings" | |
uses: ansys/pydpf-actions/test_docstrings@v2.3 | |
with: | |
MODULE: ${{env.MODULE}} | |
PACKAGE_NAME: ${{env.PACKAGE_NAME}} | |
working-directory: src | |
- name: "Test API" | |
shell: bash | |
working-directory: tests | |
run: | | |
pytest $DEBUG --cov=ansys.dpf.${{env.MODULE}} --cov-report=xml --cov-report=html --cov-append --log-level=ERROR --junitxml=junit/test-results.xml --reruns 2 . | |
- name: "Kill all servers" | |
uses: ansys/pydpf-actions/kill-dpf-servers@v2.3 | |
if: always() | |
- name: "Upload Test Results" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.PACKAGE_NAME }}_${{ matrix.python-version }}_${{ matrix.os }}_pytest_${{ env.ANSYS_VERSION }} | |
path: tests/junit/test-results.xml | |
- name: "Upload coverage to Codecov" | |
uses: codecov/codecov-action@v3 | |
retro: | |
name: "Retro-compatibility" | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.10"] | |
os: ["windows-latest", "ubuntu-latest"] | |
ANSYS_VERSION: ["232", "231", "222"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: "Set licensing if necessary" | |
if: matrix.ANSYS_VERSION > 231 | |
shell: bash | |
run: | | |
echo "ANSYS_DPF_ACCEPT_LA=Y" >> $GITHUB_ENV | |
echo "ANSYSLMD_LICENSE_FILE=1055@${{ secrets.LICENSE_SERVER }}" >> $GITHUB_ENV | |
- name: "Build Package" | |
uses: ansys/pydpf-actions/build_package@v2.3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
ANSYS_VERSION: ${{matrix.ANSYS_VERSION}} | |
PACKAGE_NAME: ${{env.PACKAGE_NAME}} | |
MODULE: ${{env.MODULE}} | |
dpf-standalone-TOKEN: ${{secrets.DPF_PIPELINE}} | |
install_extras: plotting | |
wheel: false | |
extra-pip-args: ${{ env.extra }} | |
- name: "Prepare Testing Environment" | |
uses: ansys/pydpf-actions/prepare_tests@v2.3 | |
with: | |
DEBUG: true | |
- name: "List installed packages" | |
shell: bash | |
run: pip list | |
- name: "Test API" | |
shell: bash | |
working-directory: tests | |
run: | | |
pytest $DEBUG --cov=ansys.dpf.${{env.MODULE}} --cov-report=xml --cov-report=html --cov-append --log-level=ERROR --junitxml=junit/test-results.xml --reruns 2 . | |
- name: "Kill all servers" | |
uses: ansys/pydpf-actions/kill-dpf-servers@v2.3 | |
if: always() | |
- name: "Upload Test Results" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.PACKAGE_NAME }}_${{ matrix.python-version }}_${{ matrix.os }}_pytest_${{ matrix.ANSYS_VERSION }} | |
path: tests/junit/test-results.xml | |
if: always() | |
- name: "Upload coverage to Codecov" | |
uses: codecov/codecov-action@v3 | |
examples: | |
uses: ./.github/workflows/examples.yml | |
with: | |
ANSYS_VERSION: '241' | |
python_versions: '["3.10"]' | |
standalone_suffix: '.pre0' | |
secrets: inherit | |
docs: | |
uses: ./.github/workflows/docs.yml | |
with: | |
ANSYS_VERSION: '241' | |
standalone_suffix: '.pre0' | |
event_name: ${{ github.event_name }} | |
secrets: inherit | |
draft_release: | |
name: "Draft release" | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
needs: [style, tests, retro, examples, docs] | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Download artifacts" | |
uses: actions/download-artifact@v3 | |
- name: "Display downloaded files" | |
run: ls -R | |
- name: "Create draft release" | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
./**/*.whl | |
./**/*.tar.gz | |
./**/*.zip | |
draft: true | |
generate_release_notes: true |