From 4c3ad398e0da2e83c49f2955b472228a05b2c613 Mon Sep 17 00:00:00 2001 From: German <28149841+germa89@users.noreply.github.com> Date: Mon, 8 Jul 2024 16:37:42 +0200 Subject: [PATCH] fix: local tests always running as student (#3251) * 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> --- .ci/build_matrix.sh | 1 + .github/workflows/ci.yml | 46 +++++++++++++++++++++++++++++------ doc/changelog.d/3251.fixed.md | 1 + tests/conftest.py | 2 +- 4 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 doc/changelog.d/3251.fixed.md diff --git a/.ci/build_matrix.sh b/.ci/build_matrix.sh index 4faead2cb2..bd1058c4e5 100755 --- a/.ci/build_matrix.sh +++ b/.ci/build_matrix.sh @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a1486c978..c4dd7efb2d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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" @@ -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 @@ -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 @@ -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: @@ -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 \ @@ -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 @@ -720,7 +734,6 @@ jobs: env: ON_LOCAL: true ON_UBUNTU: true - ON_STUDENT: true steps: - name: "Install Git and checkout project" @@ -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 @@ -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. @@ -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" @@ -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 diff --git a/doc/changelog.d/3251.fixed.md b/doc/changelog.d/3251.fixed.md new file mode 100644 index 0000000000..609a22f090 --- /dev/null +++ b/doc/changelog.d/3251.fixed.md @@ -0,0 +1 @@ +fix: local tests always running as student \ No newline at end of file diff --git a/tests/conftest.py b/tests/conftest.py index 63c4631e3f..cfe9323874 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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})"