Skip to content

Commit 37ca7ee

Browse files
committed
CI: Add build and smoke test for targets
Note: Current way of smoke testing does not include doc, tests, dotnet, ... targets which can lead to wrong dependencies settings. This should solve the problem
1 parent a338cc9 commit 37ca7ee

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

.github/workflows/ci_cd.yml

+65
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,71 @@ jobs:
5555
run: |
5656
python -c "import pyaedt; from pyaedt import __version__"
5757
58+
smoke-tests-with-install-target:
59+
name: Build and perform smoke tests with install target ${{ matrix.target }}
60+
runs-on: ${{ matrix.os }}
61+
strategy:
62+
fail-fast: false
63+
matrix:
64+
os: [ubuntu-latest, windows-latest]
65+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
66+
install_target: ['tests', 'dotnet', 'doc', 'doc-noexamples', 'full']
67+
steps:
68+
- name: "Install Git and clone project"
69+
uses: actions/checkout@v4
70+
71+
- name: Setup Python
72+
uses: actions/setup-python@v4
73+
with:
74+
python-version: ${{ matrix.python-version }}
75+
76+
- name: "Update pip and install the build and wheel libraries"
77+
shell: bash
78+
run: |
79+
python -m pip install --upgrade pip build wheel
80+
81+
- name: "Install the library"
82+
shell: bash
83+
run: |
84+
python -m pip install ${{ matrix.install_target }}
85+
86+
- name: "Verify if importlib-metadata needs to be installed"
87+
shell: bash
88+
run: |
89+
python_version="${{ matrix.python-version }}"
90+
minor_python_version=$(echo "$python_version" | awk -F "." '{print $2}')
91+
major_python_version=$(echo "$python_version" | awk -F "." '{print $1}')
92+
if (( $(( $major_python_version == 3 )) )) && (( $(( $minor_python_version < 8 )) )); then
93+
echo "needs_importlib_metadata=true" >> $GITHUB_ENV
94+
elif (( $(( $major_python_version < 3 )) )); then
95+
echo "needs_importlib_metadata=true" >> $GITHUB_ENV
96+
else
97+
echo "needs_importlib_metadata=false" >> $GITHUB_ENV
98+
fi
99+
100+
- name: "Install importlib-metadata (only for Python <= 3.7)"
101+
if: env.needs_importlib_metadata == 'true'
102+
shell: bash
103+
run: |
104+
python -m pip install importlib-metadata
105+
106+
- name: "Verify pyaedt is properly installed and get its version number"
107+
shell: bash
108+
run: |
109+
if [ ${{ env.needs_importlib_metadata }} == 'true' ]; then
110+
version=$(python -c "import importlib_metadata; print(importlib_metadata.version('pyaedt'))")
111+
else
112+
version=$(python -c "import importlib.metadata as importlib_metadata; print(importlib_metadata.version('pyaedt'))")
113+
fi
114+
115+
if [ -z "$version" ]; then
116+
echo "Problem getting the library version"
117+
exit 1;
118+
else
119+
echo "The library version is: $version";
120+
fi;
121+
echo "library_version=$version" >> $GITHUB_ENV
122+
58123
doc-build:
59124
name: Documentation build without examples
60125
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)