diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 0f5398025aa..f6f90bfdce8 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -45,6 +45,7 @@ jobs: key: Python-v${{ env.RESET_PIP_CACHE }}-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}-${{ hashFiles('requirements/requirements_tests*.txt') }} restore-keys: | Python-v${{ env.RESET_PIP_CACHE }}-${{ runner.os }}-${{ matrix.python-version }} + - name: Install PyAEDT run: pip install . diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 99dabd93ddf..b61cefec9dd 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -5,6 +5,13 @@ name: CI env: python.version: 3.8 python.venv: 'testvenv' + # Following env vars when changed will "reset" the mentioned cache, + # by changing the cache file name. It is rendered as ...-v%RESET_XXX%-... + # You should go up in number, if you go down (or repeat a previous value) + # you might end up reusing a previous cache if it haven't been deleted already. + # It applies 7 days retention policy by default. + RESET_PIP_CACHE: 0 + PACKAGE_NAME: PyAEDT # Controls when the workflow will run on: # Triggers the workflow on push or pull request events but only for the main branch @@ -35,6 +42,56 @@ jobs: with: python-version: ${{ matrix.python-version }} + - name: Linux pip cache + uses: actions/cache@v2 + if: ${{ runner.os == 'Linux' }} + with: + path: ~/.cache/pip + key: Python-v${{ env.RESET_PIP_CACHE }}-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}-${{ hashFiles('requirements_tests.txt') }} + restore-keys: | + Python-v${{ env.RESET_PIP_CACHE }}-${{ runner.os }}-${{ matrix.python-version }} + + - name: Window pip cache + uses: actions/cache@v2 + if: ${{ runner.os == 'Windows' }} + with: + path: ~\AppData\Local\pip\Cache + key: Python-v${{ env.RESET_PIP_CACHE }}-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}-${{ hashFiles('requirements_tests*.txt') }} + restore-keys: | + Python-v${{ env.RESET_PIP_CACHE }}-${{ runner.os }}-${{ matrix.python-version }} + + - name: Install PyAEDT + run: pip install . + + # - name: Test import + # working-directory: tests + # run: python -c "import pyaedt" + + - name: Retrieve PyAEDT version + run: | + echo "::set-output name=PYAEDT_VERSION::$(python -c "from pyaedt import __version__; print(__version__)")" + echo "PyAEDT version is: $(python -c "from pyaedt import __version__; print(__version__)")" + id: version + + - name: Generate wheelhouse + run: | + pip install wheel setuptools -U + pip wheel . -w wheelhouse + + + - name: Zip wheelhouse + uses: vimtor/action-zip@v1 + with: + files: wheelhouse + dest: ${{ env.PACKAGE_NAME }}-v${{ steps.version.outputs.PYAEDT_VERSION }}-wheelhouse-${{ runner.os }}-${{ matrix.python-version }}.zip + + - name: Upload Wheelhouse + uses: actions/upload-artifact@v2 + with: + name: ${{ env.PACKAGE_NAME }}-v${{ steps.version.outputs.PYAEDT_VERSION }}-wheelhouse-${{ runner.os }}-${{ matrix.python-version }} + path: '*.zip' + retention-days: 7 + - name: 'Create virtual env' run: | python -m venv testenv @@ -107,3 +164,13 @@ jobs: env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + + - name: Release + uses: softprops/action-gh-release@v1 + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + with: + files: | + ./**/*.whl + ./**/*.tar.gz + ./**/*.pdf + ./**/*.zip \ No newline at end of file