Skip to content

Commit

Permalink
Removing secrets from CICD: Part 2 Testing (#2585)
Browse files Browse the repository at this point in the history
* Disabling non-student versions on PRs.

* Removing secrets

* Fix missing context

* fix syntax error_

* fix syntax error_

* eval expression

* setting number of processors

* using always smp in student

* reducing failure tolerance

* try again

* Avoiding globbing
  • Loading branch information
germa89 committed Dec 26, 2023
1 parent c73d351 commit 682d78f
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 40 deletions.
12 changes: 6 additions & 6 deletions .ci/start_mapdl.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
docker pull $MAPDL_IMAGE
docker pull "$MAPDL_IMAGE"
docker run \
--name mapdl \
--restart always \
Expand All @@ -8,16 +8,16 @@ docker run \
--health-retries=4 \
--health-timeout=0.5s \
--health-start-period=10s \
-e ANSYSLMD_LICENSE_FILE=1055@$LICENSE_SERVER \
-e ANSYSLMD_LICENSE_FILE=1055@"$LICENSE_SERVER" \
-e ANSYS_LOCK="OFF" \
-p $PYMAPDL_PORT:50052 \
-p $PYMAPDL_DB_PORT:50055 \
-p "$PYMAPDL_PORT":50052 \
-p "$PYMAPDL_DB_PORT":50055 \
--shm-size=1gb \
-e I_MPI_SHM_LMT=shm \
-e P_SCHEMA=/ansys_inc/ansys/ac4/schema \
--oom-kill-disable \
--memory=6656MB \
--memory-swap=16896MB \
$MAPDL_IMAGE \
-$DISTRIBUTED_MODE -np 2 > log.txt &
"$MAPDL_IMAGE" \
-"$DISTRIBUTED_MODE" -np 2 > log.txt &
grep -q 'Server listening on' <(timeout 60 tail -f log.txt)
10 changes: 8 additions & 2 deletions .ci/start_mapdl_student.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
#!/bin/bash
docker pull "$MAPDL_IMAGE"
docker run \
--entrypoint "/bin/bash" \
--name mapdl \
--restart always \
-e ANSYS_LOCK="OFF" \
-p "$PYMAPDL_PORT":50052 \
-p "$PYMAPDL_DB_PORT":50055 \
--shm-size=2gb \
--shm-size=1gb \
-e I_MPI_SHM_LMT=shm \
-e P_SCHEMA=/ansys_inc/v241/ansys/ac4/schema \
"$MAPDL_IMAGE" > log.txt &
-w /jobs \
-u=0:0 \
--memory=6656MB \
--memory-swap=16896MB \
"$MAPDL_IMAGE" /ansys_inc/v241/ansys/bin/mapdl -grpc -dir /jobs -"$DISTRIBUTED_MODE" -np 2 > log.txt &
# grep -q 'Server listening on' <(timeout 60 tail -f log.txt)
11 changes: 5 additions & 6 deletions .ci/start_mapdl_ubuntu.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
docker pull $MAPDL_IMAGE
docker pull "$MAPDL_IMAGE"
docker run \
--entrypoint "/bin/bash" \
--name mapdl \
Expand All @@ -9,17 +9,16 @@ docker run \
--health-retries=4 \
--health-timeout=0.5s \
--health-start-period=10s \
-e ANSYSLMD_LICENSE_FILE=1055@$LICENSE_SERVER \
-e ANSYSLMD_LICENSE_FILE=1055@"$LICENSE_SERVER" \
-e ANSYS_LOCK="OFF" \
-p $PYMAPDL_PORT:50052 \
-p $PYMAPDL_DB_PORT:50055 \
-p "$PYMAPDL_PORT":50052 \
-p "$PYMAPDL_DB_PORT":50055 \
--shm-size=1gb \
-e I_MPI_SHM_LMT=shm \
-e P_SCHEMA=/ansys_inc/v222/ansys/ac4/schema \
-w /jobs \
-u=0:0 \
--oom-kill-disable \
--memory=6656MB \
--memory-swap=16896MB \
$MAPDL_IMAGE /ansys_inc/v222/ansys/bin/mapdl -grpc -dir /jobs -$DISTRIBUTED_MODE -np 2 > log.txt &
"$MAPDL_IMAGE" /ansys_inc/v222/ansys/bin/mapdl -grpc -dir /jobs -"$DISTRIBUTED_MODE" -np 2 > log.txt &
grep -q 'Server listening on' <(timeout 60 tail -f log.txt)
58 changes: 32 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ env:
DOCKER_PACKAGE: ghcr.io/ansys/mapdl
DOCKER_IMAGE_VERSION_DOCS_BUILD: v24.1-ubuntu-student
ON_CI: True
PYTEST_ARGUMENTS: '-vv --durations=10 --maxfail=5 --reruns 2 --reruns-delay 5 --cov=ansys.mapdl.core --cov-report=html'
PYTEST_ARGUMENTS: '-vv --durations=10 --maxfail=2 --reruns 2 --reruns-delay 1 --cov=ansys.mapdl.core --cov-report=html'

# Following env vars when changed will "reset" the mentioned cache,
# by changing the cache file name. It is rendered as ...-v%RESET_XXX%-...
Expand Down Expand Up @@ -273,20 +273,22 @@ jobs:
strategy:
fail-fast: false
matrix:
mapdl-version: ['v22.2.1', 'v22.2-ubuntu', 'v23.1.0', 'v23.2.0', 'v24.1.0']
mapdl-version: ['v22.2.1', 'v22.2-ubuntu', 'v23.1.0', 'v23.2.0', 'v24.1.0', 'v24.1-ubuntu-student']
extended_testing:
- ${{ github.event_name == 'schedule' || ( github.event_name == 'workflow_dispatch' && inputs.run_all_tests ) || ( github.event_name == 'push' && contains(github.ref, 'refs/tags') ) }}
exclude:
- extended_testing: false
mapdl-version: 'v21.1.1'
mapdl-version: 'v22.2.1'
- extended_testing: false
mapdl-version: 'v21.2.1'
mapdl-version: 'v22.2-ubuntu'
- extended_testing: false
mapdl-version: 'v22.1.0'
mapdl-version: 'v23.1.0'
- extended_testing: false
mapdl-version: 'v22.2.0'
mapdl-version: 'v23.2.0'
- extended_testing: false
mapdl-version: 'v22.2-ubuntu'
mapdl-version: 'v23.1.0'
- extended_testing: false
mapdl-version: 'v24.1.0'
env:
PYMAPDL_PORT: 21000 # default won't work on GitHub runners
PYMAPDL_DB_PORT: 21001 # default won't work on GitHub runners
Expand Down Expand Up @@ -329,7 +331,7 @@ jobs:
uses: docker/login-action@v3.0.0
with:
registry: ghcr.io
username: ${{ secrets.GH_USERNAME }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: "Getting SMP/DMP mode"
Expand All @@ -338,26 +340,36 @@ jobs:
image=${{ matrix.mapdl-version }}
export distributed_mode="smp"
if [[ $image == *".1."* ]]; then
export distributed_mode="dmp";
export distributed_mode="dmp";
fi
echo "Distributed mode: $distributed_mode"
echo "distributed_mode=$(echo $distributed_mode)" >> $GITHUB_OUTPUT
- name: "Pull, launch, and validate MAPDL service"
run: .ci/start_mapdl.sh
if: ${{ !contains( matrix.mapdl-version, 'ubuntu') }}
env:
LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
MAPDL_IMAGE: ${{ env.DOCKER_PACKAGE }}:${{ matrix.mapdl-version }}
DISTRIBUTED_MODE: ${{ steps.distributed_mode.outputs.distributed_mode }}
run: |
export MAPDL_VERSION=${{ matrix.mapdl-version }}
export MAPDL_IMAGE=${{ env.DOCKER_PACKAGE }}:${{ matrix.mapdl-version }}
export DISTRIBUTED_MODE=${{ steps.distributed_mode.outputs.distributed_mode }}
- name: "Pull, launch, and validate Ubuntu MAPDL service from private"
run: .ci/start_mapdl_ubuntu.sh
if: ${{ contains( matrix.mapdl-version, 'ubuntu') }}
env:
LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
MAPDL_IMAGE: ghcr.io/ansys/mapdl:${{ matrix.mapdl-version }}
DISTRIBUTED_MODE: ${{ steps.distributed_mode.outputs.distributed_mode }}
echo "MAPDL_VERSION: $MAPDL_VERSION"
echo "MAPDL_IMAGE: $MAPDL_IMAGE"
if [[ $MAPDL_VERSION == *"ubuntu-student"* ]] ; then
echo "It is student version (ubuntu-based)."
echo "No license server is needed."
.ci/start_mapdl_student.sh
elif [[ $MAPDL_VERSION == *"ubuntu"* ]] ; then
echo "It is an ubuntu based image"
.ci/start_mapdl_ubuntu.sh
else
echo "It is a CentOS based image"
.ci/start_mapdl.sh
fi;
- name: "Unit testing requirements installation"
run: |
Expand All @@ -381,7 +393,6 @@ jobs:
- uses: codecov/codecov-action@v3
name: "Upload coverage to Codecov"
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: centos-${{ matrix.mapdl-version }}-remote.xml
flags: centos,remote,${{ matrix.mapdl-version }}

Expand Down Expand Up @@ -533,7 +544,6 @@ jobs:
run: |
unset PYMAPDL_PORT
unset PYMAPDL_START_INSTANCE
# export ANSYSLMD_LICENSE_FILE=1055@${{ secrets.LICENSE_SERVER }}
export AWP_ROOT222=/ansys_inc
xvfb-run pytest -k "not test_dpf" \
${{ env.PYTEST_ARGUMENTS }} \
Expand Down Expand Up @@ -576,7 +586,6 @@ jobs:
- uses: codecov/codecov-action@v3
name: "Upload coverage to Codecov"
with:
token: ${{ secrets.CODECOV_TOKEN }}
root_dir: ${{ github.workspace }}
name: ubuntu-v24.1.0-local.xml
flags: ubuntu,local,v24.1.0
Expand Down Expand Up @@ -648,15 +657,13 @@ jobs:
- name: "Unit testing"
run: |
unset PYMAPDL_START_INSTANCE
# export ANSYSLMD_LICENSE_FILE=1055@${{ secrets.LICENSE_SERVER }}
pytest -k "not test_dpf" \
${{ env.PYTEST_ARGUMENTS }} \
--cov-report=xml:ubuntu-v24.1.0-local-minimal.xml
- uses: codecov/codecov-action@v3
name: "Upload coverage to Codecov"
with:
token: ${{ secrets.CODECOV_TOKEN }}
root_dir: ${{ github.workspace }}
name: ubuntu-v24.1.0-local-minimal.xml
flags: ubuntu,local,v24.1.0,minimal
Expand Down Expand Up @@ -728,7 +735,6 @@ jobs:
- uses: codecov/codecov-action@v3
name: "Upload coverage to Codecov"
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: windows-v22.2.0-local.xml
flags: windows,local,v22.2.0

Expand Down

0 comments on commit 682d78f

Please sign in to comment.