Skip to content

Commit

Permalink
CI: Avoid using self-hosted runners in drafts (#5203)
Browse files Browse the repository at this point in the history
  • Loading branch information
SMoraisAnsys authored Sep 27, 2024
1 parent 814ef79 commit e658d50
Show file tree
Hide file tree
Showing 2 changed files with 290 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ jobs:

test-solvers-windows:
name: Testing solvers and coverage (Windows)
if: github.event.pull_request.draft == false
needs: [smoke-tests]
runs-on: [ self-hosted, Windows, pyaedt ]
steps:
Expand Down Expand Up @@ -287,6 +288,7 @@ jobs:
# TODO: Si if we can use ansys/actions
test-solvers-linux:
name: Testing solvers and coverage (Linux)
if: github.event.pull_request.draft == false
needs: [smoke-tests]
runs-on: [ self-hosted, Linux, pyaedt ]
env:
Expand Down Expand Up @@ -343,6 +345,7 @@ jobs:

test-windows:
name: Testing and coverage (Windows)
if: github.event.pull_request.draft == false
needs: [smoke-tests]
runs-on: [ self-hosted, Windows, pyaedt ]
steps:
Expand Down Expand Up @@ -408,6 +411,7 @@ jobs:
# TODO: Si if we can use ansys/actions
test-linux:
name: Testing and coverage (Linux)
if: github.event.pull_request.draft == false
needs: [smoke-tests]
runs-on: [ self-hosted, Linux, pyaedt ]
env:
Expand Down
286 changes: 286 additions & 0 deletions .github/workflows/manual_draft.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,286 @@
name: Draft workflow

on:
workflow_dispatch:
inputs:
test-solvers-windows:
description: "Testing solvers and coverage (Windows)"
default: 'no'
type: choice
options:
- 'yes'
- 'no'
test-solvers-linux:
description: "Testing solvers and coverage (Linux)"
default: 'no'
type: choice
options:
- 'yes'
- 'no'
test-windows:
description: "Testing solvers and coverage (Windows)"
default: 'no'
type: choice
options:
- 'yes'
- 'no'
test-linux:
description: "Testing solvers and coverage (Linux)"
type: choice
default: 'no'
options:
- 'yes'
- 'no'

jobs:

# # =================================================================================================
# # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# # =================================================================================================

test-solvers-windows:
name: Testing solvers and coverage (Windows)
if: github.event.inputs.test-solvers-windows == 'yes'
needs: [smoke-tests]
runs-on: [ self-hosted, Windows, pyaedt ]
steps:
- name: Install Git and checkout project
uses: actions/checkout@v4

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

- name: Create virtual environment
run: |
python -m venv .venv
.venv\Scripts\Activate.ps1
python -m pip install pip -U
python -m pip install wheel setuptools -U
python -c "import sys; print(sys.executable)"
- name: Install pyaedt and tests dependencies
run: |
.venv\Scripts\Activate.ps1
pip install .[tests]
pip install pytest-azurepipelines
- name: Install CI dependencies (e.g. vtk-osmesa)
run: |
.venv\Scripts\Activate.ps1
# Uninstall conflicting dependencies
pip uninstall --yes vtk
pip install --extra-index-url https://wheels.vtk.org vtk-osmesa
- name: Run tests on _unittest_solvers
env:
PYTHONMALLOC: malloc
run: |
.venv\Scripts\Activate.ps1
pytest --durations=50 -v --cov=ansys.aedt.core --cov-report=xml --cov-report=html --junitxml=junit/test-results.xml _unittest_solvers
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: codecov-system-solver-tests
file: ./coverage.xml
flags: system,solver

- name: Upload pytest test results
uses: actions/upload-artifact@v3
with:
name: pytest-solver-results
path: junit/test-results.xml
if: ${{ always() }}

# # =================================================================================================
# # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# # =================================================================================================

test-solvers-linux:
name: Testing solvers and coverage (Linux)
if: github.event.inputs.test-solvers-linux == 'yes'
needs: [smoke-tests]
runs-on: [ self-hosted, Linux, pyaedt ]
env:
ANSYSEM_ROOT242: '/opt/AnsysEM/v242/Linux64'
ANS_NODEPCHECK: '1'
steps:
- name: Install Git and checkout project
uses: actions/checkout@v4

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

- name: Create virtual environment
run: |
export LD_LIBRARY_PATH=${{ env.ANSYSEM_ROOT242 }}/common/mono/Linux64/lib64:${{ env.ANSYSEM_ROOT242 }}/Delcross:$LD_LIBRARY_PATH
python -m venv .venv
source .venv/bin/activate
python -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org pip -U
python -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org wheel setuptools -U
python -c "import sys; print(sys.executable)"
- name: Install pyaedt and tests dependencies
run: |
export LD_LIBRARY_PATH=${{ env.ANSYSEM_ROOT242 }}/common/mono/Linux64/lib64:${{ env.ANSYSEM_ROOT242 }}/Delcross:$LD_LIBRARY_PATH
source .venv/bin/activate
pip install .[tests]
pip install pytest-azurepipelines
- name: Run tests on _unittest_solvers
run: |
export LD_LIBRARY_PATH=${{ env.ANSYSEM_ROOT242 }}/common/mono/Linux64/lib64:${{ env.ANSYSEM_ROOT242 }}/Delcross:$LD_LIBRARY_PATH
source .venv/bin/activate
pytest --durations=50 -v --cov=ansys.aedt.core --cov-report=xml --cov-report=html --junitxml=junit/test-results.xml _unittest_solvers
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: codecov-system-solver-tests
file: ./coverage.xml
flags: system,solver

- name: Upload pytest test results
uses: actions/upload-artifact@v3
with:
name: pytest-solver-results
path: junit/test-results.xml
if: ${{ always() }}

# # =================================================================================================
# # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# # =================================================================================================

test-windows:
name: Testing and coverage (Windows)
if: github.event.inputs.test-windows == 'yes'
needs: [smoke-tests]
runs-on: [ self-hosted, Windows, pyaedt ]
steps:
- name: Install Git and checkout project
uses: actions/checkout@v4

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

- name: Create virtual environment
run: |
python -m venv .venv
.venv\Scripts\Activate.ps1
python -m pip install pip -U
python -m pip install wheel setuptools -U
python -c "import sys; print(sys.executable)"
- name: Install pyaedt and tests dependencies
run: |
.venv\Scripts\Activate.ps1
pip install .[tests]
pip install pytest-azurepipelines
- name: Install CI dependencies (e.g. vtk-osmesa)
run: |
.venv\Scripts\Activate.ps1
# Uninstall conflicting dependencies
pip uninstall --yes vtk
pip install --extra-index-url https://wheels.vtk.org vtk-osmesa
- name: Run tests on _unittest
uses: nick-fields/retry@v3
env:
PYTHONMALLOC: malloc
with:
max_attempts: 2
retry_on: error
timeout_minutes: 50
command: |
.venv\Scripts\Activate.ps1
pytest -n 4 --dist loadfile --durations=50 -v --cov=ansys.aedt.core --cov-report=xml --cov-report=html --junitxml=junit/test-results.xml _unittest
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: codecov-system-tests
file: ./coverage.xml
flags: system

- name: Upload pytest test results
uses: actions/upload-artifact@v3
with:
name: pytest-results
path: junit/test-results.xml
if: ${{ always() }}

# # =================================================================================================
# # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# # =================================================================================================

test-linux:
name: Testing and coverage (Linux)
if: github.event.inputs.test-linux == 'yes'
needs: [smoke-tests]
runs-on: [ self-hosted, Linux, pyaedt ]
env:
ANSYSEM_ROOT242: '/opt/AnsysEM/v242/Linux64'
ANS_NODEPCHECK: '1'
steps:
- name: Install Git and checkout project
uses: actions/checkout@v4

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

- name: Create virtual environment
run: |
export LD_LIBRARY_PATH=${{ env.ANSYSEM_ROOT242 }}/common/mono/Linux64/lib64:${{ env.ANSYSEM_ROOT242 }}/Delcross:$LD_LIBRARY_PATH
python -m venv .venv
source .venv/bin/activate
python -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org pip -U
python -m pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org wheel setuptools -U
python -c "import sys; print(sys.executable)"
- name: Install pyaedt and tests dependencies
run: |
export LD_LIBRARY_PATH=${{ env.ANSYSEM_ROOT242 }}/common/mono/Linux64/lib64:${{ env.ANSYSEM_ROOT242 }}/Delcross:$LD_LIBRARY_PATH
source .venv/bin/activate
pip install .[tests]
pip install pytest-azurepipelines
- name: Install CI dependencies (e.g. vtk-osmesa)
run: |
source .venv/bin/activate
# Uninstall conflicting dependencies
pip uninstall --yes vtk
pip install --extra-index-url https://wheels.vtk.org vtk-osmesa
- name: Run tests on _unittest
uses: nick-fields/retry@v3
with:
max_attempts: 2
retry_on: error
timeout_minutes: 50
command: |
export LD_LIBRARY_PATH=${{ env.ANSYSEM_ROOT242 }}/common/mono/Linux64/lib64:${{ env.ANSYSEM_ROOT242 }}/Delcross:$LD_LIBRARY_PATH
source .venv/bin/activate
pytest -n 2 --dist loadfile --durations=50 -v --cov=ansys.aedt.core --cov-report=xml --cov-report=html --junitxml=junit/test-results.xml _unittest
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: codecov-system-solver-tests
file: ./coverage.xml
flags: system,solver

- name: Upload pytest test results
uses: actions/upload-artifact@v3
with:
name: pytest-solver-results
path: junit/test-results.xml
if: ${{ always() }}

0 comments on commit e658d50

Please sign in to comment.