CI #8138
This file contains hidden or 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 | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened, ready_for_review, closed] | |
branches-ignore: | |
- '*no-ci*' | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
inputs: | |
ansys_version: | |
description: "ANSYS version" | |
required: false | |
type: string | |
standalone_branch_suffix: | |
description: 'Suffix of the branch on standalone' | |
required: false | |
default: '' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} | |
cancel-in-progress: true | |
env: | |
DOCUMENTATION_CNAME: 'dpf.docs.pyansys.com' | |
MAIN_PYTHON_VERSION: '3.10' | |
jobs: | |
debug: | |
runs-on: ubuntu-latest | |
if: github.event.action != 'closed' | |
steps: | |
- name: Show the Github context for the triggered event | |
run: echo "$GITHUB_CONTEXT" | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
pick_server_suffix: | |
runs-on: ubuntu-latest | |
if: github.event.action != 'closed' | |
outputs: | |
suffix: ${{ steps.step1.outputs.suffix }} | |
steps: | |
- id: step1 | |
name: Define server branch suffix to use | |
run: | | |
if ${{ github.event_name == 'push' }}; then | |
echo "suffix=" >> "$GITHUB_OUTPUT" | |
elif ${{ github.event_name == 'workflow_dispatch' }}; then | |
echo "suffix=${{ github.event.inputs.standalone_branch_suffix }}" >> "$GITHUB_OUTPUT" | |
elif ${{ github.event_name == 'pull_request' }}; then | |
# If the PR is server-sync then extract suffix from branch name | |
sub='maint/update_code_for_' | |
if [[ "${{ github.head_ref }}" == *"$sub"* ]]; then | |
ref_name=${{ github.head_ref }} | |
base_ref=${{ github.base_ref }} | |
suffix=${ref_name/$sub[0-9][0-9][0-9]/''} | |
suffix=${suffix/_on_$base_ref/''} | |
elif [[ "${{ github.base_ref }}" == *"$sub"* ]]; then | |
base_ref=${{ github.base_ref }} | |
suffix=${base_ref/$sub[0-9][0-9][0-9]/''} | |
suffix=${suffix/_on_*/''} | |
fi | |
echo "suffix=$suffix" >> "$GITHUB_OUTPUT" | |
fi | |
echo "branch suffix is: >$suffix<" | |
style: | |
name: "Style Check" | |
runs-on: ubuntu-latest | |
if: github.event.action != 'closed' | |
steps: | |
- uses: ansys/actions/code-style@v8 | |
with: | |
use-python-cache: false | |
build_linux1: | |
name: "Build linux1 wheel" | |
runs-on: ubuntu-latest | |
if: github.event.action != 'closed' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: "Install requirements" | |
run: pip install -r requirements/requirements_build.txt | |
- name: "Build the manylinux1 wheel" | |
shell: bash | |
id: wheel | |
run: | | |
python .ci/build_wheel.py -p manylinux1 | |
cd dist | |
export name=`ls ansys_dpf_core*.whl` | |
echo ${name} | |
echo "wheel_name=${name[0]}" >> $GITHUB_OUTPUT | |
cd .. | |
- name: "Upload wheel any as artifact" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.wheel.outputs.wheel_name }} | |
path: dist/${{ steps.wheel.outputs.wheel_name }} | |
tests-latest: | |
name: "Test ${{ matrix.test-any == 'true' && 'any' || 'platform-specific' }} wheel against latest DPF version" | |
strategy: | |
fail-fast: false | |
matrix: | |
test-any: ['false', 'true'] | |
uses: ./.github/workflows/tests.yml | |
if: github.event.action != 'closed' | |
needs: pick_server_suffix | |
with: | |
ANSYS_VERSION: ${{ inputs.ansys_version || vars.ANSYS_VERSION_DEFAULT }} | |
python_versions: '["3.10"]' | |
wheel: true | |
wheelhouse: false | |
standalone_suffix: ${{needs.pick_server_suffix.outputs.suffix}} | |
test_any: ${{ matrix.test-any }} | |
DOCSTRING: ${{ !matrix.test-any }} | |
secrets: inherit | |
docker_tests: | |
name: "Build and Test on Docker" | |
uses: ./.github/workflows/test_docker.yml | |
if: github.event.action != 'closed' | |
needs: pick_server_suffix | |
with: | |
ANSYS_VERSION: ${{ inputs.ansys_version || vars.ANSYS_VERSION_DEFAULT }} | |
standalone_suffix: ${{needs.pick_server_suffix.outputs.suffix}} | |
secrets: inherit | |
docker_examples: | |
name: "Run examples on Docker" | |
uses: ./.github/workflows/examples_docker.yml | |
if: github.event.action != 'closed' | |
needs: pick_server_suffix | |
with: | |
ANSYS_VERSION: ${{ inputs.ansys_version || vars.ANSYS_VERSION_DEFAULT }} | |
python_versions: '["3.10"]' | |
standalone_suffix: ${{needs.pick_server_suffix.outputs.suffix}} | |
secrets: inherit | |
docs: | |
if: github.event.action != 'closed' && (startsWith(github.head_ref, 'master') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft) | |
uses: ./.github/workflows/docs.yml | |
needs: pick_server_suffix | |
with: | |
ANSYS_VERSION: ${{ inputs.ansys_version || vars.ANSYS_VERSION_DEFAULT }} | |
standalone_suffix: ${{needs.pick_server_suffix.outputs.suffix}} | |
event_name: ${{ github.event_name }} | |
python_version: "3.11" | |
secrets: inherit | |
doc-deploy-pr: | |
name: "Deploy PR documentation" | |
runs-on: ubuntu-latest | |
needs: docs | |
if: always() && (needs.docs.result == 'success' || needs.docs.result == 'skipped') | |
steps: | |
- uses: ansys/actions/doc-deploy-pr@v10 | |
with: | |
cname: ${{ env.DOCUMENTATION_CNAME }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
doc-artifact-name: HTML-doc-ansys-dpf-core.zip | |
decompress-artifact: true | |
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} | |
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} | |
maximum-pr-doc-deployments: 10 | |
upload-development-docs: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.action != 'closed' && (github.ref == 'refs/heads/master' && github.event_name == 'push') }} | |
needs: [docs] | |
steps: | |
- name: "Upload development documentation" | |
uses: ansys/actions/doc-deploy-dev@v8 | |
with: | |
cname: ${{ env.DOCUMENTATION_CNAME }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
doc-artifact-name: HTML-doc-ansys-dpf-core.zip | |
decompress-artifact: true | |
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} | |
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} | |
examples: | |
if: github.event.action != 'closed' && (startsWith(github.head_ref, 'master') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft) | |
uses: ./.github/workflows/examples.yml | |
needs: pick_server_suffix | |
with: | |
ANSYS_VERSION: ${{ inputs.ansys_version || vars.ANSYS_VERSION_DEFAULT }} | |
python_versions: '["3.10"]' | |
standalone_suffix: ${{needs.pick_server_suffix.outputs.suffix}} | |
secrets: inherit | |
pydpf-post: | |
name: "PyDPF-Post" | |
if: github.event.action != 'closed' && (startsWith(github.head_ref, 'master') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft) | |
uses: ./.github/workflows/pydpf-post.yml | |
needs: pick_server_suffix | |
with: | |
ANSYS_VERSION: ${{ inputs.ansys_version || vars.ANSYS_VERSION_DEFAULT }} | |
post_branch: "master" | |
standalone_suffix: ${{needs.pick_server_suffix.outputs.suffix}} | |
test_docstrings: "true" | |
secrets: inherit | |
tests-retro: | |
name: "Test DPF ${{ matrix.dpf.version }} compatibility" | |
if: github.event.action != 'closed' && (startsWith(github.head_ref, 'master') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft) | |
strategy: | |
fail-fast: false | |
matrix: | |
dpf: | |
- {"version": "251", "standalone-suffix": ""} | |
- {"version": "242", "standalone-suffix": ""} | |
- {"version": "241", "standalone-suffix": ".sp01"} | |
- {"version": "232", "standalone-suffix": ""} | |
- {"version": "231", "standalone-suffix": ""} | |
- {"version": "222", "standalone-suffix": ""} | |
uses: ./.github/workflows/tests.yml | |
with: | |
ANSYS_VERSION: ${{ matrix.dpf.version }} | |
python_versions: '["3.10"]' | |
DOCSTRING: false | |
standalone_suffix: ${{ matrix.dpf.standalone-suffix }} | |
secrets: inherit |