Skip to content

Commit 14f4a27

Browse files
authored
Add the wheelhouse in the unit_tests workflow. (#1182)
* Add the wheelhouse in the unit_tests workflow. * Add new line between steps. * Create the wheel before to do the testing. * Requirements files are not gathered. * Remove the test to check pyaedt installation. * Pip install wheel.
1 parent eeb5641 commit 14f4a27

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

.github/workflows/releases.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jobs:
4545
key: Python-v${{ env.RESET_PIP_CACHE }}-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}-${{ hashFiles('requirements/requirements_tests*.txt') }}
4646
restore-keys: |
4747
Python-v${{ env.RESET_PIP_CACHE }}-${{ runner.os }}-${{ matrix.python-version }}
48+
4849
- name: Install PyAEDT
4950
run: pip install .
5051

.github/workflows/unit_tests.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ name: CI
55
env:
66
python.version: 3.8
77
python.venv: 'testvenv'
8+
# Following env vars when changed will "reset" the mentioned cache,
9+
# by changing the cache file name. It is rendered as ...-v%RESET_XXX%-...
10+
# You should go up in number, if you go down (or repeat a previous value)
11+
# you might end up reusing a previous cache if it haven't been deleted already.
12+
# It applies 7 days retention policy by default.
13+
RESET_PIP_CACHE: 0
14+
PACKAGE_NAME: PyAEDT
815
# Controls when the workflow will run
916
on:
1017
# Triggers the workflow on push or pull request events but only for the main branch
@@ -35,6 +42,56 @@ jobs:
3542
with:
3643
python-version: ${{ matrix.python-version }}
3744

45+
- name: Linux pip cache
46+
uses: actions/cache@v2
47+
if: ${{ runner.os == 'Linux' }}
48+
with:
49+
path: ~/.cache/pip
50+
key: Python-v${{ env.RESET_PIP_CACHE }}-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}-${{ hashFiles('requirements_tests.txt') }}
51+
restore-keys: |
52+
Python-v${{ env.RESET_PIP_CACHE }}-${{ runner.os }}-${{ matrix.python-version }}
53+
54+
- name: Window pip cache
55+
uses: actions/cache@v2
56+
if: ${{ runner.os == 'Windows' }}
57+
with:
58+
path: ~\AppData\Local\pip\Cache
59+
key: Python-v${{ env.RESET_PIP_CACHE }}-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}-${{ hashFiles('requirements_tests*.txt') }}
60+
restore-keys: |
61+
Python-v${{ env.RESET_PIP_CACHE }}-${{ runner.os }}-${{ matrix.python-version }}
62+
63+
- name: Install PyAEDT
64+
run: pip install .
65+
66+
# - name: Test import
67+
# working-directory: tests
68+
# run: python -c "import pyaedt"
69+
70+
- name: Retrieve PyAEDT version
71+
run: |
72+
echo "::set-output name=PYAEDT_VERSION::$(python -c "from pyaedt import __version__; print(__version__)")"
73+
echo "PyAEDT version is: $(python -c "from pyaedt import __version__; print(__version__)")"
74+
id: version
75+
76+
- name: Generate wheelhouse
77+
run: |
78+
pip install wheel setuptools -U
79+
pip wheel . -w wheelhouse
80+
81+
82+
- name: Zip wheelhouse
83+
uses: vimtor/action-zip@v1
84+
with:
85+
files: wheelhouse
86+
dest: ${{ env.PACKAGE_NAME }}-v${{ steps.version.outputs.PYAEDT_VERSION }}-wheelhouse-${{ runner.os }}-${{ matrix.python-version }}.zip
87+
88+
- name: Upload Wheelhouse
89+
uses: actions/upload-artifact@v2
90+
with:
91+
name: ${{ env.PACKAGE_NAME }}-v${{ steps.version.outputs.PYAEDT_VERSION }}-wheelhouse-${{ runner.os }}-${{ matrix.python-version }}
92+
path: '*.zip'
93+
retention-days: 7
94+
3895
- name: 'Create virtual env'
3996
run: |
4097
python -m venv testenv
@@ -107,3 +164,13 @@ jobs:
107164
env:
108165
TWINE_USERNAME: __token__
109166
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
167+
168+
- name: Release
169+
uses: softprops/action-gh-release@v1
170+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
171+
with:
172+
files: |
173+
./**/*.whl
174+
./**/*.tar.gz
175+
./**/*.pdf
176+
./**/*.zip

0 commit comments

Comments
 (0)