Skip to content

Commit

Permalink
fix: local tests always running as student (#3251)
Browse files Browse the repository at this point in the history
* fix: typos

* fix: not running tests as student always

* chore: adding changelog file 3251.fixed.md

* chore: adding changelog file 3251.fixed.md

---------

Co-authored-by: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com>
  • Loading branch information
germa89 and pyansys-ci-bot authored Jul 8, 2024
1 parent e80e4ef commit 4c3ad39
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 9 deletions.
1 change: 1 addition & 0 deletions .ci/build_matrix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ for version in "${versions[@]}"; do
# Early exiting if on Ubuntu only
if [[ "$ON_UBUNTU" != "true" && "$ONLY_UBUNTU" == "true" ]]; then
echo "Skipping non-ubuntu versions"
echo ""
continue
fi

Expand Down
46 changes: 38 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ jobs:
env:
DISTRIBUTED_MODE: ${{ steps.distributed_mode.outputs.distributed_mode }}
ON_UBUNTU: ${{ steps.ubuntu_check.outputs.ON_UBUNTU }}
ON_STUDENT: ${{ steps.ubuntu_check.outputs.ON_STUDENT }}
ON_STUDENT: ${{ steps.student_check.outputs.ON_STUDENT }}
run: |
echo "ON_UBUNTU: $ON_UBUNTU"
echo "ON_STUDENT: $ON_STUDENT"
Expand All @@ -508,7 +508,7 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }} # required
name: ${{ matrix.mapdl-version }}-remote.xml
flags: remote,${{ steps.ubuntu_check.outputs.TAG_UBUNTU }},${{ matrix.mapdl-version }},${{ steps.distributed_mode.outputs.distributed_mode }},${{ steps.ubuntu_check.outputs.TAG_STUDENT }}
flags: remote,${{ steps.ubuntu_check.outputs.TAG_UBUNTU }},${{ matrix.mapdl-version }},${{ steps.distributed_mode.outputs.distributed_mode }},${{ steps.student_check.outputs.TAG_STUDENT }}

- name: Upload coverage artifacts
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -601,7 +601,6 @@ jobs:
env:
ON_LOCAL: true
ON_UBUNTU: true
ON_STUDENT: true
P_SCHEMA: "/ansys_inc/v241/ansys/ac4/schema"
PYTEST_TIMEOUT: 120 # seconds. Limit the duration for each unit test

Expand All @@ -612,6 +611,19 @@ jobs:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}

- name: "Get if running student version"
id: student_check
run: |
if [[ "${{ matrix.mapdl-version }}" == *"student"* ]];
then export ON_STUDENT=true; export TAG_STUDENT="student";
else export ON_STUDENT=false; export TAG_STUDENT="non-student";
fi
echo "ON_STUDENT: $ON_STUDENT"
echo "TAG_STUDENT: $TAG_STUDENT"
echo "ON_STUDENT=$(echo $ON_STUDENT)" >> $GITHUB_OUTPUT
echo "TAG_STUDENT=$(echo $TAG_STUDENT)" >> $GITHUB_OUTPUT
- name: "Setup Python"
uses: actions/setup-python@v5
with:
Expand Down Expand Up @@ -648,10 +660,12 @@ jobs:
- name: "Unit testing"
env:
ANSYSLMD_LICENSE_FILE: "1055@${{ secrets.LICENSE_SERVER }}"
ON_STUDENT: ${{ steps.student_check.outputs.ON_STUDENT }}
run: |
echo "ON_UBUNTU: $ON_UBUNTU"
echo "ON_STUDENT: $ON_STUDENT"
unset PYMAPDL_PORT
unset PYMAPDL_START_INSTANCE
export AWP_ROOT222=/ansys_inc
xvfb-run pytest -k "not test_dpf" \
${{ env.PYTEST_ARGUMENTS }} \
--reset_only_failed --add_missing_images \
Expand Down Expand Up @@ -693,7 +707,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }} # required
root_dir: ${{ github.workspace }}
name: ${{ matrix.mapdl-version }}-local.xml
flags: ubuntu,local,${{ matrix.mapdl-version }}
flags: ubuntu,local,${{ matrix.mapdl-version }},${{ steps.student_check.outputs.TAG_STUDENT }},dmp

- name: "Upload coverage artifacts"
uses: actions/upload-artifact@v4
Expand All @@ -720,7 +734,6 @@ jobs:
env:
ON_LOCAL: true
ON_UBUNTU: true
ON_STUDENT: true

steps:
- name: "Install Git and checkout project"
Expand All @@ -729,6 +742,19 @@ jobs:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}

- name: "Get if running student version"
id: student_check
run: |
if [[ "${{ matrix.mapdl-version }}" == *"student"* ]];
then export ON_STUDENT=true; export TAG_STUDENT="student";
else export ON_STUDENT=false; export TAG_STUDENT="non-student";
fi
echo "ON_STUDENT: $ON_STUDENT"
echo "TAG_STUDENT: $TAG_STUDENT"
echo "ON_STUDENT=$(echo $ON_STUDENT)" >> $GITHUB_OUTPUT
echo "TAG_STUDENT=$(echo $TAG_STUDENT)" >> $GITHUB_OUTPUT
- name: "Installing missing package"
run: |
sudo apt-get update
Expand Down Expand Up @@ -757,7 +783,11 @@ jobs:
- name: "Unit testing"
env:
ANSYSLMD_LICENSE_FILE: "1055@${{ secrets.LICENSE_SERVER }}"
ON_STUDENT: ${{ steps.student_check.outputs.ON_STUDENT }}
run: |
echo "ON_UBUNTU: $ON_UBUNTU"
echo "ON_STUDENT: $ON_STUDENT"
# Because there is no 'ansys-tools-path' we need to input the
# executable path with the env var: PYMAPDL_MAPDL_EXEC.
Expand All @@ -767,7 +797,7 @@ jobs:
version=$(echo "${{ matrix.mapdl-version }}" | head -c 5 | tail -c 4 | tr -d '.')
fi;
echo "$version"
echo "Version: $version"
export PYMAPDL_MAPDL_EXEC=/ansys_inc/v"$version"/ansys/bin/ansys"$version"
echo "$PYMAPDL_MAPDL_EXEC"
Expand All @@ -783,7 +813,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }} # required
root_dir: ${{ github.workspace }}
name: ${{ matrix.mapdl-version }}-minimal.xml
flags: ubuntu,local,${{ matrix.mapdl-version }},minimal
flags: ubuntu,local,${{ matrix.mapdl-version }},minimal,${{ steps.student_check.outputs.TAG_STUDENT }},dmp

- name: "Upload coverage artifacts"
uses: actions/upload-artifact@v4
Expand Down
1 change: 1 addition & 0 deletions doc/changelog.d/3251.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fix: local tests always running as student
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def pytest_report_header(config, start_path, startdir):
f"Session dependent: ON_CI ({ON_CI}), TESTING_MINIMAL ({TESTING_MINIMAL}), SUPPORT_PLOTTING ({SUPPORT_PLOTTING})"
]
text += [
f"OS dependent: ON_LINUX ({ON_LINUX}), ON_UBUNTU ({ON_UBUNTU}), ON_WINDOWS ({ON_WINDOWS}), ON_MACOS )({ON_MACOS})"
f"OS dependent: ON_LINUX ({ON_LINUX}), ON_UBUNTU ({ON_UBUNTU}), ON_WINDOWS ({ON_WINDOWS}), ON_MACOS ({ON_MACOS})"
]
text += [
f"MAPDL dependent: ON_LOCAL ({ON_LOCAL}), ON_STUDENT ({ON_STUDENT}), HAS_GRPC ({HAS_GRPC}), HAS_DPF ({HAS_DPF}), IS_SMP ({IS_SMP})"
Expand Down

0 comments on commit 4c3ad39

Please sign in to comment.